by
Wenton L. Davis
SPICE analysis cards are commands to a SPICE program that control the simulation of a circuit.
.SP is ngspice only
.ac dec nd fstart fstop .ac oct no fstart fstop .ac lin np fstart fstop
Perform an AC analysis. This allows analysis of amplitude and phase of signals in a circuit at different frequencies.
dec nd speficies performing analysis over a decade (f2 = 10 * f1), with nd points per decade being analyzed. oct no specifies an octave analysis (f2 = 2 * f1) with no points per octave. lin np performs analysis over a linear frequency scale with np total points.
Examples:
.ac dec 10 1 10K .ac oct 10 10K 1MEG .ac lin 100 1 100Hz
Example circuit:
rin 1 2 220 cfilt 2 0 10uF vin 1 0 dc 0 ac 1 * <-- the ac source .options noacct .ac dec 10 10 1K .plot ac vdb(2) xlog .end
.SP (ngspice only) performs the same function as .AC, but an additional parameter, donoise may be included to perform noise analysis:
.sp dec 10 1 10K 1
.dc srcnam vstart vstop vincr <src2 start2 stop2 incr2>
Perform a DC transfer analysis, sweeping a component (or temperature) from a start value to a stop value, given a specific step value. If a second source is specified, the first source sweep occurs for each value of the second source sweep.
Examples:
.dc VIN 0.25 5.0 0.25 .dc VDS 0 10 0.5 VGS 0 5 1 .dc VCE 0 10 0.25 IB 0 10u 1u .dc Rload 1k 2k 100 .dc TEMP -1 75 5
.disto dec nd fstart fstop <f2overf1> .disto oct no fstart fstop <f2overf1> .disto lin np fstart fstop <f2overf1>
The .DISTO analysis does small-signal distortion analysis of a circuit by a multi-dimensional Volterra series using multidimensional Taylor series to represent non-linearities. Terms up to trid order are used.
The .DISTO command uses the same parametrs as the .AC command, with an optional f2overf1 parameter. If this parameter is left out, .DISTO performs a harmonic analysis. If this parameter is included, it must be between (not equal to) 0.0 and 1.0. F1 is swept according to the .AC analysis, while F2 is held constant.
Only a few nonlinear device models support distortion analysis in ngspice: Diode, BJT, JFET (level 1), MOSFETs (levels 1, 2, 3, 9, and BSIM1), and MESFETs (level 1).
.noise v(output <,ref>) src ( dec | lin | oct ) pts fstart fstop <pts_per_summary>
Noise analysis examines noise at the ouput node. If ref is specified, the output is calculated as v(output)-v(ref). src is the independent source the noise is applied to. The remainder of the parameters are as defined in the .AC analysis. The optional pts_per_summary is an integer value indicating the number of frequency points the for each noise contribution.
The .NOISE analysis produces two plots, controlled by the setplot command. setplot noise1 selects Voltage or Current Noise Density (in V/sqrt(Hz) or A/sqrt(Hz)), resulting in two vectors: onoise_spectrum is the voltage or current divided by sqrt(Hz), and inoise_spectrum is the equivalent input noise divided by the gain of the circuit. setplot noise2selects Total Integrated Noise (in Volts or Amps) over the frequency range, again produsing two output vectors: onoise_total is the output noise voltage, and inoise_total is the equivalent input noise = output noise divided by circuit gain.
By default, the output vectors are measured in Voltage or Current Noise Spectral Density (V/sqrt(Hz) or A/sqrt(Hz)), but if preceded by set sqrnoise, the output vectors we be delivered as V2/Hz or I2/Hz. This can then be reset using unset sqrnoise.
.op
The .OP analysis performs a operating point of the circuit assuming that inductors are shorted and capacitors are open. This can be used to simplify the DC analysis, and is required by some versions of SPICE before any other analysis is performed.
.pz node1 node2 node3 node4 cur pol .pz node1 node2 node3 node4 cur zer .pz node1 node2 node3 node4 cur pz .pz node1 node2 node3 node4 vol pol .pz node1 node2 node3 node4 vol zer .pz node1 node2 node3 node4 vol pz
Pole-Zero analysis is available in ngspice for instances where convergence fails. If non-convergence is found in poles or zeros, then at least the other can be found. The 5th parameter (cur/vol) is used to select the transfer function; cur selects output voltage/input current, while vol selects output voltage/input voltage. The final parameter determines whether to perform pol for pole-only, zer for zero-only, ot pz for both.
.sens outvar <filter> <DC>
.sens outvar <filter> AC {dec nd|oct no|lin np} fstart fstop
The .SENS analysis measures sensitiviy of outvar to device an model parameters. The first form calculates the sensitivity using a DC analysis, while the second form uses AC analysis. In ths case of AC analysis, the frequency spectrum is defined the same way as the .AC circuit analysis.
Output values of the .SENS analysis are in the units of change in input per unit chage of input; NOT percent change in output or percent change in input.
Examples:
.sens V(1,OUT) .sens v(out) AC dec 10 100 100K .sens i(vtest) rbias m*_* q*:*
.tf outvar insrc
The .TF analysis performs a small-signal analysis, finding a ratio of outvar over insrc where outvar is the output measurement and insrc is the input source.
Examples:
.tf v(5,3) vin .tf i(VLOAD) vin
.tran tstep tstop <tstart <tmax>> <uic>
Transient (time) analysis is performed over the range tstart (0 is assumed if this parameter is missing) to tstop, using increments of tstep for each line of output. tmax is used to indicate a maximum step size; the program will choose the smaller of either tstep or (tstop-tstart)/50.0. The optional uic parameter tells the .TRAN to use initial conditions given for components instead of defaulting to open capacitors and shorted inductors, and dependent sources are defaulted to 0.