You are on page 1of 7

1

CIRCUIT ANALYSIS AND DESIGN USING PSPICE



Introduction

Computers have revolutionised many aspects of engineering. One particular area of direct
interest to us is the availability of software packages that can simulate the behaviour of a wide
variety of electrical circuits. This handout and the laboratory are designed to introduce you to an
industry standard package called PSpice. The reasons for doing this are:

1) To allow you to visualise more clearly some of the theoretical work in the lecture
course, specifically transient analysis.

2) To make PSpice available to you to use whenever you feel that it may be helpful as a
learning aid. That is, not only for this and other specific exercises, but also in other
courses.

PSpice is available on the Schools network and furthermore, you can download your own free
copy from the Schools WebPages.

Important notes

1) The laboratory requires preparation before attending the timetabled laboratory session. You
will also need to process your results after the laboratory session is over. You will not have
sufficient time in the lab if you attempt it "cold".

2) In the text below, preparatory work to be done before the lab is indicated by and results and
discussions required in the write up by .

3) Throughout the text, shaded boxes provide further information about "driving" PSpice a bit
more efficiently. These are not essential, but if you adopt their advice you will minimise some of
the hassle involved!

4) There are two parts to this handout. The first is for you to familiarise yourself with the
software if you choose to and use it yourself. For instance, why not put some of the example
sheet circuits in to confirm your results! You will also find this facility helpful in other courses
as PSpice provides a wide range of practical electronic components ( eg diodes, transistors,
analogue and digital integrated circuits - chips)
Getting started with the PSpice package

The simulation package actually consists of three separate programs.

PSCHED.EXE.lnk Pspice.exe Probe.exe

Psched.exe allows us to enter the circuit diagram whose performance we whish to examine.
It also allows us to define what sort of tests we want to do.
PSpice.exe which checks the circuit for inconsistencies and then does the required analysis

Probe.exe which you could think of as a sort of oscilloscope, it draws graphs of any
quantity you want once the analysis has been done.

To start the schematic editor, double click on the "Psched" icon, you should then have an empty
schematic in front of you ( it has a grid of dots on it!). The next thing to do to avoid losing your
work later on is to save this schematic by selecting "saveas" from the "file" menu. In the box
labelled file name enter C:\user\name.sch and click on "OK". (You can choose the "name" as you
like but do include the .sch after it.)

To build up a circuit, we select components from a library, placing them as desired, then wire up
the circuit and finally select some points where we wish to observe the voltages etc.

Circuit 1


Consider circuit 1. To obtain the capacitor, select "get new part" from the "draw" menu. You are
now prompted to enter the part name, in this case c for capacitor and then click on "OK". The
cursor should have become a capacitor, which you can move about with the mouse. Clicking the
mouse will cause a capacitor to be placed at the point where the cursor is. You can deposit any

2
number of capacitors by just clicking with the cursor in the desired place. A word of warning, if
you double click the mouse, you may deposit 2 capacitors at the same point, which behave as if
they are electrically in parallel! As this is not visually obvious, it can be a real pain to find this
fault when the circuit doesn't behave as expected. When you have finished depositing capacitors,
the "esc" key will return the cursor to normal. To move one of the capacitors, click on it, it
should change colour, you can now "drag" it by placing the mouse on the selected component,
holding down the mouse button and moving the mouse to the new position, at which you "drop"
it by releasing the mouse button. To rotate the capacitor to the vertical, click on it to select it and
the click on "rotate" under the "edit" menu.

The above capacitors are given the default value of 1nF. To change this double click on the
capacitor and in the "value" box enter 1u. (u is recognised as micro). Now click on "save attr" to
save this change. Next, click on OK. If rather than double clicking on the capacitor, you double
click on its value, you will be prompted just to enter the value. Similarly, double clicking on the
label with the capacitor will allow you to change this as well.

Now repeat this procedure to place a resistor, (part name r) of value 1k as shown in circuit 1.

Now, we need to designate a "ground", i.e. a 0 volt point. Do this by selecting a component
called agnd and placing as in figure 1.

Finally, we need to obtain a voltage source. This is called vsrc, place and wire it into the circuit.
This supply can provide a range of simple voltage waveforms. We want a simple 1VDC value
(or more precisely a step at time=0 seconds from 0V to 1V). Double click on the voltage source,
select "DC=" from the list of parameters and in the value box enter 1V, followed by "save attr"
and "OK".

