2
\$\begingroup\$

I have around 10 resistors in a circuit, all with the default value "R".

I defined the directive

.param R=100

Upon running the simulation, I get the error message

Can't find definition of model "R"

Is there a general way to assign a value to all Rs at once or do I have to do it by hand one by one?

\$\endgroup\$
4
\$\begingroup\$

You need to set the value of those resistors to R=R. So, where you used to set the value to a number without a preceding R=, now the value has to start with R=

It may be more clear to use .param Rdefault=100 and R=Rdefault.

Make sure the .param Rdefault=100 is a spice directive, not a comment.

In answer to using curly braces { and }:
For both versions of LTspice (IV and XVIII) applies that when you want to assign a numerical value in the form of an equation, you have to use burly braces.
For example, when setting the value to {arctan(1)*4}.
In OP's question, setting the value to {Rdefault} will work too.

However, for non-numerical values, you need to (and for numerical values you can) precede the value with R= . When preceding it with R=, you do not need to use the burly braces:
E.g. when setting the value to R=arctan(1)*4*time

Therefore my suggestion to always use the preceding R=

|improve this answer|||||
\$\endgroup\$
  • 1
    \$\begingroup\$ Doesn't it need to be R={R}? Or does that depend on which version of LTSpice? \$\endgroup\$ – The Photon May 21 '19 at 5:35
  • \$\begingroup\$ @ThePhoton Please check my update. It's not version dependent, but expression dependent. \$\endgroup\$ – Huisman May 21 '19 at 8:15
  • 1
    \$\begingroup\$ All of them are numerical values, time translates in a dynamic value. R= only means you can assign expressions that are time-dependent, that's all. The curly braces can exist, or not for behavioural expressions, but are mandatory for fixed values since those are meant to be parsed at the beginning and replaced with their resulting value -- curly braces (or single apostrophe, ') do that. In behavioural expression they're not needed since the parser knows that the expression after equal needs to be evaluated, whether statically (like {x}), or dynamically (like R=x*time). \$\endgroup\$ – a concerned citizen May 21 '19 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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