0
\$\begingroup\$

I am currently attempting to use the step function to simplify/increase portability of some of work circuits. Can't share the exact circuit, however I am simply attempting to define a variable/s, use those variables within some calculations, and finally pipe the equations output into the step function.

A simplified version of what I am attempting to do may be seen here:

Simplified Test Setup

When I try to simulate the circuit above I get the following error.Test Set Error

I guess my question has two parts:

  1. Is there a way to force LT to perform the calculations first?
  2. Is there possibly another command or action that might be better suited for what I am trying to accomplish?

Thanks in advance!

\$\endgroup\$
1
\$\begingroup\$

Is there possibly another command or action that might be better suited for what I am trying to accomplish?

Use

.param a=0
.step param x list 1 2 3

and set the value of B1 to V={a+x}

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ By the way, if need be, I've used a LIST with 1 2 3 ... etc., to select BJT models which were named 1 2 3 ... etc. You can name a model with a number. Works. \$\endgroup\$ – jonk Oct 28 '19 at 6:10
0
\$\begingroup\$

Is there a way to force LT to perform the calculations first?

Yes there is, you can make a netlist file and reorder the lines in the netlist file, the problem with doing so it it isn't the order of the compiler 'exectuing' the lines that is causing a problem. The problem seems to be that list's can't accept curly brackets, only constants

* C:\Program Files (x86)\LTC\LTspiceIV\blah.net
B1 V1 0 V={x}
.param a=0 x1=a+1
.step param x list 1 {a}
.tran 1
.backanno
.end

Is there possibly another command or action that might be better suited for what I am trying to accomplish?

Yes, using if then statements in a b-source block is probably the best way to handle multiple statements.

IF statement on LTspice

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ The problem seems to be that list's can't accept curly brackets, only constants I think the help file confirms this (although not obviously clear): "Steps may be linear, logarithmic, or specified as a list of values" \$\endgroup\$ – Huisman Oct 28 '19 at 5:49
  • \$\begingroup\$ @Huisman That is the problem here. You are right. \$\endgroup\$ – jonk Oct 28 '19 at 5:59
  • \$\begingroup\$ That was my take-away from the documentation, and it is not clear. I suspect that if lt spice were to support this it would need to check the validity of the .param statements before the list, which turns into a logic nightmare so they left it at constants. I've learned that any special logic that is needed can be handled by b sources and is best used there \$\endgroup\$ – Voltage Spike Oct 28 '19 at 6:21

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.