We now need to "wire up" the circuit. To do this, select "wire" from the "draw" menu. Clicking
(not holding the button down) and then moving the mouse and clicking again will draw a wire
between two points. You can change direction at any point by clicking the mouse and then
moving the cursor. If you hit "esc", wiring will stop (deleting the dashed part of the wire which
has yet to be fixed by a click!). Wire up circuit 1.

3

Do not wire over components they will be shorted out, and again this is not visually obvious
and is a pain to fault find!

To delete either a component or a piece of wire, select it with a click and press "delete"

The drawing "snaps" to the grid indicated by the background dots so it is clear if a wire is or is
not joining a component. Note that if you delete parts, adjacent bits may appear to be partially
deleted. This is only on the screen which can be refreshed using "control" and the letter l at
the same time.









You will notice that many of the menu commands have short cuts, remembering these will
save time, for example "get part" is control G, "wire" is control W.


We now have the circuit completed. What we want to do is to observe the capacitor voltage
versus time from the moment of "switch on" at time=0 seconds. As you find out later, PSpice can
do a variety of analyses on the circuit so we need to tell it which we want. Select "setup" from
the "analysis menu". Click on the small square box next to the "transient" button to enable a
transient analysis, i.e. versus time, which is then indicated by a cross in the square box. Disable,
by clicking on the appropriate small square boxes, any others that are enabled by default. Now
click on the transient button itself and set the "print step" to 1us. This tells it to store the voltages
and currents every 1us. Set the "final time" to 5ms and the "step ceiling" to 1us. The latter tells it
not to take bigger time steps than 1us during its calculation. Finally, click on the small box next
to "use init conditions", to tell it that initial conditions are being given for relevant components.
Click on "OK". Now one technical thing we must do. Click on the options button and move
down the right hand list until you find RELTOL=0.001, (this tells the software how accurately
we want it to solve the problem!). Click on it and in the box marked new value enter 0.0001 and
click on accept. Now click on OK and "close" the analysis setup window. So let us give it
the initial conditions we said we would, in this case the only possible one is the initial voltage on
the capacitor. Double click on the capacitor and set the "IC=" value to 0V, click on "save attr"
and "ok".

We are now ready to do the simulation. Select "simulate" from the "analysis" window. The
simulator program will start up as a window and, if all has been setup correctly, do the
simulation. Upon completion, it automatically starts up the plotting program called probe, (if this
does not occur, select run probe from the analysis window). You should have an empty graph
on the screen. We can now add on graphs (traces) of any circuit quantity we want to see. Select
"add" from the "trace" menu and double click on V(C1:2). This is the (V)oltage on component
C1, pin 2. You should see the expected charge up curve, passing through about 0.865V at 2ms.
Now add another trace, the current through R1, ie I(R1). Because it is much smaller than the
capacitor voltage it will appear as zero, so delete the former by clicking on its label under the
graph and hitting delete. The graph will rescale to show the current more clearly. Confirm this is
behaving as you would expect!

4
To simultaneously display two quantities with greatly different magnitudes such as V(C1:2) and
I(R1) above we can actually define two different y axis scales. For example, delete all the traces
and then add on the trace of V(C1:2) as before. Now select add Y axis from the Plot menu
and an extra y-axis will appear. Now add on the I(R1) trace, the new y-axis will automatically
scale to show this clearly.

Another possibility is to have two simultaneous plots. For example clear the traces and add on
the V(C1:2) trace as usual. Now select add plot from the plot menu and a new graph will
appear. The next trace you select, e.g. I(R1), will be placed on the new graph.













With the above component values derive equations for the expected capacitor voltage and
resistor current versus time for circuit 1 with a 1V step voltage applied.

If you wish to use PSpice to try out the DC problems on the example sheets, then this can be
done exactly as weve done here except that when you set up the transient analysis do not
select use initial conditions

Now we are going to use the package to obtain the frequency response of the circuit, that is we
will change the DC step voltage to a 1V variable frequency AC one and investigate how the
magnitude of the capacitor voltage changes with frequency. To do this, return to the schematic
(there is no need to close either the probe or PSpice programs, hit control and esc together to get
a list of the programs which are currently running). Double click on the voltage supply and set
the "AC=" value to 1V. Now select "setup" from the "analysis" menu, disable the transient
analysis, and enable the AC sweep. Click on the AC sweep button. Enter "tot pts" as 101, "start
freq" as 10 and "end freq" as 10k. Now set the "AC sweep type" to "decade". Click on "OK" and
close the setup window. Re-run the simulation. (If you kept probe open it will warn about losing
data - this is OK). Within probe, examine the capacitor voltage, noting that it will automatically
be displayed with a logarithmic x-axis and a linear y-axis. By selecting "y axis settings" from the
"plot" menu, change the y-axis scale to a logarithmic one.

