2
\$\begingroup\$

enter image description here

I would expect the voltage source to output 20V but the simulation throws an error instead.

\$\endgroup\$

1 Answer 1

7
\$\begingroup\$

You need to write {2*V} instead of {V}*2.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks. When I try 2{V} or 2*{V} it throws an error and sets the voltage to 2 volts instead of the expected 20. So maybe you tried it with .param V=1 which makes it look like it's correct? \$\endgroup\$
    – Cedric
    Nov 14, 2021 at 15:38
  • \$\begingroup\$ You are correct. However, the {2*V} seems to work for me and give the correct result also with different values for V. Also without the "=". \$\endgroup\$
    – user24368
    Nov 14, 2021 at 16:00
  • \$\begingroup\$ Yep, {2*V} works perfectly. \$\endgroup\$
    – Cedric
    Nov 14, 2021 at 17:29
  • 2
    \$\begingroup\$ While this is a correct answer, it might be worth adding that the curly braces perform evaluation, and all parameter substitution happens before the start of the simulation. Since a voltage source can only accept parameters that are not time-dependent, the evaluation must be performed for all the expression that makes the value of the source, therefore the curly braces need to enclose everything in it that needs to be evaluated. \$\endgroup\$ Nov 14, 2021 at 19:29

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.