You are on page 1of 48

PSPICE

Introduction
• What’s Spice?
– SPICE  Simulation Program with Integrated Circuit
Emphasis
– SPICE contains models for common circuit elements, active
as well as passive.

• Why Spice?
– SPICE can provide information about circuit performance that
is almost impossible to obtain with laboratory prototype
measurements.
ORCAD PSPICE
Using PSPICE the user can do three types of
processes
Capture

Layout

PSPICE A/D
Types of files in PSPICE A/D
File Type Description
.cir The basic input file for PSPICE
.out The output file generated.
Contains Output data and errors
.dat If too much data is produced (e.g. transient
analysis) then this can be made as the output
file and handled by the “probe”
.inc include files, to store frequently used subcircuits
not added to the library
.lib library files
Specifying a Circuit File
 It has three main parts
▫ Element Statements : Describe the elements in
the circuit
▫ Control Statements : Describe the types of

analyses to be performed
▫ Output Statements : Specifies the output to be

printed or plotted

The circuit is described as elements


connected between nodes.
General Structure of a Circuit
File
;Title Statement
Signal Source(s)
Element Statements
Control Statements
Output Statements
.end
Circuit File
 Comments must begin with * or ;
 First line is always a comment .
 The statements can be arranged in any order.
 The last line is always .end
 To continue a statement on a new line use
the ‘+’ sign

Each node must be uniquely labeled.
Elements

 PSPICE allows modeling of circuits with both


active and passive elements like
o Resistor
o Inductor
o Capacitor
o Diode
o Transistor
PSPICE Elements
Prefix for units
Code Metric Decimal
Prefix Representation
T Tera 1012
G Giga 109
Meg Mega 106
K Kilo 103
M milli 10-3
U micro 10-6
N nano 10-9
P pico 1012
F femto 10-15
Data Statements - Sources
Independent DC Sources

Voltage Source : Vname n+ n- Type Value


Current Source : Iname n+ n- Type Value

Type: AC or DC
E.g. Vin 1 0 dc 12
Is 3 4 dc 1.5
Example

V1 1 0 DC 10V
V2 4 0 DC 34V
Passive Elements
 SPICE considers the current always flows
from the positive node through the element to
the negative node.
ELEMENT PSPICE DESCRIPTION
Rname n+ n-
value
Lname n+ n value

Cname n+ n-
value
Example
Dependent Sources - VCVS

Voltage Controlled Voltage source


 Statement:

Ename n+ n- nc+ nc- α


 Example
*Name n+ n- nc+ nc- gain
Ebar 17 8 42 18 24.0;

 First letter always ‘E’


Dependent Sources - VCCS

Voltage Controlled Current Source


 Statement:

Gname n+ n- nc+ nc- γ


 Example:
*Name n+ n- NC+ NC γ
Glab 23 17 8 3 2.5

 First letter always ‘G’


Dependent Sources - CCCS
 Current Controlled Current Source
 Statement:
Fname n- n+ VMonitor β
Vmonitor n1 n2 DC 0V

n1
 First letter always ‘F’

n2
Dependent Sources - CCCS

Example:
*Name n- n+ Vmonitor Gain
Ftrn 81 19 Vctl 50.0
Vclt 23 12 DC 0V ;controls Ftrn

n1

n2
Dependent Sources - CCVS
 Current Controlled Voltage Source
 Statement:
Hname n+ n- VMonitor gain
Vmonitor n1 n2 DC 0V

 First letter always ‘H’


Note
 PSPICE does not support open circuits .
 Every node must be uniquely labeled and
must have at least two connections .
 Node 0 is always reserved for ground .
 In case analysis must be done on an open
circuit, a very high resistance value must be
used in place of an infinite resistance.
 PSPICE is not case sensitive.
Basic Analysis Types
 DC Analysis
 .DC
 .OP
 Transient Analysis
 .TRAN
 AC Analysis
 .AC
