Basic PSPICE Tutorial

by Laura A. Knauth

Fall 1995

Introduction:
PSPICE is a version of SPICE, a circuit analysis program, and is made to run on PC or PC-compatible computers. This program is designed to calculate the voltages and currents of specified circuit nodes and/or elements in using dc, ac, or transient analysis. PSPICE is able to calculate these values by solving simultaneous equations formulated from the information that has been input by the user. Since PSPICE cannot know the nature of the user’s desired circuit by visual inspection of the schematic, the user must follow a set of standard guidelines to translate the circuit from a schematic into a form that the program can understand. For this reason, those who use PSPICE for circuit analysis, must fully understand the elements of a circuit and how these elements function within the circuit so that the correct information is input into the PSPICE program. Understanding the basic nature of the circuit in question is also essential for interpreting the results given after PSPICE has analyzed the circuit. Although PSPICE may seem like it is more complicated than it is worth for solving simple circuits, PSPICE can be incredibly useful if properly employed for solving circuits that require complex mathematics.

The Basic Elements:
First of all, the PSPICE document must have a title. This is necessary because PSPICE ignores the first line of all programs, and it is also practical for documentation purposes. If further documentation is deemed necessary, an asterix, * , placed at the beginning of any line will tell PSPICE to ignore that line, and a comma placed after a PSPICE command will tell PSPICE to ignore the remainder of that line. Documentation, including the mention of circuit elements, placed in a portion of the program that PSPICE ignores allows the user to keep track of the circuit’s purpose and any dummy variables needed for PSPICE to properly analyze the circuit.

The location of the elements within a circuit needs to be specified according to which nodes they are connected. Therefore, before typing in a PSPICE program, the user must redraw the desired circuit clearly indicating the circuit nodes and which elements are connected to them. In addition to this, there must be a node between each element in series, and one of the nodes must be labeled as a reference node, or ground, denoted by the number "0".

Describing the circuit elements is a very important task in PSPICE. Each element is described using one line in the PSPICE program, where each piece of information about the element is separated by a tab. This task is accomplished by first giving a name to each and every circuit element. The first letter of the element’s name tells PSPICE the nature of the element, be it a resistor, capacitor, voltage source and so on. The name of the element must be within the range of one to eight characters in length, and they may include numbers or letters. Just what those characters are, following the first defining letter, is up to the user. The following chart shows the most typical circuit elements and what the first letter describing them must be:

			R	Resistor			C	Capacitor			L	Inductor			V	Independent voltage source			I	Independent current source			E	Voltage-controlled voltage source			F	Current-controlled current source  			G	Voltage-controlled current source  			H	Current-controlled voltage source

The letters E, F, G, and H represent dependent sources, and the current-controlled current sources, F and H, require a "dummy" voltage source, of zero volts, to be inserted in series with the current source so that PSPICE can determine the current through this current source. This will be explained in greater detail later in this manual. Following the element name, separated by a space or a tab, are two nodes to which the element is connected. The positive node must be mentioned first, followed by the negative node. The positive node for a current source therefore is the node which the current is flowing away from. The nodes connecting a resistor may be in any order. Acceptable node labels are those that are non-negative numbers, but they do not have to be in any particular order within the circuit.

For elements other than sources, the numerical value of the element’s strength must be entered next. For example, if the element is a 60 ohm resistor, the next value to be entered would be "60." Since the element was named beginning with an "R," PSPICE assumes this last numerical value to be in ohms. If, for documentation purposes on the other hand, the user were to type in 60ohms, PSPICE would ignore the letters following the number and treat the value as "60" just the same. To express large or small numbers, PSPICE understands several labels such as:

		T = 1E12	G = 1E9	MEG = 1E6		K = 1E3	M = 1E-3	U = 1E-6		N = 1E-9	P = 1E-12	F = 1E-15

In the above cases, "E" indicates that the number is multiplied by the indicated power of ten. Decimal values are allowed to represent the numerical value of an element, however, commas may not be used. If a decimal is not contained within the number input by the user, PSPICE assumes the decimal to be at the end of the number. Negative numbers are allowed; if no sign is included, PSPICE assumes this the value to be positive. This is all that is required to describe a circuit element that is not a source, therefore the user may hit the enter key and continue describing the rest of the circuit.

If the element is an independent source, then an additional piece of information is needed between the node information and the numerical value of the element. The user must type in "DC" for a source of direct current, or "AC" for a source of alternating current. Using the previous example, the independent current source should be described as follows:
I1 0 1 DC 10

