The Simulation Program with Integrated Circuit Emphasis (SPICE) circuit simulation tool was first developed in the early 1970s. It was written in the FORTRAN programming language and was intended to support the early data entry methods of this period. SPICE was immediately valuable to allow circuit designers to analyze circuit systems, in particular as the complexity of circuits began to expand with the arrival of the first integrated circuits. It is certainly one of the most important tools in Electrical Engineering and is an example of one of the first tools for Computer Aided Design.
SPICE has evolved with many advances in numerical analysis methods for accurate and fast computation and has appeared in many commercial forms. SPICE has been ported to many platforms and the version that operates over the Windows operating system is PSpice.
The first SPICE users designed circuits with manual circuit drawing tools. Then, inspection of the circuit design was used to generate a text-based description of the circuit design. Even today this still occurs in certain special instances. However, the arrival of graphical drawing tools allows a circuit designer to directly draw circuit schematics using circuit design tools and then special “capture” tools operate to “capture” the schematic and generate the text-based description of the circuit design, automatically. The versions of PSpice available to us operate in this way.
This is a great advantage for the engineering design process – this provides the designer with the ability to focus directly on a visual description of their system and obtain circuit operation numerical and graphical results in an automatic, convenient process.
This Tutorial describes the development of two typical, simple circuits. The first is a circuit that will demonstrate the ability to quickly compute voltage and current values. The second will demonstrate the ability to compute time-dependent circuit response.
The SI062 laboratory PCs all carry an installation of PSpice 9.2 Lite.
If you wish to install this version of PSpice on your personal machine, you may
copy a free PSpice 9.2 Lite CD from your Outbox or ask Harvey for a CD.
You may also download the OrCAD 16.3 Demo Software (Capture and PSpice only) from Cadence.com (free account required): http://www.cadence.com/products/orcad/pages/downloads.aspx
You may use the SI062 PCs for your work. However, if you decide to install Orcad Family Release 9.2 Lite Edition software, then in the installation process you will be presented with options as to which components to install.
Ensure that you have selected to install Capture and PSpice. You may install other options in addition to these.
Now, we will first use PSpice to simulate the circuit of Instrumentation Amplifier, shown below.
Figure 1. - Instrumentation Amplifier schematic.
After installation, your Program folder should contain the PSpice software.
So, select Start > Programs > Orcad Family Release 9.2 Lite Edition
> Capture Lite Edition. This will launch the Capture application.
Your screen should appear as in Figure 1.1.
Figure 1.1.
Now, to begin, you must create a new Project. We will be engaged in Analog Design in this course. So, your new Project selection will be for a new Analog Design project.
Begin by selecting the File > New > Project menu. Your screen should appear as in Figure 1.2.
Figure 1.2.
This will launch the Project dialog. At this point, you must create a
directory for your new projects.
Here we have created a directory of C:/Temp in Figure 1.3.
Figure 1.3.
You should now configure the application so that an Analog or Mixed A/D
(analog or mixed analog and digital design) is selected. Also, you should
enter a Project Name. Please note carefully that the Analog or Mixed
A/D checkbox has been highlighted.
Now, upon confirming your selection by clicking on the OK button, another choice
will appear. This prompts you as to whether you would like to create a new
Project based on a previous Project.
For this case, select Create a blank project, as shown in
Figure 1.4. and then press the OK button.
Figure 1.4.
Now, this will bring up the Capture schematic graphics window, as in Figure 1.5. This will now allow you to actually draw a circuit with electronic components that can be individually adjusted for their properties. We are ready to begin designing.
Figure 1.5.
A very important point should be considered first: The PSpice system computes voltage values relative to a common potential (referred to as a “Ground” potential). Without a specification for this Ground potential, the circuit simulation may not proceed (the circuit simulation algorithm does not make assumptions as to what reference potential the designer has selected, instead, it must be informed in advance). In fact, the error condition resulting from a lack of Ground potential definition creates so-called “floating” nodes, simply circuit nodes that do not have a defined potential.
As you will see throughout engineering circuit design, the clear definition of reference potentials continue to be a challenge for all technologies in analog, digital, radio frequency design, and biomedical electronics. Many problems in system design have their origins in the difficult of establishing a common reference for measurement.
So, we will start by selecting a “Ground” potential point.
First, the Ground potential reference point is a circuit node or in the Place
menu. We want to “Place” this node in our circuit. So, you may reach this by
pointing to the Place menu or by pressing Place Ground button in
the right vertical menu, as in Figure 1.6.
Figure 1.6.
At this stage, we need to add Parts Libraries to our list of choices. You will need to perform this every time you log in on the SI062 lab computer in the future (but only once on your own computer). So, click on Add Libraries and inside of PSpice folder you could see the choices of Figure 1.7.
Figure 1.7.
You should select the source.olb library, as shown. Click Open. Now, select the 0/Source selection as in Figure 1.8.
Figure 1.8.
Then, click on OK and you will now find that there is a Ground symbol attached to your mouse cursor.Place this as shown in Figure 1.9. by clicking with the left mouse button. Then, press Esc button (or click with the right mouse button). If you are not careful here, you will accidentally create two ground terminals (any could to be deleted by right clicking on the part and deleting it) but we will need three of them
Figure 1.9.
To view the circuit more easily, click on View > Zoom > In.
Now, we will add a conductor (Wire) to our circuit. Again, proceed to the Place menu, select Wire, and this will now create a drawing tool. You may create the wire by placing the mouse cursor on the terminal at the top of the Ground symbol and then holding down the left mouse button while dragging the mouse cursor upwards (as you can see this is the standard Windows drawing paradigm so this will be familiar to you.) Press “Esc” when done. The circuit will now appear as in Figure 1.10.
Figure 1.10.
Now, we must start to add Resistor and Source components. To obtain and
“Place” these parts we again navigate to the Place menu. But, this time, click on
Part. This will bring up a Place Part dialog box.
At this stage, we need to add Parts Libraries to our list of choices. You will
need to perform this only once, in the future, the Libraries will appear by
default.
So, click on Add Libraries and you should see the choices of Figure 1.7.
Figure 1.11.
We need to add the following Libraries:
Now, we can add a Resistor to our circuit. Click on Place Part and then when the Place Part dialog box appears, highlight the ANALOG library in the Libraries box. This will bring up a list of parts in the Part List box. Now, scroll down to R (or type 'R' in the Part field) and click on this. You should see the dialog box of Figure 1.12.
Figure 1.12.
Click the OK button to select this and then you are ready to Place this part. Proceed to place this part as shown in Figure 13.
Figure 1.13.
At this stage you will add a Voltage Source. This will be a sine wave source
and will be labeled as VSIN by PSpice. So, proceed to the Place Part
menu to bring up the Place Part dialog.
Highlight the SOURCE Library and then VSIN as in Figure 1.14.
Figure 1.14.
Now, upon clicking OK, we are ready to place this source. Place two Voltage Sources and connect therminals of one of them to the junction of the Resistors (R1 and R2) and Ground Wire as in Figure 1.15.
.Figure 1.15.
You will then be able to drag the “V1” lable to the left and change its
name to “V_noise” by double-clicking on the lable and type new name in the
“Value” field.
You will also change default values of the “VOFF”, “VAMPL” and “FREQ”
properties by double-clicking on them to the values shown on Figure 1.16.
Figure 1.16.
When we enter device property values into PSpice configuration settings or directly into SPICE code, we generally use a scientific notation for number entry that includes a scale factor equal to a power of 10. The Appendix at the end of this document describes the SPICE and PSpice Units of Measure as well as the scale factor conventions. It is important to read this very carefully. Frequent errors in SPICE and PSpice simulation result from a confusion over entry of a proper scale factor.
Do the same to the another Voltage Source. To rotate the part, select it and choose Rotate option from the right-click menu (Clrl+R is a chortcut for rotation).
Figure 1.17.
Place two generic Op-Amps from the ANALOG library (OPAMP) and a variable resistor (POT) from the BREAKOUT library into your design. You also will need to put more resistors to your design.
Figure 1.18.
Note that terminal “1” of the POT is on the top of the part. To accomplish
this you could use a “Mirror Vertically” option from the right-click menu.
Change default values of resistors R4 and R5 by double-clicking on the resistor
values. Wire them as shown in Figure 1.19.
Figure 1.19.
We now want to change settings of the POT. So, double-click on the Part. This will bring up the Property Editor, as shown in Figure 20.
Figure 1.20.
Find the “SET” property and change its value to “0.8”. Also, press the
“Display” button on the top and choose “Name and Value” option in the “Display
Format” box.
Figure 1.21.
Now, it is important to click on Apply at this stage to set the value. Now, return to the SchematicFigure 1.22.
Complete the rest of the circuit. You will need to place a “real” LM324 Op-Amp from the EVAL library. Change Part to “C” in the Packaging area of the Place Part window or do it later from the Property Editor.
Figure 1.23.
You will need four more 100K resistors and one more POT (Mirrored Vertically). Change POT's “SIZE” and “SET” parameters in the Property Editor.
Figure 1.24.
The last part of your design ia a power supply for the LM324 Op-Amp. You will need +12V and -12V DC battaries, connected to the power terminals of Op-Amp.
Figure 1.25.
Place two of them into design, change values to 12Vdc. From the Place Net Alias button in the Place menu, name the battery ends and the ends of Op-Amp's power terminals as shown on the next figure. Name the output from the LM324 part as V_IA_Out.
Figure 1.26.
If the names of two wires the same then they connected together. This is another way to connect components.
Now, you have the circuit from Figure 1. ready for simulation.
Now, with our circuit complete, we are ready to start a Simulation. First, you need to choose a place (or places) where PSpace will look for results.
Place a Voltage probe by choosing the Voltage/Level Marker button from the Simulation menu and put it on the output wire of LM324 Op-Amp.
Figure 2.1.
Proceed to the Simulation menu and click on the New Simulation Profile button, type a simulation name and press Create.
Figure 2.2.
You will see a Simulation Settings window.
Figure 2.3.
Just press OK for now.
You are ready to run the simulation and observe results at the point where
Voltage probe connected to. So, press Run PSpice button in the
Simulation menu. You should see a resulting window like this:
Figure 2.4.
How you see, the simulation produces only 1us of simulation, but you need
at least 5ms for one cycle of 200Hz source.
Press the Edit Simulation settings button in the Simulation menu and
change Run to time parameter into 25ms. Press Apply and OK.
You should see a result like on figure below.
Figure 2.5.
To add more simulating resolution you could change Maximum step size properties of the Simulation settings into 300us.
Figure 2.6.
Before we proceed, however, we will discuss the units of measure that SPICE expects and will interpret from our input.
As you will see, device property values in SPICE components are entered as an integer or real number, followed by a case-insensitive scale factor. For example, 1,000 Ohms may be entered as 1000, 1k, or 1K, where K is a scale factor equal to 103. For another example, 1,263,345 Ohms may be entered as 1.263345 meg, 1.263345 MEG, or 1263.345K, where MEG is a scale factor equal to 106.
If no scale factor is supplied then SPICE interprets the scale factor to be unity. Thus, if we enter 5 for a Resistor value, this will be interpreted as 5 Ohms.
The units for calculation and measurement are:
1. Resistor: | Ohm |
2. Capacitor: | Farad |
3. Inductor: | Henry |
4. Potential: | Volt |
5. Current: | Ampere |
The scale factors are:
Scale Factor Term | Numerical Factor | Upper Case PSpice Factor |
Lower Case PSpice Factor |
---|---|---|---|
Tera | 1012 | T | t |
Giga | 109 | G | g |
Mega | 106 | MEG | meg |
Kilo | 103 | K | k |
Unity | - | - | - |
Milli | 10-3 | M | m |
Micro | 10-6 | U | u |
Nano | 10-9 | N | n |
Pico | 10-12 | P | p |
Femto | 10-15 | F | f |
Now, it is important to note that confusion can easily lead to very large errors. For example, it may be tempting to write 1 Farad as 1 F. However, this is interpreted as 1 femtoFarad and an error of 15 orders-of-magnitude will result!
Also, it is common error to use “M” or “m” to denote 1 Million, by accident. However, this is interpreted as a scale factor of Milli or 10-3, an error of 9 orders-of-magnitude!.
It is essential to carefully review and follow the scale factor rules. They will become familiar soon.
Return to the text.