Standard Analyses
Commands
 .OP
 .DC
 .AC
 .TRAN
 .FOUR
 .NOISE
 .SENS
DC Analysis
 .OP Statement
Causes detailed information about the bias point to
be printed
 Voltage at the nodes
 Current in each voltage source
 Total power dissipation
 Operating point for each element
 If not specified, it automatically performs a DC
analysis before doing a transient or ac analysis
Example

V1 1 0 DC 10V
V2 4 0 DC 34V
R1 1 2 6ohm
R2 2 3 4ohm
R3 3 4 2ohm
.OP
ex 1.1.cir .END
DC Analysis
.DC Statement
 Performs a linear, logarithmic, or nested DC

sweep analysis
 Calculates the circuit’s bias point over a

range of values for <sweep variable name>


.DC Statement – Linear
Sweep
 General Form
.DC [LIN] <sweep variable name>
+<start value> <end value> <increment
value>
+[nested sweep specification]
.DC Statement - LIST

 General Form
.DC <sweep variable name> [LIST]
<value>*
+[nested sweep specification]
 Example

.DC V1 LIST 2 4 8 9 13
Output Control Commands
 .PRINT
 .PLOT
 .PROBE
 .WATCH
 .VECTOR (for digital simulation)
.PRINT
 Allows results from DC, AC, noise, and
transient analyses to be an output to the
output file. (print tables)
 General Form
.PRINT <analysis type> <output variable>*
 Example
.PRINT DC V(1,2) I(R4)
Example
V1 1 0 DC 10V
V2 4 0 DC 34V
R1 1 2 6ohm
R2 2 3 4ohm
R3 3 4 2ohm
.DC V1 LIST -34V
+0V 34V
.PRINT DC V(1,4)
ex 1.2.cir
+I(R1)
.OP
.END
.PLOT
 Causes results from DC, AC, noise, and
transient analyses to be line printer plots in
the output file.
 General Form
.PLOT <analysis type> [output variable]*
+ ([<lower limit value>,<upper limit
value>])*
 Example:
.PLOT TRAN V(2)
Example
V1 1 0 DC 10V
V2 4 0 DC 34V
R1 1 2 6ohm
R2 2 3 4ohm
R3 3 4 2ohm
.DC LIN V1 0V 34V 1V
.PLOT DC V(1,4)
.OP
ex 1.3.cir
.END
.PROBE
 Writes the results from DC, AC, and transient
analyses to a data file used by Probe
 General Form
.PROBE [output variable]*
 Example

.PROBE V(2)I(R5)
Example
V1 1 0 DC 10V
V2 4 0 DC 34V
R1 1 2 6ohm
R2 2 3 4ohm
R3 3 4 2ohm
.DC LIN V1 0V 34V 1V
.PROBE
ex 1.4.cir .OP
.END
Circuit File Processing
Commands
.END
Marks the end of the circuit.

Can there be more than one .END commands


in a .cir file?
Find the currents in each branch
using PSPICE
Is1 1 2 12A
R2 i1 R1 2 3 2
2 ohm ->
R2 2 3 2
R1
3
R3 1 0 1
2 2 ohm

i 2 _>
R4 1 0 3
R5 R6
R5 3 0 3
Is1 R4 _
12A 3 ohm i 5 > 3 ohm 6 ohm R6 0 3 6
i3 i4
R3 |v .DC Is1 LIST 12A
1 ohm ^|
1 _ 0
.PRINT DC I(R1)
i6 >
+I(R2) I(R3)I(R4)
+I(R5) I(R6)
kcl.cir
.OP
.END
Find the voltages at nodes
1,2 ,3
Vs1 1 0 3V
R1 R3 R1 1 2 2ohm
1 2 ohm 2 1 ohm 3
R2 2 0 6ohm
+ R3 2 3 1ohm
Vs1 R2 R4
3V 6 ohm 1/4 v2 8 ohm G1 3 0 2 0 0.25
-
R4 3 0 8ohm
0 .DC Vs1 LIST 3V
.PRINT DC V(1)
nodal.cir
+V(2) V(3)
.OP
.END
Find Thevenin Equivalent of the
circuit to the left of points a and
b
R3
6 ohm
Is2
15A