If the element is a dependent source, then more information regarding the source on which the element is dependent is needed. Following the input of the positive and negative nodes to which the dependent source is connected, the positive and negative nodes of the controlling voltage or current source must then be entered, with the exception of current controlled sources (see next paragraph). The last bit of relevant information that the user needs to tell PSPICE about the circuit is the ratio of the dependent voltage to the controlling voltage or current. In other words, the user must type in the voltage gain or transconductance.

For any current-controlled dependent source, a dummy voltage is needed in series with the source so PSPICE can determine the current through the source. Since this dummy voltage, having a value of 0 Volts, must be placed in series with the controlling source, another node must be specified between the two elements. This is documented in PSPICE by inputting the name of the dummy voltage between the specified nodes of the dependent source and the value of the gain or transconductance.

After all of the circuit elements have been properly input into the PSPICE program, all that is essential for the program to be complete is the end statement which simply consists of typing ".END" at the last line. If the program were to be run from this point, the output from PSPICE would yield a display of all of the node voltages, and the current through each independent voltage source would also be listed.

If the user would like to have results beyond the node voltages, a number of statements may be employed. If a range of node voltages caused by varying source voltages or currents, is desired, the command ".DC" may be used. First, on a new line, type in ".DC". After a space or a tab, type in the source that is to be varied. Then, type in the starting voltage, stopping voltage, and the value by which this voltage is to be incremented, respectively. If more than one voltage is to be varied, then the user should just type in the same instructions for the next voltage following the value that the first voltage is to be incremented, and so on. To find the ratio of the input resistance to the output resistance, type ".TF" followed by the output variable, and then the input variable. The “.PROBE” command calls up the program PROBE, which is used to plot the results of PSPICE circuit analysis. The command ".TRAN" indicates that transient circuit analysis will be used to analyze the circuit. These last two commands will be discussed in further detail when describing transient circuit analysis.Example of DC circuit analysis using PSPICE version 6.2: Using this version of PSPICE, the document describing the schematic must first be made using a word processor like Notepad or Microsoft Word, and given the file extension ".CIR" before it may be opened in PSPICE. Once the document has been typed using the methods described in the "Basic Elements" section of this manual, save the document and change the file extension from .doc or .txt to .CIR. This can be accomplished several different ways. One method is to enter MS-DOS and type "rename document.txt document.CIR". Once the program has the file extension .CIR, then open PSPICE. Click the file menu and select the "Open" option. Select your circuit document and wait for PSPICE to finish running the program (this is done automatically just by opening your program). A menu box should appear quite rapidly stating whether the program was run successfully or whether it contained errors. If your program did contain errors, then reopen the .CIR file and check to make sure that all of the elements were input as described in the "Basic Elements" section of this manual. Once you have re-run the program and were told by PSPICE that it works, then you can view the output of you efforts. Click on the File Menu again, and a new option should be in bold, saying "Examine Output." By selecting this option, Notepad will be activated and the outputs to the program should be contained within this output document created by PSPICE (all output documents have the file extension ".OUT"). [Sorry about this, when I wrote this paper, I drew in the circuit by hand rather than a schematic program. As soon as I get the chance to draw in the circuit I describe here, I'll include it here.]An example PSPICE program is as follows: [The circuit used in this example was taken from J.D. Irwin’s text Basic Engineering Circuit Analysis (see bibliography), Chapter 4, Problem #19, page 190]>


First, label the circuit nodes, and remember to designate one of them as the ground. Keep in mind that PSPICE automatically returns all node voltages. Therefore, since we are looking for V(o), the voltage at node 2 as returned by PSPICE will be the desired answer. Following the guidelines mentioned in the "Basic Elements" section of this manual, write the program for the circuit. Remember that since the dependent current source in this circuit is controlled by a current source, the proper label for the dependent source starts with "F." Also remember that since the dependent source is current controlled, a dummy voltage source in series with the controlling current is necessary.

The following program was typed in "Notepad" and saved with the file extension ".CIR":

CHAPTER 4 #19V1	3	0	DC	12VX	1	4	DC	0  ; Dummy Source used to calculate Ix for F1F1	0	2	VX	2R1	1	3	1R2	4	0	2R3	1	2	2R4	2	0	1	*  Vo is the same as node voltage V(2).END

After opening this file in PSPICE, the output file will appear as shown in Appendix A. The voltage at node two was calculated to be 8 volts, and therefore the voltage, V (o) = 8 V.

Example of Transient circuit analysis using PSPICE version 6.2: Use transient analysis to find out visually how the currents and voltages within a given circuit fluctuate over a period of time. To use the ".TRAN" statement, start the beginning of a new line with:

 .TRAN		step size for plotter	time to stop	time to start	maximum time step

The last two items may be left off. The default for the start time is time zero and PSPICE will calculate the appropriate maximum time step for the circuit if that parameter is left off. The ".PROBE" statement is extremely useful in transient analysis using PSPICE. The ".PROBE" statement activates the program "PROBE" which can be used to view the graphs of various currents or voltages versus time. After the program with the .TRAN and .PROBE statements has been opened, or run, in PSPICE, click on the File menu and select "Run Probe." PROBE should then start up and result in a blank graph. Click on the Trace menu and select the option to "Add." This will bring up a menu box. Highlighting the desired variable and clicking the OK button will cause PROBE to graph that chosen variable versus time.

If the inductors or capacitors in a circuit have initial conditions other than 0 Volts or 0 Amps, then they are indicated in PSPICE by putting an extra tab after the value of the capacitor or inductor in henrys or farads and typing: IC=XXX where XXX indicates the numerical value of the initial condition. The range of acceptable values for the initial conditions follows the standard range of numbers specified in the "Basic Elements" section of this manual. In addition to adding the value for the initial conditions to the inductor or capacitor information lines, the statement "UIC" (for Use Initial Conditions) must be placed at the end of the .TRAN statement line.

In the following example, taken from Irwin pg. 339 example #39, the .TRAN, PROBE, and initial condition statements are used to visually see one the changing voltages in the circuit. [To the reader: I'll include this diagram as soon as I can get it scanned in. Sorry for the inconvenience.]


Since the circuit contains a switch that flips at t=0, the steady state analysis must first be performed for the time less than zero. The following program was written in Notepad, for the above circuit. A test voltage source is needed in series with the inductor so that the final current through the inductor for t < 0 can be determined. The following circuit represents the above circuit for t < 0.

COMPUTE INITIAL CONDITIONS  ( TIME T < 0 )*DC VOLTAGE SOURCESV1	2	0	DC	12V2	0	3	DC	12*TEST SOURCE TO DETERMINE CURRENT THROUGH THE INDUCTORVT	4	1	DC	0*RESISTOR VALUESR1	2	3	2R2	2	1	4R3	1	0	2*INDUCTOR VALUEL1	2	4	1/3.END

The output for this file, after it was run with PSPICE is shown in Appendix B. PSPICE returned indicating that the current through the test source, VT, was 6 Amps. Therefore, the current through the inductor equals 6 Amps when t = 0, and thus, this is the initial condition for the inductor. The next step is to redraw the circuit for t < 0.

Now, a new program must be written in PSPICE for this “new” circuit. In this new circuit, the voltage source has been opened, therefore the current and voltage in this circuit can be expected to decay with time. Therefore, a transient circuit analysis is needed. The following program therefore used the .TRAN, .PROBE, and initial condition statements to determine visually, how the voltage and currents in the circuit change with time.

OUTPUT RESPONSE PROGRAM*CIRCUIT CONDITIONS AT TIME T=0+*DC VOLTAGE SOURCEV2	0	3	DC	12*TEST SOURCE TO DETERMINE THE CURRENT IN THE INDUCTORVT	4	1	DC	0*RESISTOR VALUESR1	2	3	2R2	2	1	4R3	1	0	2*INDUCTOR VALUE USING THE INITIAL CONDITIONSL1	2	4	1/3	IC = 6.0.TRAN		0.02S	5S	UIC.PROBE.END

By accessing PROBE through the File Menu and selecting V(1) in the Trace:Add menu box, PROBE will display the graph of V(o) versus Time. Such a graph is shown in Appendix C. As expected PSPICE reports that the voltage through the 1 ohm resistor at node 2 decays exponentially with time. By inspection of this graph, the initial voltage at node 2 is 3 Volts, and in approximately 4 seconds, the voltage has decreased to -6 Volts.

While PSPICE may seem tedious at first, learning to use this program will prove to be an effective way to solve voltages and currents in the nodes and elements of more complex circuits that require extensive mathematical analysis.


Bibliography:

  • Irwin, J. David. Basic Engineering Circuit Analysis. 4th Ed. Macmillan Publishing Company. New York, NewYork. 1990.
  • Rashid, Muhammad H. SPICE for Circuits and Electronics using PSPICE. 2nd Ed. Simon and Schuster Company. Englewood Cliffs, New Jersey. 1995.


    Return to the Academic Works Page

    Laura A. Knauth's HompePage

    Send any comments or questions to email@lauraknauth.com