The National Instruments SPICE Simulation Fundamentals series is your free resource on the internet for learning about circuit simulation. The series is a set of tutorials and information on SPICE simulation, OrCAD pSPICE compatibility, SPICE modeling, and other concepts in circuit simulation.
For more information, see the SPICE Simulation Fundamentals main page.
The series is divided among a number of indepth detailed articles that will give you HOWTO information on the important concepts and details of SPICE simulation.
Circuit simulation is an important part of any design process. By simulating your circuits, you can detect errors early in the process, and avoid costly and time consuming prototype reworking. You can also easily swap components to evaluate designs with varying bills of materials (BOMs).
SPICE is a rich and robust language capable of performing several advanced circuit analyses. The first version of SPICE provided a textonly interface, in which users were forced to manually type statements to control the simulator. Modern simulation programs like Multisim provide a graphical interface to choose these same options. This article provides a listing of the commands and analyses available in SPICE as well as their original syntax and usage.
The following analyses and commands are available in SPICE:
Syntax 
.OP 
Example 
.OP 
Notes 
The inclusion of this line in an input file directs SPICE to determine the DC operating point of a circuit with inductors shorted and capacitors opened. Note: a DC analysis is automatically performed prior to a transient analysis to determine initial conditions, and prior to an AC smallsignal, Noise, and PoleZero analysis to determine the linearized, smallsignal models for nonlinear devices. 


Syntax 
.DC SRCname Vstart Vstop Vincr [SRC2 START2 STOP2 INCR2] 
Example 
.DC VIN 0.25 5.0 0.25 
Notes 
The DC line defines the source and sweep limits for a DC transfer curve (capacitors open and inductors shorted). SRCname is the name of an independent voltage or current source. Vstart, Vstop, and Vincr are the starting, final, and incrementing values respectively. 


Syntax 
.AC DEC ND Fstart Fstop 
Example 
.AC DEC 10 1 10K 
Notes 
If this line is included in the input file, SPICE performs an AC analysis of the circuit over a specified frequency range. DEC stands for decade variation, and ND is the number of points per decade. OCT stands for octave variation, and NO is the number of points per octave. LIN stands for linear variation, and NP is the number of points. Fstart is the starting frequency, and Fstop is the final frequency. Note: In order for this analysis to be meaningful, at least one independent source must have been specified with an ac value. 


Syntax 
.DISTO DEC ND Fstart Fstop <F2OVERF1> 
Example 
.DISTO DEC 10 1kHz 100Mhz 
Notes 
The Disto simulation command does a smallsignal distortion analysis of a circuit. A multidimensional Volterra series analysis is done using multidimensional Taylor series to represent the nonlinearities at the operating point. Terms of up to third order are used in the series expansions. If the optional parameter F2OVERF1 is not specified, .DISTO does a harmonic analysis. In this situationm, the distortion analysis in the circuit uses only a single input frequency, F1. F1 is then is swept over the specified frequency arguments in the .DISTO command (exactly as in the .AC command). Inputs at this frequency may be present at more than one input source, and their magnitudes and phases are specified by the arguments of the DISTOF1 keyword in the input file lines for the input sources (see the description for independent sources). 


Syntax 
.NOISE V(OUTPUT <,REF>) SRC ( DEC  LIN  OCT ) PTS Fstart Fstop <PTS;_PER_SUMMARY> 
Example 
.NOISE V(5) VIN DEC 10 1kHZ 100Mhz 
Notes 
The Noise command line does a noise analysis of a circuit. OUTPUT is the node at which the total output noise is desired; if REF is specified, then the noise voltage, V(OUTPUT)  V(REF), is calculated. By default REF is assumed to be ground. SRC is the name of an independent source to which input noise is referred. PTS, Fstart and Fstop are .AC type parameters that specify the frequency range over which plots are desired. PTS_PER_SUMMARY is an optional integer that specifies the noise contributions of each noise generator for every PTS_PER_SUMMARY frequency points. 


Syntax 
.PZ N1 N2 N3 N4 CUR POL 
Example 
.PZ 1 0 3 0 CUR POL 
Notes 
CUR stands for a transfer function of the type (output voltage)/(input current) while VOL stands for a transfer function of the type (output voltage)/(input voltage). POL stands for pole analysis only, ZER for zero analysis only and PZ for both. This feature is provided mainly for the situation of nonconvergence. This ensures that at least one of either the poles or zeros of the circuit can be determined. Finally, N1 and N2 are the two input nodes while N3 and N4 are the two output nodes. The ability to define these input and output nodes ensures complete freedom in the specification of the output and input ports, and thus the type of transfer function. 


