4th Tutorial on PSpice

Linear Inductors in PSpice

The next passive element we add to our parts list is the linear inductor.  This part name begins with the letter, L, in column 1 of the source listing.  Be aware that PSpice enables this part to access a nonlinear model description.  That will be explained in a later tutorial.  For now, our inductor model is a linear device incapable of saturation.

The inductor stores energy in its magnetic field.  This makes it necessary to be able to specify its initial current in a simulation.  Although we can include inductors in DC circuit simulations, there is usually little advantage in doing so because the inductor behaves as a short circuit under steady-state DC excitation.  In steady-state AC simulations the inductor behaves as an imaginary impedance.  We do not specify initial current in an inductor in either of those steady-state conditions.   However,  when simulating transient operations, we often need to specify this initial current.

Linear Inductor with Initial Current

The figure shown above shows the circuit symbol for an inductor with node designations of "1" and "2," an initial current of 2.5 A, and a value of 50 mH. An appropriate code listing for entering this element into a PSpice circuit file is:

*name nodelist   L_val  
Lag   1    2     50m    IC=2.5

Note that the initial current is assumed to flow from the first node in the node list through the inductor towards the second node in the node list.  If there is a need to change the direction of this initial current, either reverse the order of the nodes in the node list or place a minus sign in front of the value of the initial current.  For better readability, the above line could be written as:

Lag   1     2     50mH   IC=2.5A

The "H" for henrys and the "A" for amps will be ignored by PSpice.

Linear Capacitors in PSpice

The capacitor is the second energy storing circuit component we add to our parts list.   We will assume that the capacitor is ideal in the sense of being linear and lossless.  Since it can store energy, PSpice provides a method for specifying the initial voltage across the capacitor.  This is useful for simulations of transient behavior of circuits with capacitors.  The figure shown below illustrates a capacitor with node designations and an initial voltage of 20 V from node 4 to node 5.  The part name for a capacitor must start with the letter, C.

Linear Capacitor with Initial Voltage

An appropriate code listing to represent this capacitor in a PSpice listing is:

*name nodelist   C_val 
Cfb   4    5     50u    IC=20

The capacitance of the above element is 50μF.  This can be represented as "50u" in PSpice.  (See PSpice Tutorial No. 1 for a description of the system for metric prefixes in PSpice.)  Note that the polarity of the initial voltage (as shown) is such that the positive side is the first node in the list with the negative side on the second node in the list.  To reverse the polarity of the initial voltage for the simulation, either reverse the order of the nodes in the node list or place a minus sign in front of the value in the "IC=" phrase.   For better clarity, the above capacitor could be coded as:

Cfb   4    5      50uF   IC=20V

PSpice would ignore the "F" for farads and the "V" for volts.

Transient Analysis Using PSpice

One of the most interesting aspects of circuit analysis is the study of natural and step responses of circuits and the responses of circuits to time-varying sources.  To perform these analyses we introduce another group of "dot" commands.

Use of the .TRAN command

This is the command that passes the user's parameters for performing the transient analysis on a circuit to the PSpice program.  There are four time parameters and an instruction to use the initial conditions rather than calculated bias point values for starting conditions.  First, we show a sample .TRAN statement and then we will describe its parameters.

*      prt_stp  t_max  prt_dly   max_stp
.TRAN  20us     20ms   8ms       10us     UIC

In the above statement, the "20us" value labeled "prt_stp" (print step) is the frequency with which data is saved.  In this case, the system variables are stored each 20μs of simulation time.  The actual time steps used by PSpice may be different from this.  The second parameter, "20ms," labeled as "t_max" (final time) is the value of time at which the simulation will be ended.   Since PSpice starts at t = 0, there will be a total of 20ms time span of simulation for the circuit.   The third parameter, "8ms," labeled as "prt_dly" (print delay) is the print delay time.  In some cases, we do not want to store the data for the entire time span of the simulation.  In our sample statement shown above, we ignore the data from the first 8ms of simulation and then store the data for the last 12ms.  Most of the time, this parameter is set to zero or not used.  The fourth parameter, "10us," labeled as "max_stp" (max step) is the maximum time step size PSpice is allowed to take during the simulation.  Since PSpice automatically adjusts its time step size during the simulation, it may increase the step size to a value greater than desirable for displaying the data.  When the variables are changing rapidly, PSpice shortens the step size, and when the variables change more slowly, it increases the step size.  Use of this parameter is optional.  The last parameter in our list is "UIC."  It is an acronym for "Use Initial Conditions."  Unless you include this parameter, PSpice will ignore the initial conditions you set for your inductors and capacitors and will use its own calculated bias point information instead.  Note that the use of the letter "s" after the numbers in the .TRAN statement is optional.  PSpice assumes these values are seconds and actually ignores the "s."  However, it is recommended that you use units until you are extremely familiar with all of these commands and definitions.

Now, we will examine some more .TRAN examples.

.TRAN  10ns  500us

