Spice3f5

steprun

Run the circuit stepped, as .step

General form

steprun [lin] what start stop increment
steprun dec|oct what start stop points
steprun what list value [value ...]
steprun

Run the circuit several times, once for each of a set of values of a parameter, and collect the results of all the runs. steprun steps the circuit by the one specification given, instead of by the circuit's .step cards; with no arguments it is the same as run. (The step command is the debugger's, for single-stepping a simulation.)

Usually the steps are given in the circuit with .step cards, which take the same arguments:

.step c1 list 0.5n 1n 2n
.step param rval list 1k 2k

A run (the run command, the Run menu, or batch mode) then runs the circuit once for each step.

Values

[lin] what start stop increment
From start to stop in steps of increment.
dec|oct what start stop points
Logarithmically from start to stop, with points values per decade or octave.
what list value ...
Each of the values listed.

What can be stepped

param name
A .param. The circuit is read again with each value, and the other .params are evaluated again.
temp
The circuit temperature.
dev
A device's principal value, for example r1, c1 or v1.
type model(param)
A model parameter, for example npn q2n2222(bf).
@name[param]
Any device or model parameter.

Results

Several .step cards nest, the first card varying fastest. At the end of the run, the .meas results of all the steps are printed in a table.

The plots made by the steps are then merged: for each analysis there is one plot in which each vector has a dimension for each .step card (the last card's first) as well as its own. So in examples/step_demo.cir, which steps c1 and then the parameter rval, a transient vector has the dimensions [rval][c1][time], and

If the steps' scales differ (for example their transient timesteps), each step's results are interpolated onto a common scale. Results with one value per step, such as an operating point or a .meas result, instead become vectors over the steps, with the first card's values as their scale, so plot risetime draws the rise time against the stepped value. The stepped values are vectors too, named after what was stepped, so a plot against them is labelled with that name.

The plots of the individual steps are deleted unless the variable keepsteps is set. run file writes each step's plot to the rawfile.

Afterwards the stepped values are restored. Stepping a .param reads the circuit again, which loses any changes made by alter or optimise.

Example

From examples/step_demo.cir: an RC low pass whose resistor is set by a .param, stepped over three capacitor values and two resistor values, six runs in all. The 10%–90% rise time is 2.2·R·C.

.param rval=1k
vin in 0 pulse(0 1 1u 1n 1n 50u 100u)
r1 in out 'rval'
c1 out 0 1n

.tran 0.05u 20u
.meas tran risetime TRIG v(out) VAL=0.1 RISE=1 TARG v(out) VAL=0.9 RISE=1

* Step c1 (the first card varies fastest), then the .param
.step c1 list 0.5n 1n 2n
.step param rval list 1k 2k

.control
run
display
* A curve for each step
plot v(out)
* The rise time against c1, for each rval
plot risetime
* One step's curve: rval=2k (index 1), c1=1n (index 1)
plot v(out)[1][1]
.endc

All commands