Electric Circuit I Lab Manual 4 Session # 5 Introduction to PSpice 1
PART A INTRODUCTION TO PSPICE Objective: The objective of this experiment is to be familiar with Pspice (learn how to connect circuits, do DC analysis). Introduction: SPICE is a powerful general purpose analog and mixed-mode 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. PSpice is a PC version of SPICE (which is currently available from OrCAD Corp. of Cadence Design Systems, Inc.). The PSpice Light version has the following limitations: circuits have a maximum of 64 nodes, 10 transistors and 2 operational amplifiers. SPICE can do several types of circuit analysis. Here are the most important ones: Non-linear DC analysis: calculates the DC transfer curve. Non-linear transient and Fourier analysis: calculates the voltage and current as a function of time when a large signal is applied; Fourier analysis gives the frequency spectrum. Linear AC Analysis: calculates the output as a function of frequency. A bode plot is generated. Noise analysis. Parametric analysis. Monte Carlo Analysis. 2
In addition, PSpice has analog and digital libraries of standard components (such as NAND, NOR, flip-flops, MUXs, FPGA, PLDs and many more digital components). This makes it a useful tool for a wide range of analog and digital applications. All analysis can be done at different temperatures. The default temperature is 300K. The circuit can contain the following components: Independent and dependent voltage and current sources Resistors Capacitors Inductors Mutual inductors Transmission lines Operational amplifiers Switches Diodes Bipolar transistors MOS transistors JFET MESFET Digital gates And other components (see users manual). PSpice with OrCAD Capture (release 9.2 Lite edition): Before one can start simulating a circuit you must go on through some steps: 3
The values of elements can be specified using scaling factors (upper or lower case) T or Tera (= 1E12); G or Giga (= E9); MEG or Mega (= E6); K or Kilo (= E3); M or Milli (= E-3); U or Micro (= E-6); N or Nano (= E-9); P or Pico (= E-12) F of Femto (= E-15) Types of Simulations: Pspice have four main types of simulation: 1. Bias Point analysis. 2. DC Analysis. 3. AC Analysis. 4. Time domain (transient). 4
Bias Point analysis Saves detailed bias point information to the simulation output file. The information reported to the output file includes the following: A list of all the analog node voltages. A list of all the digital node voltages. The currents through all the voltage sources, and their total power. A list of the small-signal parameters for all the devices. You can also view the result of this simulation by enabling the bias point display for voltage or current which are specified in Figure 2. DC analysis Performs a DC sweep. The DC sweep analysis calculates the circuit s bias point over a range of values. The results can be displayed on a graphical representation using the Voltage or Current Markers which are specified in Figure 2.In the graphical representation the X-axis is the voltage or current source that is specified in the simulation profile. AC analysis Calculates the small-signal frequency response of the circuit (linearized around the bias point) over a range of frequencies. The results can be displayed on a graphical representation using the Voltage or Current Markers which are specified in Figure 2. Transient analysis Calculates the behavior of the circuit over time. The results can be displayed on a graphical representation using the Voltage or Current Markers which are specified in Figure 2. 5
Figure 2 Procedures: Getting Started: To use the Orcad Pspice, the following steps must be followed: 1. Create a folder called your name for this Experiment in your Z drive. 2. Click start ->Programs ->Orcad->Capture CIS Lite Edition. 3. Click->File->New->Project. 4. Give the project a name and select Analog or Mixed A/D. You will also be prompted to enter the location you would like to create the file. Put it in your folder created above. Then click OK. This is shown in the following figure. 5. You will then be shown a screen which has two options. Choose the option which says Create a blank project. Then click OK. 6
7
6. Now you should be on a screen, as shown, which has grid dots located on it. If you do not see a tools box on the right hand side of the page then left click on the mouse and one should appear at this time. Experiment 1: DC Circuit of Independent Sources 1. Building the circuit: First of all, you have to build the following circuit shown in Figure 3. It is required to find the current in R1 and R2 and the voltage on the current source. Figure 3 8
1) First, to get the 2 resistors, you can either select the second box in the toolbar on the right or by clicking Place from the top of the screen followed by Part. Both these methods will lead to a screen, shown in Figure 4, where you will be prompted for the part name. 2) NOTE: There is a library box containing the libraries which hold the required parts. At this time, ensure that the two main libraries that you will be using are in this box. The two libraries are: a) Analog. b) Source. If these are not shown here, you must click Add library and these two libraries along with some others will appear. Click on the two libraries mentioned above from the shown Libraries in Figure 5. Figure 4 Figure 5 3) To get the resistors, ensure that you have highlighted Analog library as shown in Figure 6. Then, you can type R or r in the place part box and you should see a picture of a resistor in the graphic box. Click Ok. 9
Or, the resistance could also be obtained by scrolling to R in the "part list" and clicking "Ok". Figure 6 4) To place the resistor, drag it to the desired position and then left click the mouse. As shown in Figure 7, if more than one resistor is required, simply move the mouse (with the resistor symbol still attached) to the next resistor position and left click again. Once all required resistors are placed in this fashion, right click on the highlighted resistor and then End mode which is clear in Figure 7 in the highlighted menu. At this time it is important to note that Capacitors and Inductors also fall in the Analog library and are represented by C and L, respectively. 5) To rotate a part, click on the part to get it highlighted and then right click and hit rotate. A faster way though is by highlighting and typing CTRL R. 10
In this example, do this with resistor R2. Note the whole part, not just a label, must be highlighted. Figure 7 6) Both the voltage source and current source ( V DC and I DC, respectively) are located in the Source library. To place them, follow the same process as for the resistor (or capacitor or inductor). However, be sure that the Source library is highlighted in the place part box. Also, once the placement of each source is made, don't forget to "End Mode". 7) The next step is to wire the circuit. To get the wire, there are two places you can go. Either the third box on the Toolbar menu on the right or again in the Place -> Part ->Wire from the top of the screen. The first option is more convenient. 11
8) Once the wire box is activated by "left clicking the mouse" it is connected to a part on the schematic by left clicking on either end of the part and then moving the wire to wherever you would like it joined to. Note here that the wire may be changed from "side to side" to "up and down" by left clicking while moving the wire. As with all parts, to stop the wire function right click on the mouse and choose End Wire. 9) Once the wiring is complete, a ground must be added. The ground is found in the toolbar on the right where it says GND. When you click on it, a window named place ground will be opened. Press Add library tab, open PSpice folder, choose library named source. It will appear in the place ground window, choose the symbol named 0 and press OK. This will be the ground of your circuit. Place the ground in the desired position. The best place for this circuit is where it is shown on Figure 3. 10) Next, the value of each element in the circuit must be edited. Left click on the default value of any element and then right click->edit properties to get to the "Edit Properties" screen. Type the required value in the "Value" box. (Note that a "Display Properties" screen can also be reached by double left-clicking on the default value.) There are various options here for what may be displayed with the particular element. For now, use the default. The name of an element may be changed by double clicking on the name (e.g. R1) and editing as was done for the numerical "Value". Congratulations, you have just built your first circuit!! Now, save the schematic to your course directory. 12
2. Simulating the Circuit (Bias Point Simulation): 1) If all the previous steps have been properly followed, the circuit is now ready for simulation. Note: Before starting the simulation process, the values of voltage, current and power associated with each resistor should be hand-calculated so that they are used to check the PSpice results (for this initial circuit only). 2) Choose PSpice from the top toolbar and click New simulation Profile. Supply any convenient name when the prompt to do so appears. Then click Create. Now a screen appears which asks for the type of analysis. For this circuit, choose the Bias Point analysis by clicking the drop box and selecting Bias Point. Then click Ok. 3) The simulation is now ready to run. To do so, click PSpice->Run on the top tool bar. A few seconds will elapse while the netlist and output files are being generated. A simulation box, indicating that the simulation is complete should then appear. If there are errors associated with your circuit, the simulator will inform you if there are errors in the circuit at this phase and your circuit will not simulate properly. If no errors are reported, then close this screen to return to the schematic. 4) The voltages and currents in the circuit may be displayed on the schematic by clicking on the big V and big I in the top tool bar. There is also a W which will also show the power in watts. The currents and voltages may be verified against the hand calculations. Figure 9 shows the circuit after simulation with the voltages, currents, and power displayed. If 13
you press on the V, I and W buttons one more time, the values read will disappear. Figure 9 Note: There are quick buttons, in the upper toolbar, shown in the following figure, to be used for opening a new simulation profile (the left button) or editing the simulation profile (the middle one) or running the simulation (the right one). 3. DC Sweep: 1) For the same circuit, we will do a DC sweep which is used to calculate various currents or voltages over a certain range of values swept of a certain controlling device. 2) To change the type of simulation from DC bias point to DC sweep, open the PSpice tab in the upper tool bar and open Edit Simulation Profile. 3) Set the type of simulation to DC sweep. 4) Set primary sweep to voltage source. 5) Set voltage name to V1 which is the name of the voltage source in the circuit and set the start and end values and the increment 0, 10 and 1V as 14
shown in Figure 10 then press Ok. (i.e. This means that the component that we will sweep its values is V1 and the values range is from 0V to 10V with 1V as an increment). Figure 10 Simulation Settings 8) Run the simulation. 9) To view the output, put the voltage marker on the node on which you want to measure the voltage, or current marker on the branch in which you want to measure the current; the markers are placed at the upper toolbar. Or instead of the markers, after running the simulation, a black screen will be opened like the one shown below on the left, this is the output screen, you can add trace by opening the Trace tab in the upper toolbar of the window, and press add trace, the right side window shown will be opened, then you can choose which item to view as shown in the list in 15
Figure 11. We will choose the voltage on R 2, it will be as shown in Figure 12. Figure 11 Simulation Results. 16
Experiment 2: DC Circuit with Dependent Sources PSpice can be used to analyze circuits that contain dependent sources. The PSpice symbols used to represent dependent sources are Symbol Description PSpice Name Library F1 F CCCS (Current Controlled Current Source) F G1 + - G E1 + - E + - VCCS (Voltage Controlled Current Source) VCVS (Voltage Controlled Voltage Source) G E Analog Library H1 H + - CCVS (Current Controlled Voltage Source) H 1. Building the circuit: First of all, you have to build the following circuit shown in Figure 12. It is required to find currents in all branches and voltages on all nodes. Figure 13 shows the connected circuit on PSpice. Figure 12 17
R2 2 F1 R4 5 R1 1k F 10Vdc V1 R3 R5 3 6 Figure 13 Note: How to edit the dependent source gain: - Select the dependent source then right click on it. - From the list menu select Edit Part as shown in Fig. 14 Figure 14 18
- The dependent source will be opened alone in a new window - Select options from the top tool bar, then select part properties as in Fig. 15 - Change the gain to be 5 as shown in Fig. 16 and click ok. Figure 15 Figure 16 19
- Exit the file where the CCCS has been edited and select update current when you are asked the question about updating the source as shown in Fig.17 - The final step is to simulate the circuit shown in Fig. 18, using Bias point analysis. Exit here Update Current Figure 17 20
2.087A R2 2 5.825V R1 145.6mA 4 10.00V 5.243V 728.2mA R4 5 F1 6.359V 145.6mA 728.2mA -145.6mA-728.2mA F 5.243V 10Vdc V1 1.942A R3 3 873.8mA R5 6 2.816A 0V 0 Figure 18 21