I know that LTSpice can compute simulation in .step and .list param functions. However, those lists are ideal (not real).

Is there a means to use the .step and .list param function for real components (components in the library)?.


1 Answer 1


You can use numeric literals together with the keyword AKO (A Kind Of) to step between .MODEL definitions, and numeric literals instead of names for .SUBCKT, but with certain conditions.

Example #1:


The name of Q1 is {x} which, because it's between curly braces, it will be evaluated. If it was simply x, it would have had to have a .MODEL X ... defined. The .STEP command assigns the values 1 and 2 to it. Due to the AKO, these will mean 2n3904 and 2n2222, respectively.

Example #2:


It's using letters for pin names to avoid ambiguities with the name, itself. For .SUBCKT this is only possible if the options Save Subcircuit Node Voltage/Currents are not checked in the Control Panel > Save Defaults tab, or if the stepped subcircuits have identical topologies. The reason is as follows:

The two subcircuits are 1 and 2 and they are different under the hood -- 1 has one resistor and two nodes, 2 has two resistors and three nodes. When the parser is done with the circuit, the whole netlist is "flattened", i.e. there will be no subcircuits, but an extended version of each component. This can be seen by either checking Control Panel > Operation > Generate Expanded Listing, or by adding .opt list to the schematic, and then viewing the error log. If either of those two mentioned options is checked, then the matrix will have one size for 1, and another for 2, which is contradictory in the same run.

Note that in all these cases, the {x} must evaluate to a number, it can't be anything else.

  • \$\begingroup\$ Thank you very much. That helps a lot \$\endgroup\$
    – Ady
    Apr 26, 2021 at 22:52
  • 1
    \$\begingroup\$ @Ady If you think this helped you then be sure to select the answer (the green check mark). This way, when other users will search for similar problems in the future, they will see this question with an accepted answer. \$\endgroup\$ Apr 27, 2021 at 4:35

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.