Syntax 
.SENS OUTvar 
Example 
.SENS V(1,OUT) 
Notes 
The sensitivity of OUTvar to all nonzero device parameters is calculated when the SENS analysis is specified. OUTvar is a circuit variable (node voltage or voltagesource branch current). The first form of this analysis calculates the sensitivity of the DC operatingpoint value of OUTvar The second form calculates sensitivity of the AC values of OUTvar. The parameters listed for AC sensitivity are the same as in an AC analysis (see "".AC"" above for more details). The output values are in the dimensions of change in output per unit change of input (as opposed to percent change in output per percent change of input). 


Syntax 
.TF OUTvar inSRC 
Example 
.TF V(5, 3) VIN 
Notes 
The TF command defines the smallsignal output and input for the DC smallsignal analysis. OUTvar is the smallsignal output variable and inSRC is the smallsignal input source. If this line is included, SPICE computes the DC smallsignal value of the transfer function (output/input), input resistance and the output resistance. 


Syntax 
.TRAN Tstep Tstop <Tstart <TMAX>> 
Example 
.TRAN 1NS 100NS 
Notes 
In a Transient Analysis, Tstep is the printing or plotting increment for the lineprinter output. For use with the postprocessor, Tstep is the suggested computing increment. Tstart is the initial time (if omitted it is assumed to be zero) and Tstop is the final time. The transient analysis always begins at time zero, so in the interval <zero, Tstart> the circuit is analyzed to reach a steady state but no outputs are stored. In the interval <Tstart, Tstop> the circuit is analyzed and outputs are stored. TMAX is the maximum stepsize that SPICE uses; for default the program will choose the smaller of either Tstep or (TstopTstart)/50.0. TMAX is useful when one wishes to guarantee a computing interval which is smaller than the printer increment, Tstep. 


Syntax 
.PRINT PRtype OV1 <OV2; ... OV8> 
Example 
.PRINT TRAN V(4) I(VIN) 
Notes 
The PRINT line defines the contents of a tabular listing of one to eight output variables. PRtype is the type of analysis (DC, AC, TRAN, NOISE, or DISTO) for which the specified outputs are desired. 


Syntax 
.PLOT PLtype OV1 <(PLO1, PHI1)> <OV2; <(PLO2, PHI2)> ... OV8> 
Example 
.PLOT DC V(4) V(5) V(1) 
Notes 
The PLOT line defines the contents of one plot for one to eight output variables from the analysis defined by the PLtype parameter (DC, AC, TRAN, NOISE, or DISTO). The syntax for the OVI is identical to that for the .PRINT line and for the plot command in the interactive mode. There is no limit on the number of .PLOT lines specified for each type of analysis. 


Syntax 
.SAVE vector <...> 
Example 
.SAVE i(vin) input output 
Notes 
The vectors listed on the .SAVE line are recorded in the rawfile for later use with spice3. The standard vector names are accepted. If no .SAVE line is given then the default set of vectors are saved (node voltages and voltage source branch currents). If .SAVE lines are given, only those vectors specified are saved. 


Syntax 
.FOUR FREQ OV1 <OV2; OV3 ...> 
Example 
.FOUR 100K V(5) 
Notes 
The FOUR (or Fourier) line controls whether SPICE performs a Fourier analysis as a part of the transient analysis. FREQ is the fundamental frequency, and OV1, ..., are the output variables for which the analysis is desired. The Fourier analysis is performed over the interval <Tstopperiod;, Tstop> where Tstop is the final time specified for the transient analysis and the period is one period of the fundamental frequency. The DC component and the first nine harmonics are determined. For maximum accuracy TMAX (see the .TRAN line) should be set to period/100.0 (or less for very highQ circuits). 


Syntax 
.NODESET V(n1)=VAL V(n2)=VAL <...> 
Example 
.NODESET V(12)=4.5 V(4)=2.23 
Notes 
The NODESET line helps the program find the DC or initial transient solution by making a preliminary pass with the specified nodes held to the given voltages. The restriction is then released and the iteration continues to the true solution. The .NODESET line may be necessary for convergence on bistable or astable circuits. In general this line should not be necessary. 


Syntax 
.IC V(n1)=VAL <V(n2)=VAL> <...> 
Example 
.IC V(11)=5 V(4)=5 V(2)=2.2 
Notes 
The IC line is for setting initial transiet conditions. It has two different interpretations depending on whether the UIC parameter is specified on the .TRAN control line. One should not confuse this line with the .NODESET line. The .NODESET line is only to help DC convergence, and does not affect final bias solution (except for multistable circuits). 

