1
\$\begingroup\$

When are you required to use {} braces around an expression, and when can you optionally use braces? I realise that this is simulator-specific, and different simulators seem to have different requirements. I think that the original 'correct' answer would have been that only parameter names, or alternatively expressions which include a parameter name, should have braces around them, but I'm not sure, and any sim-specific replies would be useful.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ What does the manual say? \$\endgroup\$ Nov 4, 2020 at 11:03
  • \$\begingroup\$ Lots of different manuals, none of which are particularly informative. ngspice only makes a distinction between netlist construction and run-time evaluation, for example. LTSpice appears to requires braces around the entire expression to trigger parameter substitution. \$\endgroup\$
    – QF0
    Nov 4, 2020 at 11:11
  • 1
    \$\begingroup\$ So the answer is: it depends on the simulator, you should read the manual. \$\endgroup\$ Nov 4, 2020 at 11:15
  • \$\begingroup\$ @Bimpelrekkie: as I said in the question, it appears to depend on the simulator. The 'correct' usage is presumably defined by Spice 3f3 or similar, but the stuff I can find online is not clear what 3f3 requires. I was hoping to find someone who has thought about this problem before and has a clearer idea, and can perhaps recommend a generic usage. \$\endgroup\$
    – QF0
    Nov 4, 2020 at 11:19

1 Answer 1

2
\$\begingroup\$

The usage for SPICE 3f3 is defined by the manual for SPICE 3f3. The usage for LTSPICE is defined by the manual for LTSPICE. The usage for PSPICE is defined by the manual for PSPICE.

These are three different programs and their authors have defined different syntax for mathematical expressions.

You should not expect LTSPICE or PSPICE to follow the SPICE 3f3 syntax, or to match each other.

Ngspice is actually based on the SPICE 3f5 code-base, so it is more likely (but not guaranteed) that ngspice syntax will be similar to SPICE 3f3.

It's unfortunate, but something that you'll have to live with, that there is no official standard defining SPICE syntax, and particularly in the area of mathematical expressions different SPICEs have different syntax.

The 'correct' usage is presumably defined by Spice 3f3 or similar, but the stuff I can find online is not clear what 3f3 requires.

After reading the Spice 3f3 manual I believe the reason for this is simply that Spice 3f3 doesn't allow parameter substitutions in many of the places that newer SPICEs do. For example, you can not use a math expression to define the BETA parameter of a BJT.

There is an "interactive interpreter" that allows you to use expressions to modify model parameters using expressions through a command-line interface after loading the model, but no syntax to allow using such expressions in the initial circuit definition in the SPICE "deck".

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.