PSpice AC Sweep Example Getting started 1. Start the Orcad schematic capture program 2. Start a new project (or open an existing one) (File → New) 3. Save the new project as rc_tutorial or some other name. (File → Save as.. → Type "rc_tutorial" → Click "Save") 4. For this simulation, we will be using the default libraries, so there will be no need to upload a library package. 5. A drawing window will open. Placing parts, editing parts, and wiring the circuit 1. The Part Browser There are several different ways to select and enter a part. First, open the part browser by selecting Place → Part… from the menu bar. You may also select a part from the schematic page editor tool bar. It has both electrical tools (in the upper section) and drawing tools (in the lower section). The drawing tools are also found on the part editor tool palette. The Schematic page editor toolbar with button names is shown on the right. You can place the toolbar anywhere on the screen, or dock it on any side of the session frame. You can also resize the tool palette when it isn't docked. When you move the pointer over a button on the tool palette, Capture displays the name of the button. You should now see the Place Part dialog box. To select a part, you must make sure the desired library is selected in the Libraries section. To add a library, Click on the Add Library button and select it from the list. To show all components, highlight all the libraries in the Libraries section. The components will be listed in alphabetical order. Components whose name begins with a number are listed before alphabetical components. To select a component, you can either scroll through the list of parts, which is located on the right side of the browser, or you Page 1 PSpice AC Sweep Example can just type the name or part of the name in the Part section of the dialog box. When you type the first letter, the list immediately scrolls to the first item with that letter. You may continue to type of you may scroll. To place a voltage source type V . The list of components for all 2. To place the voltage source, Click on the Get Part button installed part libraries opens in alphabetical order. Voltages are listed beginning with V. There are two AC sinusoidal sources. The components and their names are in the following graphic. 3. Place other components Now add a resistor and a capacitor using the same method to pick and place the parts. 4. Wire the parts together Use the wire tool to connect the parts. Just like with the part browser, there are several different methods to select the wire tool. The simplest is to simply click on the Wire icon. After obtaining the wire tool, begin drawing the wire using the left mouse button. With a bit of practice you can manipulate the wire tool while dragging to get the bends where you want. Alternatively, you can do the wiring in a bit more controlled fashion by connecting the wire to one end of a part, dragging to where you want a corner located, clicking once to "tack down" the wire at that point, and continuing on in the same fashion until you reach the connection point on the other part. 5. Add the ground connection Every SPICE circuit needs a ground connection. To add a ground, select ground from the schematic page editor toolbar, or from Place → Ground, or CTRL-G. Whichever method you use, its name MUST be 0 (the number). The Place Ground dialog box is shown on the right. Select any ground from the list on the left. Before you click OK Select the Name Box and replace the text with the number 0. Page 2 PSpice AC Sweep Example 6. Changing parameters When the components were placed, the names and values were set to defaults. Generally, we need to use different component values, and we may wish to change the names. The schematic capture program provides two methods for changing the properties of components. For simple components (like resistors and capacitors) the name or value can be changed by double-clicking directly on either the name or the value and typing in the new value in the dialog box that opens. For this simple RC circuit, change the value of R1 to 10k and C1 to 10n. Change the name of the ac source to VS, and change the magnitude of the ac part to 1V. When we perform AC analysis, we usually desire a Bode Plot. If we use 1V for the source value, we will immediately get the voltage gain of the output on the probe output waveform. Since AV = VO/VIN, selecting 1V for the input gives the normalized gain. 7. PSpice has its own way of identifying nodes with numbers. This is often not very useful to us, and we can only see how it assigns the node numbers by looking at the netlist. It is more convenient to identify nodes with text labels. To do this, select the Text Button from the schematic page editor toolbar. Click on the schematic window and enter a name. Place the text anywhere on the node. In my drawing, I named the output node OUT. 8. Setting up the analysis Now that the circuit is completed, you are ready to tell PSPICE how to analyze the circuit. From the Menu, select PSpice New Simulation Profile. Give it any name you wish. A dialog box opens. From Analysis Type, Click on the down arrow and select AC Sweep/Noise. On the right, enter the desired values for Start Frequency (must be a positive integer greater of 1 or greater), the End Frequency, and the Points/Decade. Click OK. Next we need to identify the node(s) where I wish to observe the output. We can do this with markers from the PSpice Toolbar (shown below). Button 5 is voltage, 6 is current, and 7 is a voltage at one node with respect to a second node other than ground. For 7, you must place two markers. Page 3 PSpice AC Sweep Example We wish to obtain the gain in db, not as a ratio. As you perform the following, look at the above graphic. On the Menu, Click on: PSpice Markers ► Advanced ► dB Magnitude of Voltage Place the marker on the wire above C1. Your final circuit should be similar to the one on the right. 9. Running the analysis Start the simulation by Clicking on the ► button on the PSpice Toolbar, of from the menu PSpice Run. PSpice runs and generates a Probe Output. 10. We have much more output than we need. In the Probe window, Click on Plot Axis Settings. From the X Axis tab, Click on User Defined in the Data Range section. Change the to box to 10k Click on the Y Axis tab. Click on User Defined in the Data Range section. Change the from left box to -20 Page 4 PSpice AC Sweep Example Click on the X Grid tab. Click to remove the check in Automatic. On the top right, click to select 10 for the minor Intervals between Major. Click on OK The output of the probe window should look like the following graphic. Using cursors and Adding Text You can use cursors to help get detailed information from the probe output. Activate the cursors by clicking on the Cursor Toggle icon in probe. Place the mouse on the output waveform at -3. In the Probe Cursor box, the value on the left of A1 should be as close to -3.0000 as you can get it. The value immediately to the right is the gain in db. 3db is important to us because it is the critical or corner frequency, the value for which we usually design amplifiers or filters. 11. Parametric Sweep One of the more useful aspects of SPICE is the ability to run a number of variations on a basic circuit and compare the results by plotting them on the same graph. For our example it might be interesting to see how changing the resistor value affects the frequency response and make comparison. We may do this using the parametric sweep feature of PSpice. A parameter sweep allows you to specify a number of values for a particular parameter and then perform a complete analysis for each value. All of the data will then be available for plotting. Return to the Capture window to bring the schematic drawing to the front. Double-click on the resistor value and change the value from 10k to {RVAL}. (Make sure that you are changing the value and not the name, and make sure to use the curly braces. We need to add one more part to the schematic so that PSPICE can handle the parameter sweep properly. Click on the Place Part button on the Schematic page editor toolbar and select PARAM Page 5 PSpice AC Sweep Example Place PARAM anywhere. It is not attached to the schematic. Double Click on PARAM to open the property Editor. Click on New Column. A dialog box opens. Your display should be similar to the following graphic: In the Name box enter RVAL without the curly braces. In the value box, enter 10 K Click on OK. A column named RVAL was entered to the property editor and the value is directly below it. Click on the Display Button. Close the window. Your schematic should now have the PARAMETERS: and name and values displayed, and be similar to the graphic on the right. Click in PSpice → Edit Simulation Profile. Click in the box on the left of Parametric Sweep in the Options section of the dialog box. Click Global Parameter under Sweep Variable. In Sweep type, Click in value list and enter 1k 10k 100k with each value separated only by a space. Your entries should be similar to the graphic on the next page. Page 6 PSpice AC Sweep Example Run the simulation. If you modify the X Axis, Y Axis, and X Grid as described earlier, your output should be similar to the following: You now know how to perform AC analysis for a passive filter (an RC circuit). For active circuits, the gain will be positive. Page 7