Duncan Wither
LTSpice
Info:
.step param
- steps throguh paramiter values. Reference
.param
- sets a parameter to a specific value.
.measure
allows you to retain the key info from each simulation.
- This outputs to the log.
- Right clicking these numbers on the logs lets you plot it.
- Reference
- You can use either of the insert text commands, and enure the comment radio button is selected.
- Alternatively you can prepend your spice directive with an
*
to convert it to a comment.
- e.g.
*.step param Voff -10 10 1
is ignored (instead of stepping through the parameter).
- This is useful for selecting specific simulations to run on the same circuit quickly.
Parameters
- You can use parameters to more easily step through values
- Define parameters with a
.param
statement
- Make sure it’s a spice directive, not a comment
- To use it in values (i.e. as a voltage or time etc.) use curly brackets
- You can run multiple simulations where you step through param values with .step
- This will re-run the sim for each of the values given.
- Multiple .step statements will run one after the other, so every combination will occur.
- To prevent this, and use pairs / triples use a table.
*Stepping:
.step oct param X 100u 100m 1
*Table:
.step param X list 1 2 3
.param IND=tab1e(X, 1, 14.7, 2, 9.1, 3, 0)
-param RES=table(X, 1, 22700, 2, 47200, 3, 1G)
Example usage:
Random Numbers
- This is for generating random numbers, useful in monte carlo simulaitons
gauss(x)
; A random number from Gaussian distribution with a sigma of x
flat(x)
; A random number between -x and x with uniform distribution
mc(x,y)
;A random number between x(1+y) and x(1-y) with uniform distribution.
Initial Conditions
.ic
sets initial conditions.
- Often useful for caps or inductors.
.ic V(capv)={X}
sets the net capv
to the value of param X
.
- see wiki and spiceman for more info.