R5 R1
1 1 ohm 2 2 ohm 3 a

+ Is1
Vs2 R2
20V 15A 3 ohm
-

0
b
Determination of Open Circuit
Voltage
R3
6 ohm
Vs2 1 0 20V
Is2
15A R5 1 2 1
R1 2 3 2
1
R5
1 ohm 2
R1
2 ohm 3 R3 1 3 6
Is1 2 0 15A
+ Is1
Vs2
20V 15A Is2 2 3 15A
-
.DC Vs2 LIST 20V
0 .PRINT DC V(3)
.OP
thevenin.cir
.END
Determination of output
Resistance
Vs2 1 0 0V
R3
6 ohm R5 1 2 1
R1 2 3 2
R3 1 3 6
R1
VS1 3 0 5V
R5
1 1 ohm 2 2 ohm 3

+
Vs1
5V
.DC Vs1 LIST 5V
-
.PRINT DC V(3)
0
+I(VS1)
thevenin.cir .OP
.END
Find the Norton Equivalent of the
circuit to the left of the points a
and b
R1 R2
1 2 ohm 2 1 ohm 3 a
+ 1 a
+ +
+ R6
R3 R4 Is1 R5 8 ohm
Vs1 v1 v 0.675A v
3V 6 ohm 1/4 V1 8 ohm 1.82 ohm
- -
0 b
- -
0 b
Determination of short circuit
current R1 R2
1 2 ohm 2 1 ohm 3
+
+
Vs1 R3 isc Vs1 1 0 3V
v1 1/4 V1 |
-
3V 6 ohm
v R1 1 2 2
-
0
R2 2 3 1
R3 2 0 6
R1 R2 Vs2 3 0 0V
1 2 ohm 2 1 ohm 3
+ Vs2
G1 3 0 2 0 0.25
+ 0V + i s c .DC Vs1 LIST 3V
Vs1 v1 R3
1/4 V1
|v
6 ohm
-
3V
- .PRINT DC I(Vs2)
-
.OP
0
.END
norton.cir
Determination of output
Resistance
Vs1 1 0 0V
R1 R2
2 ohm 2 1 ohm 3 R1 1 2 2
+
+
R2 2 3 1
Vs2
v1 R3
6 ohm 1/4 V1
-
5V R3 2 0 6
- Vs2 3 0 5V
0 G1 3 0 2 0 0.25
norton.cir .DC Vs2 LIST 5V
.PRINT DC I(Vs2)
+V(3)
.OP
.END
.PARAM
 Defines the value of a parameter.
 A parameter name can be used in place of most
numeric values in the circuit description.
 Parameters can be constants, or expressions
involving constants, or a combination of these,
and they can include other parameters.
Examples
.PARAM VSUPPLY = 5V
.PARAM VCC = 12V, VEE = -12V
.PARAM BANDWIDTH = {100kHz/3}
.STEP
The .STEP command performs a parametric sweep
for all of the analyses of the circuit.
General form
.STEP LIN <sweep variable name> <start value>
+<end value> <increment value>
Examples
.STEP VCE 0V 10V .5V
.STEP LIN I2 5mA -2mA 0.1mA
.STEP LIN PARAM Res .5k 10k .5k
Example – Plot the variation in power
absorbed by load R2 as it varies between
500Ω and 10kΩ. When is it the maximum ?

VS1 1 0 DC 5V
R1 1 2 5k
R2 2 0 {Res}
.PARAM Res 4K param.cir
.STEP LIN PARAM Res .5k 10k .5k
.DC VS1 LIST 5V
.PROBE
.OP
.END
Source: http://www.tdpcb.com/images/pcb6.JPG

You might also like