Welcome!
Dept. of Electrical & Electronics
Engineering
SREE VIDYANIKETHAN ENGINERING
COLLEGE
Sree Sainath Nagar, A.Rangampet 517 102
1
Introduction to spice
Spice is a general purpose circuit program that be
applied to simulate and calculate the performance of
electrical and electronic circuits.
Spice was developed by Berkeley in early 1970.
1970 Next is
Spice2 it is improved version of Spice. Next is spice3.
Spice can run only on mainframes.
Spice stands for Simulated Program with Integrated
Circuit Emphasis. In 1984,
1984 Microsim introduced
PSPICE.
PSPICE It is version of SPICE it can be run on any PC
or other compatible.
2
Significance
This can be used to simulate both electrical and
electronics circuit
This can be used for evaluating the effects of variations
in elements such as resistors, transformers etc.
In evaluating effects of noise and signal distortion.
To perform various analysis like sensitivity analysis
and Fourier analysis etc.
Evaluating the effects of nonlinear elements on the
circuit performance.
Optimizing the design of electronic circuit in terms of
circuits in terms of circuit parameters.
3
Limitations
The program is not interactive i.e. the circuit cannot
be analyzed for various component values with out
editing the program statements.
PSPICE does not support an iterative method of
solution.
The input impedance cannot be determined directly
with out running the graphic post processor, probe.
Distortion analysis is not available in PSPICE
The Students version of pspice is restricted to circuits
with 10 transistor only.
4
Applications of PSPICE
Electrical Networks
Electronic Networks
Power Electronics
Power Systems
5
Circuit Description
A circuit is described to a computer by using a file called
Circuit File or Input file.
file It contains the circuit details of
components and elements the information about the sources
and the commands for what to calculate and what to
provides output. After executing the commands produces
the results in another file called Output File.
File
The format of the circuit file is as follows
Title
Circuit description
Analysis description
Output description
.END
6
*simple dc circuit
Vs 10 DC 20V
Is 04 DC 50mA
R1 1 2 500
R2 2 5 800
R3 2 3 1KOHM
R4 4 0 200
Vx 3 0 DC 0V
Vy 5 4 DC 0V
.op
.END
7
Title: It is the first line of the program it may contain any text,
its nothing but a comment line which has to be started with a
asterisk(*), it can be included any where in the program.
Circuit Description: Which defines the circuit elements and set
of model parameters.
Analysis: Which defines the type of analysis such as DC, AC,
TRASIENT analysis etc.
Out Put: Which defines the way the output is to be presented.
End: Which indicates that the program is terminated. It is
written as .END.
If a PSPICE statement is more than one line, statement can be
continued in the next line. The continuation line is defined by
a(+) sign in the first column of the next line.
The Pspice statements or comments can be either in upper case
or lower case.
8
Representation of of Circuit Elements,
Sources and their Formats
DC Circuit Analysis:
The Simulation of DC circuits with passive elements
requires the modeling of Resistors, Model Parameters,
Operating Temperature, DC sources, DC Output
variables, Type of DC analysis
Resistors: The symbol for resistor is R the name of the
resistor must start with R, and it indicates the general
form of
R(name) N + N R VALUE
Ex. R1 6 5 10K
N+
R
N- 9
RNAME is the model name that defines the parameters
of the resistor. RVALUE is the the nominal value of the
resistance.
Modeling Elements: The models are necessary to take
into account the parameter variations i.e. the value of a
resistor depends on the operating temp. The general form
of model statement is
.MODEL MNAME TYPE
(P1 = A1,P2 = A2, . PN = AN)
MNAME is the name of the model that must start with a
letter P1, P2. are the element parameters and A1,A2 .
are their values. TYPE is the type name of the elements.
For example the resistor must have a type name RES
Ex. .MODEL RMOD RES (R = 1.1, TCE = 0.001)
10
List of Type Names of Elements
Element Type Name
Resistor RES
Capacitor CAP
Inductor IND
Diode D
NPN Transistor NPN
PNP Transistor PNP
Voltage Controlled VSWITCH
Switch
Current Controlled ISWITCH
Switch
11
OPERATING TEMPERATURE: The operating temperature of
an analysis can be set to any desired value by.TEMP
command. The general form of the statement is
.TEMP < (one or more temperature) values>
Ex: .TEMP 0 25 50 100
Independent DC Sources:
Independent DC Voltage source:
The symbol for an independent voltage source is V and the
general form is
12
V <name> N+ N- [DC (value)]
N+
+
V <NAME>
-
Ex: V1 15 0 DC 6V
13
Independent DC current source:
The symbol for an independent current source is I,
and general form is I<name> N+ N- [DC(value)]
Ex: I1 15 0 DC 6A
N+
+
I<NAME>
-
N-
14
Dependent sources:
Voltage controlled voltage source:
The symbol of voltage controlled voltage source is E, the
general form of linear representation is
NC + I N+
1
+ V out = E V
V1 1
-
NC - N-
E (name) N+ N- NC + NC <(voltage gain) value>
E12 1 2 4 6 1
15
N+ and N- are the +ve & -ve output nodes
NC + & NC are the +ve & - ve nodes of the
controlled voltage
Source can have either fixed value or a polynomial
expression.
The non linear or polynomial form of representation
is
E(name) N + N - [POLY (<value>)] << (+
Controlling) node> + <(-controlling node)>>
(pairs) < polynomial coefficients)>]
Ex:- E10 25 40 poly(2) 3 0 5 0 0.0 1.0 1 5
16
Voltage Controlled Current Source:-
The symbol of a voltage controlled current source G its linear
form is G <name> N+ N- NC+ NC-
<(transconductance)value>
The nonlinear form is G<name> N+ N- [POLY (<value>) <<
(+Controlling)node>]
Ex:- G12 25 40 poly(2) 3 0 5 0 0.0 1.0 1.5 1.2 1.7
NC+ N+
I1
V1 + I out = GV
1
-
NC - N-
17
Current Controlled Current Source:-
The symbol of current controlled current source is F and
its linear form is
F<name> N+ N - NC+ NC- VN <(current gain> value>
The nonlinear form is
F<name> N+ N- [POLY(<value>) VN1, VN2, VN3..+
<(polynomial coefficients) Values>]
Ex: FNONLIN 25 40 POLY VN 0.0 1.0 1.5 1.2
1.7
NC+ N+
I1
+ I out = FV
V1 1
-
NC - N-
18
DC Output Variables:
PSPICE has some unique features for
printing or plotting output voltages or
currents. The output voltages and
currents can be obtained by the
following statements
19
V(<node>) Voltage <node> with respect to
ground
V(5) Voltage at node 5 with respect to ground
V(N1,N2) Voltage at node N1 with respect to
node N2.
V(<name>) Voltage across two terminal
device, <name>
V (R1) Voltage across Resistor R1
Vx(<name>) Voltage at terminal x of three
terminal
20
Device, <name>
VC(Q3) Voltage at the collector of transistor
Q3 with respect to ground
Vxy (<name>) Voltage across terminals x & y
of three terminal device,<name>
VDS(M6) Drain-source voltage of MOSFET M6
I(<name>) Current through name
I(VS) Current flowing into DC source VS
Ix(<name>) Current into terminal x of
<name>
I(R5) Current flowing into resistor R5
21
Types of Output:
.PRINT The results form DC analysis can be obtained
in the form of tables. The print statement DC outputs
takes the form .PRNT DC [output variables]
Ex: .PRNT DC V(2), V(3,5), V(R1),I(VIN), I(R1)
.PLOT This command is used to get the results in the
form plots. The plot statement for DC outputs takes the
following form
.PROBE Probe is a graphics post-processor/wave form
analyzer for Pspice. The form of the probe statement
is .PROBE <one or more output variables>
Ex: .PROBE V(5), V(4,5), V(C1), I(R2)
22
TYPES OF DC ANALYSIS
The commands that are commonly used for
DC analysis are
.OP DC operating point.
By using this we can force Pspice to show the
node voltages, and also prints the currents &
power dissipations of all the voltage sorces.
.TF Small signal transfer function using
this we can compute the small-signal DC gain
the Input resistance, & the Output resistance
of a circuit.
.TF Vout VIN Vout
Av(gain) = Vin
.TF Calculates the parameters of thevenins or
nortons equivalent circuit for the circuit file.
23
.DC Sweep
.DC DC sweep
DC sweep is also known as the DC
transfer characteristic.The input variable
is varied over a range of values. General
form is
.DC LIN SWNAME SSTART SEND SINC
.DC LIN IS 50 MA -50 MA 1MA
.DC LIN IS 2 10 4
24
TRANSIENT ANLYSIS
Transient analysis deals with the behavior
of an electric circuit as a function of time.
MODELLING OF TRANSIENT SOURSES
Pspice allows the generation of dependent
or independent voltage and current
sources. Independent sources can be time
variant. A nonlinear source can also be
simulated by polynomial. The independent
voltage and current sources that can be
modeled by Pspice as follows:
25
1. Exponential source:
The symbol of exponential sources is EXP, and general
form is
EXP (V1 V2 TRD TRC TFD TFC)
NAME MEANING UNITS DEFAULT
V1 Initial voltage volts None
V2 Pulsed voltage volts None
TRD Rise delay time secs Zero
TRC Rise time constant secs TSTEP
TFD Fall delay time secs TRD + TSTEP
TFC Fall time constant secs TSTEP
26
V2
TFC
TRC
V1
TRDC TFD
Ex: EXP 0 1 2NS 20NS 60NS 30NS
27
PULSE SOURCE:
The symbol of a pulse source is PULSE and
general form is
PULSE (V1 V2 TD TR TF PW PER)
V1 and V2 must be specified by the user and
can be either voltages or currents. TSTEP
and TSTOP are the incrementing time and
stop time, respectively during transient
analysis.
Ex. PULSE 0 -1 2NS 2NS 2NS 50 NS 100NS
28
V
V2
V1
C
0 TD TR PW TF
PER
29
Name Meaning Units Default
V1 Initial voltage Volts None
V2 Pulsed voltage Volts None
TD Delay time Seconds 0
TR Rise time Seconds TSTEP
TF Fall Time Seconds TSTEP
PW Pulse width Seconds TSTOP
PER Period Seconds TSTOP
30
SINUSOIDAL SOURCE:
The symbol of a sinusoidal source is SIN,
and the general form is
SIN (VO VA FREQ TD ALP THETA)
Va
V0
0
Td t
31
The model parameters of the SIN
waveform are given below:
Name Meaning Units Default
V0 Offset voltage Volts None
VA Peak Voltage Volts None
FREQ Frequency Hertz 1/TSTOP
TD Delay time Seconds 0
ALPHA Damping factor 1/Seconds 0
THETA Phase delay Degrees 0
32
Vo and VA must be specified by the user and
can be either voltages or currents. TSTOP is
the stop time during transient analysis.
Ex: SIN (1 5V 10KHz 10 US 30 DEG)
Transient Sources:
Transient sources are time variant and can be
either independent or dependent. They can be
voltages or currents. The general form of
independent voltage source is
V<name> N+ N- [DC <value>] [(transient
value) [PULSE] [SIN] + [EXP] [source
arguments]]
33
The general form of independent current
source is N+ is +ve node, N- is ve ; for the
DC and transient values, the default value is
zero.
Ex:- V1 10 0
PULSE (0 1 2NS 2NS 2NS 2NS 50NS 100NS)
V1N 12 3 DC 15v SIN (0 2V 10 KHz)
I<name>N+ N- [DC >value>] [(transient
value) [PULSE] [SIN] + [EXP] [source
arguments)}
34
Transient Output variables:
The output commands are similar to that of
DC. The .PRNT, .PLOT and .PROBE
statement for transient outputs are
.PRNT TRAN <output variables>
.PLOT TRAN <output variables>
[<(lower limit) value>,<(upper limit)value>
.PROBE
The determination of the transient analysis
requires the following statements
.IC (Initial transient conditions):
35
The various nodes can be assigned to initial
voltages during transient analysis. The
general form for assigning initial values is
.IC V(1)=A1 V(2) = A2.. V(N) = AN
where A1,A2,A3,. AN are initial values for
node voltage V(1), V(2). respectively.
These initial values are used by pspice to
calculate the transient analysis bias point
and the linearized parameters of nonlinear
devices for transient analysis.
36
.TRAN (Transient analysis): Transient analysis
can be performed by the .TRAN command, which
has the following general form
.TRAN TSTEP TSTOP [TSTART TMAX] [UIC]
TSTEP is the printing increment, TSTOP is the
final time or stop time and TMAX is the maximum
size of internal time step. If UIC is specified the
initial values of capacitors and inductors must be
supplied. TRAN statement requires a .PRINT.,
.PLOT or .PROBE statement to get the result of the
transient analysis.
37
AC CIRCUIT ANALYSIS:
Sources in AC circuit are time variant. They are alternating
current or voltage having both magnitude and phase
displacement.
AC analysis, the output variables are sinusoidal quantities and
are represented by complex numbers. An output variable can
have magnitude in decibels, phase, real part and imaginary
part.
The statements for AC analysis are similar to that of DC and
Transient Analysis. Provided the suffixes are added as follows
VM(5) Magnitude of voltage at node 5 with respect to
ground
VR(2,3) Real part of voltage at node 2 with respect to node 3
VI (2,3) Imaginary part of voltage at node 2 with respect to
node 3
38
Independent AC Sources
The statement for a voltage and current
source have the following general forms
respectively
V <name> N+ N- [AC<(magnitude)
value>, <(phase) value]
I <name> N+ N- [AC
<(magnitude)value>, <(phase)value]
Magnitude is the peak value of the sinusoidal
voltage. Phase is in degrees
Ex: VA 5 6 AC IV 45DEG
39
Commands for performing frequency
response
.AC LIN NP FSTART FSTOP
.AC OCT NP FSTART FSTOP
.AC DEC NP FSTART FSTOP
Ex:- .AC LIN 60Hz 120Hz
Where NP is the no: of points in a frequency sweep
FSTART Starting frequency
FSTOP Ending frequency
LIN Linear sweep
OCT Sweep by octave, it is used if the
frequency range is wide
DEC Sweep by decade, it is used if the
frequency range is widest
The results of AC sweep are obtained by .PRNT ,
.PLOT, . PROBE statements
40
Switches
Pspice allows the simulation of switch whose
resistance is depending on voltage and
current. When the switch is on the
resistance is Ron when switch is off
resistance becomes Roff.
Two types of switches are
1. Voltage controlled switch
2. Current Controlled switch
41
1. Voltage Controlled Switch
The symbol for voltage control switch is S.
The general form is
S(name) N+ N- NC+ NC- SNAME
N + and N- are the nodes of the switch.
NC+ and NC- are the nodes of the controlling
voltage source. SNAME is the Model name.
The resistance of the switch varies
depending on the voltage across the switch.
The type name is VSWITCH
NC+ N+
R S1
NC- N- 42
The Model parameters for voltage controlled
switch are
Name Meaning Units Defaults
VON Control voltage for on-state Volts 1.0
VOFF Control voltage for off-state Volts 0
RON On resistance Ohms 1.0
ROFF Off resistance Ohms 106
Ex. S1 6 5 4 0 SMOD
.MODEL SMOD VSWITCH (RON = 0.5 ROFF = 10E+6 VON = 0.7 VOFF = 0)
43
Device Modelling
.MODEL
The .MODEL statement defines a set of device
parameters for a specific device, which can be
referenced in the circuit.
.SUBCKT
The .SUBCKT statement begins the definition of a
sub circuit. Suppose example, for simulating a circuit
which contained 3 op-amps, each op-amp containing
15compnents. Instead of listing the 15 components at
each point it was necessary to specify the op-amp,
you can list the op-amp once, in a subcicuit, and call
that subcicuit up 3 times.
.ENDS Marks the END of a subcircuit
44
Suffixes
f femto 10-15
p pico 10-12
n nano 10-9
u micro 10-6
m milli 10-3
k kilo 103
meg mega 106
g giga 109
t tera 1012
45
DIODE Parameters
Parameter Description Default value
IS Saturation Current 10-14A
CJO Junction capacitance at VD = 0 0
VJ Reverse-breakdown voltage 1V
BV Reverse-breakdown voltage infinite
IBV Current at VD = BV 10-10A
RS Series Ohmic resistance 0
N Emission coefficient (ideality factor) 1
46
47
48
49
I
*Single phase full converter
Vs 10 0 SIN(0 169.7 60Hz)
VG1 6 2 PULSE(0 10 2777.8us
1ns 1ns 100u 16666.7u)
VG2 7 0 PULSE(0 10 2777.8us
1ns 1ns 100u 16666.7u)
VG3 8 2 PULSE(0 10 11111.1us
1ns 1ns 100u 16666.7u)
VG4 9 1 PULSE(0 10 11111.1us
1ns 1ns 100u 16666.7u)
R 2 4 10
L 4 5 20mh
RX 11 3 0.1
VX 5 3 DC 10
VY 10 1 DC 0
XT1 1 2 6 2 SCR
XT2 3 0 7 0 SCR
XT3 0 2 8 2 SCR
XT4 3 1 9 1 SCR
*subckt for SCR
50
. SUBCKT SCR 1 2 3 2
S1 1 5 6 2 SMOD
RG 3 4 50
VX 4 2 DC 0
VY 5 7 DC 0
DT 7 2 DMOD
RT 6 2 1
CT 6 2 10u
F1 2 6 POLY(2) VX VY 0 50 11
.MODEL SMOD VSWITCH(RON=0.0175 ROFF=10e5
VON=0.5v VIFF=0)
.MODEL DMOD D(IS=2.2E-15 BV=1800v TT=0)
.ENDS SCR
.TRAN 10us 35ms 10ms
.Probe
.PRINT TRAN V(2,3) I(Vx)
.OPTIONS ABSTOL=1.00u RELTOL=1.0M
VNTOL=0.1 ITL5=10000
.END
51
2.
*single phase Voltage Controller with RLE
loads
vs 1 0 sin(0 169.760)
VG1 2 4 PULSE(0 10 4166.7U 1N 1N 100U
16.6667M)
VG2 3 1 PULSE(0 10 12500U 1N 1N
100U 16.6667M)
VX 6 0 DC 10
R 4 5 2.5
L 5 6 6.5M
CS 1 7 0.1U
RS 7 4 750
XT1 1 4 2 4 SCR
XT2 4 1 3 1 SCR
**SUB CIRCUIT FOR SCR**
.SUBCKT SCR 1 2 3 2
S1 1 5 6 2 SMOD
RG 3 4 50
VX 4 2 DC 0 52
RT 6 2 1
CT 6 2 10U
F1 2 6 POLY(2) VX VY 0 50 11
.MODEL SMOD VSWITCH(RON=0.01
RIFF=10E+5 VON=0.1 VoFF=0)
.ENDS SCR
.TRAN 10U 33.4MS
.PL0T TRAN V(2,3) I(R)
.PRINT TRAN V(2,3) I(R)
.PROBE
.OPTIONS ABSTOL=1.00N RELTOL=1.0M
VNTOL=1.0M T\ITL5=10000
.END
53
3.
*RESONANT PULSE COMMUTATION
VS 1 0 DC 200V
VG1 7 0 PULSE(0 100 0 1U 1U 0.4M 1M)
VG2 8 0 PULSE(0 100 0.4m 1U 1U 0.6M 1M)
VG3 9 0 PULSE(0 100 0 1U 1U 0.2M 1M)
RG1 7 0 10MEG
RG2 8 0 10MEG
RG3 9 0 10MEG
CS 1 11 0.1UF
RS 11 4 750
C 1 2 31.2UF
L 2 3 6.4UH
D1 4 1 DMOD
DM 0 4 DMOD
.MODEL DMOD D(IS=1E-25 BV =1000V)
RM 4 5 0.5
LM 5 6 5MH
VX 6 0 DC OV
XT1 10 4 7 0 DCSCR
XT2 3 4 8 0 DCSCR
XT3 1 3 9 0 DCSCR 54
** SUBCKT FOR DC SCR
.SUBCKT DCSCR 1 2 3 4
DT 5 2 DMOD
ST 1 5 3 4 SMOD
.MODEL DMOD D(IS=IE-25 BV=1000)
.MODEL SMOD VSWITCH(RON=0.1
ROFF=10E+6 VON=10V VOFF=5V)
.ENDS DCSCR
.TRAN 1M 6MS OM 1M
.PRINT TRAN I(VX) V(1,2) I(C)
.PROBE
.OPTIONS ABSTORL=1.000U RELTOL=0.01
VNTOL=0.1 ITL5=20000
.END
55
4.
*Analysis of Buck Chopper
VS 1 0 DC 110V
VY 1 2 DC 0V
VX 5 0 DC OV
VG 7 3 PULSE(0 20 0 0.1NS 0.1NS
27.28US 50US)
RB 7 6 250
LE 3 4 681.82UH
CE 4 0 8.33UF
L 4 8 40.91UH
R 8 5 3
DM 0 3 DMOD
56
.MODEL DMOD D(IS=2.2E-15 BV=1800V TT=0)
A1 2 6 3 QMOD
.MODEL QMOD NPN(IS=6.734F BF=416.4
BR=0.7371 CJC=3.638P CJE=4.493P
+TR=239.5N TF=301.2P)
.TRAN 1US 1.6MS 1.5MS
.PROBE
.OPTIONS ABSTOL=1.00N RETOL=0.01
VNTOL=0.1 ITL5=50000
.PRINT TRAN V(4) I(VX)
.END
57
5.
*Simulation of 1-phase inverter with PWM control
vs 1 0 dc 100
vr 17 0 pulse(50 0 0 833.33us 833.33us 1ns
1666.67us)
vc1 15 0 pulse(0 -30 0 1ns 1ns 833.33us
16666.67us)
vc2 16 0 pulse(0 -30 8333.33us 1ns 1ns
8333.33us 16666.67us)
rc1 15 0 2meg
rc2 16 0 2meg
rc3 17 0 2meg
r 4 6 2.5
vx 3 4 dc 0v
vy 1 2 dc 0v
d1 3 2 dmod
d2 0 6 dmod
d3 6 2 dmod
d4 0 3 dmod
58
.model dmod d(is=2.2e-15 bv=1800
tt=0)
rgl 8 7 100
rg2 10 9 100
rg3 12 11 100
rg4 14 13 100
xpw1 17 15 8 3 pwm
xpw2 17 15 10 0 pwm
xpw3 17 16 12 6 pwm
xpw4 17 16 14 0 pwm
.subckt pwm 1 2 3 4
r1 1 5 1k
r2 2 5 1k
rin 5 0 2meg
rf 5 3 100k
r0 6 3 75
c0 3 4 10pf
e1 6 4 0 5 2e5
59
.ends pwm
q1 2 7 3 qmod
q2 6 9 0 qmod
q3 2 11 6 qmod
q4 3 13 0 qmod
.model qmod npn(is=6.734uf bf=416.4
cjc=3.638p cje=4.493p)
.tran 10us 35ms 0 10us
.probe
.print abstol=1n reltol=0.01 vntol=0.1
itl5=20000
.print tran v(3,6) i(vx)
.end
60
61
62
63