next up previous contents index
Next: .ac Line Up: Analysis Specification Previous: Analysis Specification   Contents   Index


Chained Sweep Analysis

WRspice has a swept analysis feature. This allows ac, noise, transfer function, sensitivity, and transient analyses to have an additional one or two dimensional sweep specification, resulting in the analysis being performed at each parameter value, producing a multidimensional output plot.

The syntax is

analysis dc| sweep pstr1 start1 [stop1 [incr1]] [pstr2 start2 [stop2 [incr2]]]

The initiating keyword can be ``dc'' or ``sweep'', and is followed by one or two parameter specifiers and ranges. This is the same syntax as accepted in the WRspice .dc line, which is an extension of the traditional DC source sweep. In WRspice, any circuit parameter can be swept. This is far more powerful than the original SPICE dc sweep, which only allowed sweeping of source outputs.

For example, a regular SPICE dc sweep would have a form like:

Example:
.ac dec 10 1Hz 1Khz dc v1 0 2 .1 v2 4.5 5.5 .25

This will perform an ac analysis with the dc sources v1 and v2 stepped through the respective ranges. The resulting output vectors will have dimensions [5,21,61], as can be seen with the display command interactively. This represents 61 points of frequency data at 21 v1 values at 5 v2 values. Typing ``plot v(1)'' (for example) would plot all 21*5 analyses on the same scale (you probably don't want to do this). One can also type (as examples) ``plot v(1)[1]'' to plot the results for v2 = 4.75, or ``plot v(1)[0][1]'' for v2 = 4.5, v1 = .1, etc. Range specifications also work, for example ``plot v(1)[2][0,2]'' plots the values for v2 = 5.0, v1 = 0.0, 0.1, 0.2.

WRspice also allows forms like

Example:
.ac dec 10 1Hz 1Khz dc R1[res] 800 1200 100 R5[res] 10 20 1
This will perform the ac analysis as the values of two resistors are swept.

Warning: The memory space required to hold the plot data can grow quite large, so be reasonable.

Multi-threading (see 1.4) will be used for chained analysis if the loopthrds variable is set to a positive value. This can parallelize the runs on computers with multiple cores or CPUs, speeding evaluation.


next up previous contents index
Next: .ac Line Up: Analysis Specification Previous: Analysis Specification   Contents   Index
Stephen R. Whiteley 2024-10-26