Sketch the capacitor voltage versus frequency using log scales.
Above what frequency is the capacitor (output) voltage at least 3dB less than the source
(input) voltage
Derive a theoretical equation that confirms the sketch showing the working. (Obviously, we
expect to use phasor analysis, as this is a steady state sinusoidal analysis).
From the theory, determine a value for the capacitor such that at 100Hz the capacitor
(output) voltage is at least 3dB less than the source (input) voltage. Keep the resistor value as
1k. Confirm this using PSpice.

So we now have a grasp of the simulation package, as you can see there are a myriad of other
options but now we will use what we have to do some investigation. So far, all the examples
examined have been straightforward to analyse by hand, but let us push on to the point where the
package does the "leg work" for us - albeit based on our initial designs.

5

You may be interested to "browse" through the available parts, which include diodes,
transistors, integrated circuits - and this is an educational version not the full one!
However, don't waste time in the lab doing this!!




Exercise 2


Fig 2

Construct circuit 2 shown in the figure. The part name for an inductor is l. Using the same unit
amplitude step voltage source and transient analysis parameters as for exercise 1 except for the
final time which should be set to 20ms, perform a transient analysis of the circuit with L=2mH
and examine the capacitor voltage. You should observe that the capacitor voltage consists of a
sinusoid oscillating about 1V and of peak 1V.

Explain how it is possible for the magnitude of the capacitor voltage to exceed that of the 1V
supply!

Check the circuit current; this should also be sinusoidal but centred on 0A and with a peak value
of 22mA. Confirm that the frequency of both the capacitor voltage and the current are the same.
How does this frequency depend upon L and C? To examine this we will fix C, vary L, and
record the frequency although in practice this is not so easy to measure off the screen.
Fortunately, PSpice provides a "frequency analyser", that is it will examine the transient response
and show the frequencies present. To get this feature select "x axis options" from the "plot" menu
in probe and select "Fourier" from "processing options". Note that the graph changes displaying
frequency logarithmically as the x-axis. Rescale the x-axis by again selecting "x axis options"
and change the "data range to 0 to 5k". You should see two peaks, one at 0Hz, and the other at a
higher frequency. Note down this higher frequency (the amplitude isn't important to us yet).

6

Taking exact measurements off a graph is most easily done using the curser, which is
turned on by selecting "display cursor" from the "tools" menu. This gives a crosswire
display that can be moved to any point on the first trace being displayed by holding down
the left mouse button. (a second one works on the right mouse button). A small widow
gives the coordinates of the two crosswires as well as the difference between them. You
will notice that under the cursor menu, there are options like "min" and "max" which send
the cursor to the min and max points on the curve - this will be handy later!








Using this procedure, tabulate the peak capacitor voltage and the frequency of oscillation, for
L=0.5, 1.0, 1.5 and 2.0mH. Plot a graph with logarithmic scales of frequency against L and hence
determine and state the relationship between them. You will recall that if we have a relationship
of the form y=Ax
n
between y and x where A and n are constants, that taking logarithms gives
log(y) = log(A) + n log(x). Thus if we plot log(y) against log(x) and get a straight line then the
gradient of the line is n!

7

If you are varying a component value, analysing and then looking at the same quantity, it is
a pain to keep adding on the same trace in probe. If you click on "probe setup" under the
"analysis" menu of the schematic editor, you can set "at probe startup" to "restore last
session" which means it will replot the previously selected quantities with the new results.






Exercise 3



Now construct circuit 3. The role of the resistor is to add "damping". The voltage supply is the
same used for exercise 1. Perform a transient analysis for R in the range 10 to 100 in steps of
10.

Plot the peak capacitor voltage and the peak circuit current and also the time after which the
capacitor voltage is within 1% of its steady state value (1V) against R. Comment!

Now perform an ac sweep analysis for R=10, 30, 60 and 90 .

Sketch on the same graph the frequency response for the different R. Comment!

Determine from first principles the differential equation satisfied by the capacitor voltage

You might also like