Sensitivity and Worst-case Analyses

In this topic:

General Operation

Sensitivity analysis repeats an analysis for each defined tolerance parameter. In each case the chosen parameter is perturbed by the tolerance range scaled by a fixed scaling parameter called "span". For example, a circuit which has four resistors with a 2% tolerance defined will run four times with each resistor perturbed in turn by +2% if span is set to 1.0.

One or more sensitivity measurement functions may be defined and these will be evaluated after the sensitivity analysis is completed. The results of evaluating these functions, along with the perturbation data is stored in an XML format data file, called the MSW file (Monte Carlo, Sensitivity, Worst-case). The MSW file is used as the input to a subsequent worst-case analysis and may also be used with front end tools to display sensitivity data such as deviation from nominal and normalised sensitivity values.

Although it usual to specify sensitivity measurement functions using .SENSMEAS statements in the simulation netlist, it is also possible at the script level to add the results of additional sensitivity measurements after the simulation has completed. This can be done with the AppendSensitivityData script function Script Reference Manual/Function Reference/AppendSensitivityData.

Worst-case analysis assumes that by setting each component or parameter at one or other extreme, that is either +tolerance or -tolerance, the worst possible result will be obtained. This isn't guaranteed to be the case, but this method does tend to locate results that are substantially outside the limits predicted by a Monte-Carlo analysis. To decide whether or not to use the +tolerance or -tolerance value, the results of a prior sensitivity analysis are used. The sign of the sensitivity to the sensitivity measurement function for each parameter is all that is needed.

Worst-case analysis also generates an MSW file that is used by the front-end to display a worst-case report.

Both Sensitivity and worst-case analyses may be run in both multi-step and single-step modes. Multi-step sensitivity and worst-case may be used with Transient, AC, DC, transfer function and noise analyses. Single-step sensitivity and worst-case may be used with AC, DC, transfer function and noise analyses.


Sensitivity analyses and worst-case analyses are invoked in the same way as other multi-step analyses (see General Sweep Specification). As worst-case analyses depend on a prior sensitivity analysis, it is usual for both analysis specifications to be included together. In addition, at least one sensitivity measurement function will be required if both sensitivity and worst case are run together. See Sensitivity Measurement Functions.

The basic syntax for sensitivity and worst-case analysis is described below:

Sensitivity Analysis
.analysis_name analysis_parameters SWEEP SENS [SENSID sensid]
[SPAN span] [OUTFILE sens_outfile]  [NUMCORES num_cores]
Worst-case Analysis
.analysis_name analysis_parameters SWEEP WC [SENSID sensid]
[INFILE sens_infile] [OUTFILE wc_outfile] [WCID wcid]
sensid Identifier for sensitivity analysis. In the SENS specification this may be any arbitrary string. This may then be used in a worst-case analysis (WC specification) to signify that the worst-case analysis should receive its sensitivity data from that analysis. The sensid value must also be included in sensitivity measurement function (.SENSMEAS) definitions. If sensid is omitted from the sweep specification, a default value will be used as described in the following table:
.TRAN multi-step TRAN
.AC multi-step AC
.DC multi-step DC
.TF multi-step TF
.NOISE multi-step NOISE
.AC sweep sweep_AC
.DC sweep sweep_DC
.TF sweep sweep_TF
.NOISE sweep sweep_NOISE

Proportion of the tolerance on a component that is perturbed for sensitivity measurement. The default value is 1.0 meaning that the component will be perturbed the whole tolerance from its nominal value

File that will receive the sensitivity data. This is an XML format file that is used to generate reports and pass data to a subsequent worst-case analysis. It is not usually necessary to specify this parameter; a default file located in the temporary data directory will be used if this parameter is omitted

Specifies input data file for a worst-case analysis. This file is usually generated by a sensitivity analysis. If omitted the file specified by sens_outfile in the most recent sensitivity analysis sharing the same sensid will be used.

Identifier for worst-case analysis. This is used to identify sensitivity measurement functions that should be called to provide data output for this analysis. If omitted, the parameter defaults to the value of sensid

Data output file for worst-case analysis


Run a sensitivity analysis on a 200us transient analysis.


Run a sensitivity and worst-case analysis on a 200us transient analysis. This would also need a sensitivity measurement function for the worst-case analysis to run. See Sensitivity Measurement Functions

Run a DC sensitivity analysis followed by a worts-case analysis on DC sweep. Sensitivity uses a 0.1 span meaning that the sensitivity perturbation will be 10% of the tolerance of each parameter.
.dc v1 -100m 100m 2m SWEEP SENS span=0.1
.dc v1 -100m 100m 2m SWEEP WC

Single Step Sweep

Sensitivity and worst-case single-step sweep analyses run each case as a single point. This is distinct from a multi-step analysis which runs a complete multi-point analysis for each sensitivity case.

The basic syntax for single-step sensitivity and worst-case analysis sweeps is described below:

Sensitivity Analysis
.analysis_name SENS [SENSID sensid] [SPAN span] [OUTFILE sens_outfile] analysis_parameters
Worst-case Analysis
.analysis_name WC [SENSID sensid] [INFILE sens_infile] analysis_parameters
[OUTFILE wc_outfile] [WCID wcid]

See Multi-step sensitivity for details of the meaning of the above parameters.


Run a sensitivity on an AC analysis at 1Meg frequency
.AC SENS F=1000000
As above but also run a worst-case analysis. Note this will also need a sensitivity measurement function.
.AC SENS F=1000000
.AC WC F=1000000

Sensitivity Measurement Functions

A Sensitivity measurement function defines a quantity whose sensitivity to circuit parameters is to be measured. Any number of sensitivity measurement functions may be defined. The results of the function evaluation is stored in a datafile that sensitivity analyses always generate. This datafile, in XML format, is used as the input to worst-case analysis and also as input to front end tools that can display the final sensitivity data.

The syntax for each sensitivity measurement function is as follows:
.SENSMEAS id expression
id identifier corresponding to the sensid parameter defined for sensitivity analyses or wcid parameter for worst-case analyses. Usually this is set to one of the defaults defined for each analysis type. These are listed in Multi-step Sensitivity.
expression Expression to evaluate. For multi-step analyses this must be a function that returns a scalar measurement from a vector. For example the Mean1() function returns the mean of a vector. For single step analyses, this would usually simply be the name of a vector - e.g. VOUT with no function applied as the measurement for each case is a single element of the vector. For AC analyses it will be necessary to apply a complex-real conversion function such as mag(), db(), phase, re() or im()