The National Instrument 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 includes several different types of electrical components that can be simulated. These range from simple resistors, to sophisticated MESFETs. The table below lists these components and their SPICE syntax.
Parameters in angular parentheses <> are optional. If left unspecified, the default SPICE parameter values will be used.
Syntax 
Rname n1 n2 value 
Example 
Rin 2 0 100 
Notes 
n1 and n2 are the two element nodes. Value is the resistance (in ohms) and may be positive or negative but not zero. 


Syntax 
Rname n1 n2 <value> <Mname> <L=Length> <W=Width> <Temp=T> 
Example 
Rload 3 7 RMODEL L=10u W=1u 
Notes 
This is the more general form of the resistor and allows the modeling of temperature effects and for the calculation of the actual resistance value from strictly geometric information and the specifications of the process. 


Syntax 
Cname n+ n value <IC=INCOND> 
Example 
Cout 13 0 1UF IC=3V 
Notes 
n+ and n are the positive and negative element nodes, respectively. Value is the capacitance in Farads. The (optional) initial condition is the initial (timezero) value of capacitor voltage (in Volts). 


Syntax 
Cname n1 n2 <value> <Mname> <L=Length> <W=Width> <IC=VAL> 
Example 
Cfilter 3 7 CMODEL L=10u W=1u 
Notes 
This is the more general form of the Capacitor and allows for the calculation of the actual capacitance value from strictly geometric information and the specifications of the process. 


Syntax 
Lname n+ n value <IC=INCOND> 
Example 
LSHUNT 23 51 10U IC=15.7MA 
Notes 
n+ and n are the positive and negative element nodes, respectively. Value is the inductance in Henries. The (optional) initial condition is the initial (timezero) value of inductor current (in Amps) that flows from n+, through the inductor, to n. 


Syntax 
Kname Lname1 Lname2 value 
Example 
Kin L1 L2 0.87 
Notes 
Lname1 and Lname2 are the names of the two coupled inductors, and VALUE is the coefficient of coupling, K, which must be greater than 0 and less than or equal to 1. 


Syntax 
Sname n+ n nc+ nc Mname <ON><OFF> 
Examples 
Switch1 1 2 10 0 smodel1 
Notes 
Nodes n+ and n are the nodes between which the switch terminals are connected. The model name is mandatory while the initial conditions are optional. For the voltage controlled switch, nodes nc+ and nc are the positive and negative controlling nodes respectively. For the current controlled switch, the controlling current is that through the specified voltage source. The direction of positive controlling current flow is from the positive node, through the source, to the negative node. 


Syntax 
Vname n+ n <DC<> DC/TRAN VALUE> <AC <ACMAG <ACPHASE>>> <DISTOF1 <F1MAG <F1PHASE>>> <DISTOF2 <F2MAG <F2PHASE>>> 
Examples 
VCC 10 0 DC 6 
Notes 
n+ and n are the positive and negative nodes, respectively. Note that voltage sources need not be grounded. Positive current is assumed to flow from the positive node, through the source, to the negative node. A current source of positive value forces current to flow out of the n+ node, through the source, and into the n node. Voltage sources, in addition to being used for circuit excitation, are the 'ammeters' for SPICE, that is, zero valued voltage sources may be inserted into the circuit for the purpose of measuring current. They of course have no effect on circuit operation since they represent shortcircuits. DC/TRAN is the dc and transient analysis value of the source. If the source value is zero both for dc and transient analyses, this value may be omitted. If the source value is timeinvariant (e.g., a power supply), then the value may optionally be preceded by the letters DC. 


Syntax 
Iname n+ n <<DC> DC/TRAN VALUE> <AC <ACMAG <ACPHASE>>> <DISTOF1 <F1MAG <F1PHASE>>> <DISTOF2 <F2MAG <F2PHASE>>> 
Examples 
Igain 12 15 DC 1 
Notes 
ACMAG is the ac magnitude and ACPHASE is the ac phase. The source is set to this value in the ac analysis. If ACMAG is omitted following the keyword AC, a value of unity is assumed. If ACPHASE is omitted, a value of zero is assumed. If the source is not an ac smallsignal input, the keyword AC and the ac values are omitted. DISTOF1 and DISTOF2 are the keywords that specify that the independent source has distortion inputs at the frequencies F1 and F2 respectively (see the description of the .DISTO control line). The keywords may be followed by an optional magnitude and phase. The default values of the magnitude and phase are 1.0 and 0.0 respectively. 
Syntax 
Gname n+ n nc+ nc value 
Example 
G1 2 0 5 0 0.1MMHO 
Notes 
n+ andn are the positive and negative nodes, respectively. Current flow is from the positive node, through the source, to the negative node. nc+ and nc are the positive and negative controlling nodes, respectively. VALUE is the transconductance (in mhos). 