In the above example, PSpice will save data at each 10ns interval of the simulation starting at t = 0 until the final time of 500μs.   I.e., there is no print delay and the user has given full control of the calculation step size to PSpice.  In addition, PSpice will calculate its own initial conditions for any inductors and capacitors, ignoring any initial conditions set by the user.

.TRAN  50m  2.5  0    10m   UIC

In the above statement, PSpice collects the data at each 50ms time interval starting from zero up to 2.5s.  A zero was required as as a placeholder for the print delay parameter since the maximum step size of 10ms was specified.  PSpice will use the designated initial conditions of capacitor voltage and inductor current.  Notice that the units were left off the numbers in this statement.  Only the prefixes which size the values are needed.

Use of the .PROBE command

In addition to specifying the time parameters for a transient solution of a circuit problem, we need to specify how the data is to be saved.  In most cases, this simply means that we include a line in the *.CIR file consisting of ".PROBE."   This instructs PSpice to create a data file and store the data it calculates.   If we create a circuit listing named "CIRCUIT1.CIR" containing a ".TRAN" statement and a ".PROBE" statement, PSpice will create a file named "CIRCUIT1.DAT" holding the data as well as the usual "CIRCUIT1.OUT" file with basic information about the circuit.  By default, the data file created by PSpice is a binary data file; i.e., you can't read it with a text editor.  This is the most efficient way of saving the data.  However, there is an optional parameter (/CSDF) for the .PROBE statement that causes PSpice to save the data in a Common Simulation Data Format  which is a text format that allows you to look at the raw data with a text editor.  However, it will take up more space and PROBE doesn't load it for graphing.  You will need to make a second run without the /CSDF parameter if you want to plot the data.

Also by default, .PROBE causes all the circuit variables to be saved, including all the variables inside each instance of each subcircuit.  In some cases, this can amount to a lot of data.  If you simulate a large complex circuit with many parts and need to save data at short time intervals over a very long time span, you can easily create gigabyte-size "DAT" files.  To avoid this, you can specify the values you want to save.  If the ".PROBE" command is issued without any parameters, everything is saved.  If you specify the quantities you want saved, only those quantities will be saved.  We will now examine some .PROBE statements.


All the above statement does is the enable PSpice to save everything in a binary DAT file.


The above statement enables PSpice to save everything in a CSDF file that can be opened (and edited) with a text editor.  You can also read and understand the values. Unfortunately, PROBE cannot make plots from the data in this form.

.PROBE V(5,23) I(Rx) I(L4)

The above statement tells PSpice to save only the voltage drop between nodes 5 and 23, the current through resistor, Rx, and the current through inductor, L4, all in binary format.  No other data will be saved.

Example of Transient Circuit Analysis

Circuit for Transient Response Example

The complete listing for the "RLCNAT01.CIR" file is as follows:

Natural Response of a parallel RLC circuit
Rp   0   1   1.0
Lp   1   0   8mH   IC=20A
Cp   1   0   10mF  IC=0V
.TRAN 500us 100ms 0s 500us UIC

In the above example, the eight millihenry inductor, Lp, has an initial current of 20 amps flowing from node 1 through the inductor to node 0.  The 10 millifarad capacitor, Cp, has an initial voltage of 0 volts.  Both the print step size and the maximum step size are set to 500μs and the final time is 100ms.   There is no print delay, and PSpice is instructed to use the initial conditions provided.  The "RLCNAT01.OUT" file is listed below.  There is little information in it because the text file can show very little of the transient behavior of the circuit.

**** 07/17/98 18:47:40 ******* NT PSpice 8.0 (July 1997)
Natural response of a parallel RLC circuit
RP 0 1 1.0
LP 1 0 8mH IC=20A
Cp 1 0 10mF IC=0V
.TRAN 500us 100ms 0s 500us UIC

For meaningful information about the transient response we need to use another program that is bundled with PSpice.  This program is named PROBE.  The Probe program graphs the data that was saved in the "RLCNAT01.DAT" file.  To invoke this program you left-click on "Run Probe" in the PSpice File menu.   Probe will automatically open the DAT file you have just created.  You can also launch Probe from the Start menu of Windows, but you will then need to go to Probe's File menu and open the DAT file you want to see.  After you have Probe running with the proper DAT file open, choose "Add" in the Probe Trace menu.  You will see a list of circuit variables that can be displayed.  Choose V(1), the voltage at node 1, and then click "OK."  You should see the following trace in Probe.

PROBE Plot of Transient Voltage Response

In Probe, click on the V(1) at the lower left corner (not here, you need to be running Probe) and then hit the "Delete" key.  Then go back to the Trace menu in Probe and choose "Add" again.  This time choose I(LP) and click "OK."  You should see the following trace of the inductor current:

PROBE Plot of Transient Current Response

Actually, you will see a negative of the above traces.  In order to get the white background as you see above, you will need to modify the "INI" file for PSpice.   That will be the topic of another tutorial.

Back to Main Page