Here is some information about using SPICE, and especially PSPICE (formerly distributed by OrCAD and Microsim), collected from various sources. You can still find copies of the student (evaluation) version of PSPICE on the internet. Other freely available implementations of SPICE can also be found
Many of you will have been introduced to SPICE in your circuits or electronics text, or possibly from the book SPICE: A Guide to Circuit Simulation and Analysis Using PSpice (Third Edition, 1995) by P. W. Tuinenga. Be aware that these sources only give the very basics of SPICE syntax, especially regarding transmission lines and controlled sources. For a complete description of all forms of SPICE statements supported by any given implementation of SPICE, see the complete reference, which is generally included with the software. We present here some less familiar element statements that are particularly relevant to our needs. You should examine the complete reference for questions about SPICE syntax and usage that are not addressed here. Note in particular that some implementations of SPICE offer nonstandard features such as behavioral modeling for the use of which the specific software documentation must be consulted. Features such as these referred to below are those of PSPICE.
The following provides the command syntax formats. < > indicates a required item in a command line. For example, <model name> in a command line means that the model name parameter is required. < >* indicates that the item shown in italics must occur one or more times in the command line. [ ] indicates an optional item. [ ]* indicates that there is zero or more occurrences of the specified subject. < | > means that you must specify one of the given choices. [ | ] means that you may specify zero or one of the given choices. The symbol + at the beginning of a line indicates a continuation of a statement from the previous line.
Transmission Lines
An ideal (lossless) transmission line is characterized by two ports (terminal pairs) which can be thought of as the input and output sides of the transmission line section. Port A's (+) and (-) nodes are 1 and 2, and port B's (+) and (-) nodes are 3 and 4, respectively. The element statement has several variants:
T<name> <A port (+) node> <A port (-) node>
+ <B port (+) node> <B port (-) node>
+ [model name]
+ Z0=<value> [TD=<value>] [F=<value> [NL=<value>]]
+ IC= <near voltage> <near current> <far voltage> <far
current>
Comments:
For the ideal line, IC sets the initial guess for the voltage or current across the ports. The <near voltage> value is the voltage across A(+) and A(-) and the <far voltage> is the voltage across B(+) and B(-) . The <near current> is the current through A(+) and A(-) and the <far current> is the current through B(+) and B(-) . For the ideal case, Z0 is the characteristic impedance. The transmission lines length can be specified either by TD , a delay in seconds, or by F and NL , a frequency and a relative wavelength at F . NL has a default value of 0.25 ( F is the quarter-wave frequency). Although TD and F are both shown as optional, one of the two must be specified. Both Z0 (Z-zero) and ZO (Z-O) are accepted by the simulator.
If you are using Tuinenga's SPICE book for information about the transmission
line element statement in your SPICE files, beware of the following inaccuracies
on p. 269:
1) The meaning of the parameter NL in the ideal
transmission line element statement is not "wavelength" as
stated, or even "relative wavelength", but the relative length of the transmission
line section in wavelengths. Thus, a section of line whose
length is 0.4l
would have NL=0.4.
2) Two of the examples he gives use frequencies
such as F=2.25MHz. Note that, according to the conventions of SPICE, this
would mean 2.25 millihertz, not 2.25 megahertz!
Note that the nodes of the A port and those of the B port are considered to be floating with respect to each other, unless an external circuit connection is provided. In normal practice, this means that you should generally connect each of the (-) port terminals to ground in order to get SPICE to run without errors.
Voltage-controlled sources
The voltage-controlled voltage source (E) and the voltage-controlled current source (G) devices have the same syntax. For a voltage-controlled current source just substitute G for E. G generates a current, whereas E generates a voltage. There are seven variants of the element statement for this source:
E<name> <(+) node> <(-) node>
+ <(+) controlling node> <(-) controlling node> <gain>
E<name> <(+) node> <(-) node> POLY(<value>)
+ < <(+) controlling node> <(-) controlling node> >*
+ < <polynomial coefficient value> >*
E<name> <(+) <node> <(-) node> VALUE = { <expression> }
E<name> <(+) <node> <(-) node> TABLE { <expression> }
=
+ < <input value>,<output value> >*
E<name> <(+) node> <(-) node> LAPLACE { <expression> } =
+ { <transform> }
E<name> <(+) node> <(-) node> FREQ { <expression> } = [KEYWORD]
+ < <frequency value>,<magnitude value>,<phase value> >*
+ [DELAY = <delay value>]
E<name> <(+) node> <(-) node> CHEBYSHEV { <expression> }
=
+ <[LP] [HP] [BP] [BR]>,<cutoff frequencies>*,<attenuation>*
Keywords:
POLY(<value>)
Specifies the number of dimensions of the polynomial. The number of
pairs of controlling nodes must be equal to the number of dimensions.
(+) and (-) nodes
Output nodes. Positive current flows from the (+) node through the
source to the (-) node.
The <(+) controlling node> and <(-) controlling node>
are in pairs and define a set of controlling voltages. A particular
node can appear more than once, and the output and controlling nodes need
not be different. The TABLE form has a maximum size of 2048 input/output
value pairs.
FREQ
If a DELAY value is specified, the simulator modifies the phases in
the FREQ table to incorporate
the specified delay value. This is useful for cases of tables which
the simulator identifies as being noncausal.
When this occurs, the simulator provides a delay value necessary to
make the table causal. The
new syntax allows this value to be specified in subsequent simulation
runs, without requiring the user
to modify the table. If a KEYWORD is specified for FREQ tables, it
alters the values in the table. The
KEYWORD can be one of the following:
EBUFF 1 2 10 11 1.0
EAMP 13 0 POLY(1) 26 0 0 500
ENONLIN 100 101 POLY(2) 3 0 4 0 0.0 13.6 0.2 0.005
ESQROOT 5 0 VALUE = {5V*SQRT(V(3,2))}
ET2 2 0 TABLE {V(ANODE,CATHODE)} = (0,0) (30,1)
ERC 5 0 LAPLACE {V(10)} = {1/(1+.001*s)}
ELOWPASS 5 0 FREQ {V(10)}=(0,0,0)(5kHz, 0,0)(6kHz -60, 0) DELAY=3.2ms
ELOWPASS 5 0 CHEBYSHEV {V(10)} = LP 800 1.2K .1dB 50dB
GBUFF 1 2 10 11 1.0
GAMP 13 0 POLY(1) 26 0 0 500
GNONLIN 100 101 POLY(2) 3 0 4 0 0.0 13.6 0.2 0.005
GPSK 11 6 VALUE = {5MA*SIN(6.28*10kHz*TIME+V(3))}
GT ANODE CATHODE VALUE = {200E-6*PWR(V(1)*V(2),1.5)}
GLOSSY 5 0 LAPLACE {V(10)} = {exp(-sqrt(C*s*(R+L*s)))}
Comments:
The first form and the first two examples apply to the linear case; the second form and the third example are for the nonlinear case. The last five forms and examples are analog behavioral modeling (ABM) that have expression, look up table, Laplace transform, frequency response, and filtering. Refer to your PSPICE users guide for more information on analog behavioral modeling.
Chebyshev filters have two attenuation values, given in dB, which specify the pass band ripple and the stop band attenuation. They can be given in either order, but must appear after all of the cutoff frequencies have been given. Low pass (LP) and high pass (HP) have two cutoff frequencies, specifying the pass band and stop band edges, while band pass (BP) and band reject (BR) Ølters have four. Again, these can be given in any order.
You can get a list of the filter Laplace coefficients for each stage by enabling the LIST option in the Simulation Settings dialog box. (Click the Options tab, then select the Output file Category and select Device Summary.) The output is written to the .out file after the simulation is complete.
For the linear case, there are two controlling nodes and these are followed by the gain. For all cases, including the nonlinear case (POLY), refer to your PSPICE users guide.
Expressions cannot be used for linear and polynomial coefficient values in a voltage-controlled voltage source device statement.
Current-controlled sources
The Current-Controlled Current Source (F) and the Current-Controlled Voltage Source (H) devices have the same syntax as do the voltage-controlled sources. For a Current-Controlled Voltage Source just substitute an H for the F. The H device generates a voltage, whereas the F device generates a current. There are two variants of these statements:
F<name> <(+) node> <(-) node>
+ <controlling V device name> <gain>
F<name> <(+) node> <(-) node> POLY(<value>)
+ <controlling V device name>*
+ < <polynomial coefficient value> >*
Arguments and options:
(+) and (-)
Output nodes. A positive current flows from the (+) node through the
source to the (-) node. The current through the controlling voltage source
determines the output
current. The controlling source must be an independent voltage source
(V device), although it need not have a zero DC value.
POLY(<value>)
Specifies the number of dimensions of the polynomial. The number of
controlling voltage sources must be equal to the number of dimensions.
Examples:
FSENSE 1 2 VSENSE 10.0
FAMP 13 0 POLY(1) VIN 0 500
FNONLIN 100 101 POLY(2) VCNTRL1 VCINTRL2 0.0 13.6 0.2 0.005
Comments:
The first general form and the first two examples apply to the linear case. The second form and the last example are for the nonlinear case. For the linear case, there must be one controlling voltage source and its name is followed by the gain. For all cases, including the nonlinear case (POLY), refer to your PSPICE users guide. In a current-controlled current source device statement, expressions (such as in the VALUE keyword version of a voltage-controlled source statement) cannot be used for linear and polynomial coefficient values.
OrCAD Probe tip: Displaying s-parameter data in the Probe window