Daffodil International University
Department of Electrical and Electronic Engineering
Faculty of Engineering
EXPERIMENT NO: 01
NAME OF THE EXPERIMENT: Introduction to PSpice (Netlisting Method).
Objective
The objective of this course is to learn the fundamentals of computer aided circuit simulation using
PSpice. This experiment introduces the fundamentals of PSpice and concentrates on analysis of some DC
circuits.
Introduction
SPICE is a powerful general purpose analog circuit simulator that is used to verify circuit designs and to
predict the circuit behavior. This is of particular importance for integrated circuits. It was for this reason
that SPICE was originally developed at the Electronics Research Laboratory of the University of
California, Berkeley (1975), as its name implies
Simulation Program for Integrated Circuits Emphasis
The EEE110 Lab uses the student version of the PSpice program extensively to simulate and predict the
behavior of experimental circuits. Simulation is very important as it allows a potential circuit to be tested
for errors before it is actually built, thus saving time and cost.
Some Facts and Rules about PSpice
PSpice is not case sensitive. This means that names such as Vbus, VBUS are vbus are equivalent.
All element names must be unique.
The first line in the data file is used as a title. PSpice will ignore this line as circuit data. Do not place
any actual circuit information in the first line.
There must be a node designated "0" (Zero). This is the reference node (ground) against which all
voltages are calculated.
Each node must have at least two elements attached to it.
The last line in any data file must be " .END "
All lines that are not blank (except for the title line) must have a character in column 1, the leftmost
position on the line.
o Use "*" (an asterisk) in column 1 in order to create a comment line.
o Use "+" (plus sign) in column 1 in order to continue the previous line (for very long lines).
o Use "." (period) in column 1 followed by the rest of the "dot command" to pass special
instructions to the program.
o Use the designated letter for a part in column 1 followed by the rest of the name for that part (do
not use spaces in the part name).
Do not use spaces in the node name also. Use the underscore (“_”) character to simulate spaces.
Use "whitespace" (spaces or tabs) to separate data fields on a line.
Use ";" (semicolon) to terminate data on a line if you wish to add commentary information on that
same line.
In PSpice circuits can be analyzed in two ways
o Text based: using “Netlist” to code up circuits
o Graphics based: using “Schematics” to draw circuits and simulate
Part A: Circuit Simulation by writing “Netlist”
A SPICE input file, called source file (“filename.cir”) , consists of three parts.
1. Data statements : description of the components and the interconnections.
2. Control statements : tells SPICE what type of analysis to perform on the circuit.
3. Output statements : specifies what outputs are to be printed or plotted.
Although these statements may appear in any order, it is recommended that they be given in the above
sequence. Two other statements are required, the title statement and the end statement. The title statement
is the first line and can contain any information, while the end statement is always .END
TITLE STATEMENT
ELEMENT STATEMENTS
.
.
COMMAND (CONTROL) STATEMENTS
OUTPUT STATEMENTS
.END
1. Data Statements to Specify the Circuit Components and Topology
Here, we present the simplest circuit elements. Knowing how to model these ideal, linear circuit elements
is an essential start to modeling more complex circuits.
1.1. Resistors
Although PSpice allows for sophisticated temperature-dependent resistor models, we will begin with the
simple, constant-value resistor. The first letter of the name for a resistor must be "R.".
Rname <+ node> <- node> value
The resistor is not an active device, so the polarity of its connection has no effect on the values of the
voltages and currents reported in the solution. However, the current through a resistor is reported as that
which flows from the node on the left to the node on the right in the source code line in which the resistor
is entered.
Examples:
Rname +node -node value comment
Rabc 31 0 14k ; reported current from 31 to 0
Rabc 0 31 14k ; reported current changes sign
rshnt 12 15 99m ; 0.099 ohm resistor
Rbig 19 41 10MEG ; 10 meg-ohm resistor
Large and Small Numbers in PSpice
Unfortunately, PSpice cannot recognize Greek fonts or even upper vs. lower case. Thus our usual
understanding and use of the standard metric prefixes has to be modified. The metric prefix designations
used in PSpice are:
Number Prefix Common Name
1012 T or t tera
109 G or g giga
106 MEG or meg mega
103 K or k kilo
10-3 M or m mili
10-6 U or u micro
10-9 N or n nana
10-12 P or p pico
10-15 F or f femto
An alternative to this type of notation, which is in fact, the default for PSpice output data, is "textual
scientific notation." This notation is written by typing an "E" followed by a signed or unsigned integer
indicating the power of ten. Some examples of this notation are shown below:
656,000 = 6.56E5
-0.0000135 = -1.35E-5
1.2. Ideal Independent Voltage Source
We begin with the DC version of the ideal independent voltage source. This is the default form of this
class of part. The beginning letter of the part name for all versions of the ideal independent voltage
source is "V."
Vname <+ node> <- node> type value
The name is followed by the positive node designation, then the negative node designation, then an
optional tag: "DC" followed by the value of the voltage. The tag "DC" (or "dc") is optional because it is
the default. Later, when we begin modeling AC circuits and voltage sources that produce pulses and
other waveforms, we will be required to designate the type of source or it will default back to DC.
Examples:
Vname +node -node type value comment
Va 4 2 DC 16.0V; "V" after "16.0" is optional
vs qe qc dc 24m ; "QE" is +node & "qc" is -node
VWX 23 14 18k ; "dc" not really needed
vwx 14 23 DC -1.8E4 ; same as above
One of the interesting uses of ideal independent voltage sources is that of an ammeter. We can take
advantage of the fact that PSpice saves and reports the value of current entering the positive terminal of an
independent voltage source. If we do not actually require a voltage source to be in the branch where we
want to measure the current, we simply set the voltage source to a zero value. It still calculates the current
in the branch.
Example:
Vdep 15 27 DC 0V ; V-source used as ammeter
1.3. Ideal Independent Current Source
The name of an ideal independent current source begins with the letter "I".
Iname <+ node> <- node> type value
Since the current source, is an active element, it matters greatly how it is connected. Designated current
flows into the node written on the left, through the current source, out the node written on the right. As
with the independent voltage source, the default type is DC.
Examples:
Iname +node -node type value comment
Icap 11 0 DC 35m ; 35mA flows from node 11 to 0
ix 79 24 1.7 ; "DC" not needed
I12 43 29 DC 1.5E-4 ;
I12 29 43 dc -150uA ; same as above
2. Commands or Control Statements to Specify the Type of Analysis
PSpice allows various types of analysis. Each analysis is invoked by including its command statement.
2.1. .OP statement
This statement instructs Spice to compute the DC operating points:
voltage at the nodes
current in each voltage source
operating point for each element
In PSpice it is usually not necessary to specify .OP as it gives you automatically the DC node voltages.
However, for other types of analysis it is required to specify a certain analysis type, such as .TRAN or
.AC for doing a transient or AC analysis.
2.2. .DC statement
This statement allows you to increment (sweep) an independent source over a certain range with a
specified step. The format is as follows:
.DC SRCname START STOP STEP
in which SRC name is the name of the source you want to vary; START and STOP are the starting and
ending value, respectively; and STEP is the size of the increment. This is a method of varying a parameter
over a range of values so that we get a batch of cases solved all at once.
Example: .DC V1 0 20 2
Often, we do not actually want to run a sweep over many values of a parameter. We can circumvent the
sweep by setting its Start and Stop values identical (and the Step is non-zero) so that it can only run one
value.
Example: .DC Vs 20 20 1
Since the starting value equals the stopping value, the analysis will only run for one case, i.e., for Vs at 20
volts.
3. Output statements
These statements will instruct PSpice what output to generate. If you do not specify an output statement,
PSpice will always calculate the DC operating points.
3.1. .Print Command
One of the many "dot commands" in PSpice is the .PRINT command. It has many uses, but we will
concentrate here on using it for printing DC voltages and currents. The .PRINT command can be
repeated as often as necessary in an analysis. You can list as many items on a line as you wish.
However, we must keep in mind that the .PRINT command was designed to work with a DC or an AC
sweep. Usually, a DC sweep is made by changing the values of a source; although we will later learn to
sweep over other circuit parameters.
Remember that in this experiment we will use DC sweep statement only to enable the .PRINT command.
The .PRINT command will not work unless there is a sweep going on. Note: What you enter in the .DC
statement overrides any voltage value you may have placed in the part listing for the source.
Printing DC Voltages
In addition to printing the node voltages you can print the voltage between any pair of nodes
.PRINT DC V(1) V(2) V(3); prints the node voltages
.PRINT DC V(3,2) ; prints the voltage from node 3 to node 2
Printing DC Currents
To print currents, you type the letter "I" with the element name in parentheses. Note that the reported
current is that which flows into the element from the node listed on the left in the *.CIR file, through the
element, and out the node listed on the right in the *.CIR file. If you want to change the sign of the
reported current in a resistor, then swap the two nodes for that resistor.
.PRINT DC I(Ra) ; prints the currents from + to - of Ra
.PRINT DC I(Rb) I(Rc) ; prints the currents through Rb and Rc
Print Commands can be Combined
.PRINT DC V(1,2) I(Ra) ; voltage and current for Ra
.PRINT DC V(2,0) I(Rb) ; V(2,0) same as V(2)
3.2. .Plot Command
The results from dc analysis can also be obtained in the form of plots. The maximum number of output
variables is eight in any .Plot statement. More than one .Plot statement can be used to plot all the desired
output variables.
Plot statements
.PLOT DC V(1) V(3,5) I(R1)
.plot dc V(5) V(3,5) (0,10V) I(R1) (0, 50MA)
In the first statement, the y-axis is by default. In the second statement the range for voltages V(5) and
V(3,5) is 0V to 10V, that for current I(R1) is 0 MA to 50 MA.
3.3. .Probe Command
Probe is a graphics post-processor/waveform analyzer for PSpice. The simulation results cannot be used
directly by Probe. First, the results have to be processed by the .PROBE command, which writes the
processed data on a file, PROBE.DAT, for use by Probe.
Probe statements
.PROBE
.PROBE V(5) V(4,3) I(R2)
In the first form, where no output variable is specified, the .PROBE command writes all the node voltages
and all the element currents into the PROBE.DAT file. In the second form, where the output variables are
specified, PSpice writes only the specified output variables to the PROBE.DAT file. Once the results of
the simulation are processed by the .PROBE command, the results are available for graphical displays and
can be further manipulated through expressions.
Circuit Example 1
Steps:
1. Open MicroSim Design Manager by following the path start>programs>MicroSim Eval 8 or as
appropriate in your PC.
Schematics
PSpice A/D
TextEdit
2. Click the TextEdit button to open MicroSim Text Editor. Here write down the following Netlist
Example_1a Exmpl01a.CIR
Vs 1 0 DC 20.0V ; note the node placements
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA ; note the node placements
.END
3. Save the file with a name Exmpl01a.cir
4. Click PSpice A/D button to open the PSpice Analog/Digital Simulator
5. Open your Exmpl01a.cir file by clicking file and then open. If there is no error in the netlist then it
will automatically complete the simulation and will give the message “simulation completed
successfully”.
6. To examine the result click file and then Examine Output
Now use .PRINT with Previous Example
Example_1b Exmpl01b.CIR
Vs 1 0 DC 20.0V ; note the node placements
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA ; note the node placements
.DC Vs 20 20 1 ; this enables the .print commands
.PRINT DC V(1,2) I(Ra)
.PRINT DC V(2) I(Rb)
.PRINT DC V(3) I(Rc)
.END
With a little bit of effort, we can get PSpice to do most of the work, most of the time. Note that using
.PRINT has suppressed the default printing of all the node voltages. Be sure that you include everything
you need in the .PRINT statements
Practice Problem 1