Syntax 
Ename n+ n nc+ nc value 
Example 
E1 2 3 14 1 2.0 
Notes 
n+ is the positive node, and n is the negative node. nc+ and nc are the positive and negative controlling nodes, respectively. Value is the voltage gain. 


Syntax 
Fname n+ n Vname value 
Example 
F1 13 5 Vsen 5 
Notes 
n+ andn are the positive and negative nodes, respectively. Current flow is from the positive node, through the source, to the negative node. Vname is the name of a voltage source through which the controlling current flows. The direction of positive controlling current flow is from the positive node, through the source, to the negative node of Vname. Value is the current gain. 


Syntax 
Hname n+ n Vname value 
Example 
Hx1 5 17 Vz 0.5K 
Notes 
n+ and n are the positive and negative nodes, respectively. Vnameis the name of a voltage source through which the controlling current flows. The direction of positive controlling current flow is from the positive node, through the source, to the negative node of Vname. Value is the transresistance (in ohms). 


Syntax 
Bname n+ n <I=EXPR> <V=EXPR> 
Example 
B1 0 1 I=cos(v(1))+sin(v(2)) 
Notes 
n+ is the positive node, and n is the negative node. The values of the V and I parameters determine the voltages and currents across and through the device, respectively. If I is given then the device is a current source, and if V is given the device is a voltage source. One and only one of these parameters must be given. The smallsignal AC behavior of the nonlinear source is a linear dependent source (or sources) with a proportionality constant equal to the derivative (or derivatives) of the source at the DC operating point. 


Syntax 
Oname n1 n2 n3 n4 Mname 
Example 
O23 1 0 2 0 LOSSYMOD 
Notes 
This is a twoport convolution model for singleconductor lossy transmission lines. n1 and n2 are the nodes at port 1; n3 and n4 are the nodes at port 2. Note that a lossy transmission line with zero loss may be more accurate than than the lossless transmission line due to implementation details. 


Syntax 
Uname n1 n2 n3 Mname L=LEN <N=LUMPS> 
Example 
U1 1 2 0 URCMOD L=50U 
Notes 
n1 and n2 are the two element nodes the RC line connects, while n3 is the node to which the capacitances are connected. Mname is the model name, LEN is the length of the RC line in meters. Lumps, if specified, is the number of lumped segments to use in modeling the RC line (see the model description for the action taken if this parameter is omitted). 


Syntax 
Dname n+ n Mname <Area> <OFF> <IC=VD> <TEMP=T> 
Example 
Dfwd 3 7 DMOD 3.0 IC=0.2 
Notes 
n+ and n are the positive and negative nodes, respectively. Mname is the model name, Area is the area factor, and OFF indicates an (optional) starting condition on the device for dc analysis. 


Syntax 
Qname nC nB nE <nS> Mname <AREA> <OFF> <IC=VBE, VCE> <TEMP=T> 
Example 
Q23 10 24 13 QMOD IC=0.6, 5.0 
Notes 
nC, nB, andnE are the collector, base, and emitter nodes, respectively. nS is the (optional) substrate node. If unspecified, ground is used. Mname is the model name, Area is the area factor, and OFF indicates an (optional) initial condition on the device for the dc analysis. 


Syntax 
Jname nD nG nS Mname <Area> <OFF> <IC=VDS, VGS> <TEMP=T> 
Example 
J1 7 2 3 JM1 OFF 
Notes 
nD, nG, and nS are the drain, gate, and source nodes, respectively. Mname is the model name, Area is the area factor, and OFF indicates an (optional) initial condition on the device for dc analysis. 


Syntax 
Mname ND NG NS NB MNAME <L=VAL> <W=VAL> <AD=VAL> <AS=VAL> <PD=VAL> <PS=VAL> <NRD=VAL> <NRS=VAL> <OFF> <IC=VDS, VGS, VBS> <TEMP=T> 
Example 
M31 2 17 6 10 Mname L=5U W=2U 
Notes 
nD, nG, nS, and nB are the drain, gate, source, and bulk (substrate) nodes, respectively. Mname is the model name. L and W are the channel length and width, in meters. AD and AS are the areas of the drain and source diffusions, in 2 meters . Note that the suffix U specifies microns (1e6 m) 2 and P sqmicrons (1e12 m ). If any of L, W, AD, or AS are not specified, default values are used. 


Syntax 
Zname nD nG nS Mname <Area> <OFF> <IC=VDS, VGS> 
Example 
Z1 7 2 3 ZM1 OFF 
Notes 
nD, nG, andnS are the drain, gate, and source nodes, respectively. Mname is the model name, Area is the area factor, and OFF indicates an (optional) initial condition on the device for dc analysis. 

