DOC

Notes for ORCAD PSpice

By Kenneth Patterson,2014-05-27 20:04
11 views 0
Notes for ORCAD PSpice

    Notes for ORCAD PSpice

    ECE 65

    Created by: Kristi Tsukida (Spring 2006)

    Edited by: Eldridge Alcantara (Winter 2007)

1 OVERVIEW

    This tutorial will teach you all you need to know about PSpice for ECE 65. You will learn how

    to do the following:

    Start a Project ; Draw a schematic ; Simulate circuit ; Graph data

Each part will be discussed in more detail in the next four sections

2 STARTING A PROJECT

    1) Open OrCAD Capture

    2) Go to File => New => Project…

    3) Enter a name (i.e. Ece65_Kristi_Lab1)

    4) Choose "Analog or Mixed A/D"

    5) Set the location. (You should create a new directory for your project since PSpice will

    generate a bunch of project files in this folder.)

    6) Click OK

    7) Choose "Create blank project" and click OK

    8) You should now see a window where you can draw the schematic (i.e., your circuit diagram).

3 DRAWING A SCHEMATIC

    3.1 Summary of PSpice Parts for ECE 65

    PART PART NAME PICTURE NOTES DC Source VDC / Source

    AC Source VAC / SOURCE

    See Section 4.6 for Sine Wave Source VSIN / SOURCE more instructions

    Triangle Wave Source See Section 4.7 for VPULSE / SOURCE Square Wave Source more instructions

    Ground 0 / SOURCE

    Resistor R / ANALOG

    Capacitor C / ANALOG

    Inductor L / ANALOG

    See Section 6.1 for 741 OpAmp uA741 / EVAL more instructions

    Diode D1N4148 / EVAL

    See Section 6.2 for Zener Diode D1N5232 / EVAL more instructions

    npn BJT Q2N3904 / BIPOLAR

3.2 What your Schematic Needs

    All schematics you draw on PSpice will need the following: a voltage source, components, wires, and a ground. The next couple of sections will instruct you on how to draw a full circuit.

3.3 Adding Parts to your Circuit

    1) Go to Place => Parts

    2) Click on the library you want to use, or select multiple libraries by holding Ctrl or dragging the mouse. In the parts window you should see at least the ANALOG, BIPOLAR, EVAL, SOURCE, and SPECIAL libraries. If you don't see these libraries already listed, you will need to add them:

    a. Click Add Library…

    b. Navigate to C:\Program Files\OrCad_Demo\Capture\Library\Pspice (This is the location in

    the PSpice lab computers. The location may be different if you install PSpice on your own

    computer, but find the ...\Capture\Library\Pspice folder)

    c. Highlight all the *.olb files in this folder. You can hold Ctrl and click on the files, or drag

    the mouse to select multiple files.

    d. Click Open. You should now see a list of libraries in the "Libraries:" section. 3) Find the part you want to add and press OK.

    4) Click where you want to place the part on your schematic. (Press R to rotate the part by 90 degrees)

    5) When you are finished with the part, right click and select End Mode to return to the pointer.

3.4 Using Wires

    1) Select Parts => Wire. The pointer changes to a cross-hair.

    2) Drag cursor from one connection point to another. Clicking on any valid connection will end the wire.

    3) Continue connecting the rest of the circuit.

    4) When you are finished, right click the mouse and select End Wire to return to the pointer. An example circuit from Lab 1 is shown below.

3.5 Adding a Ground

    There are many types of grounds (common points in the circuit, noise reduction, etc.) PSpice uses node-voltage method for circuit simulation and, therefore, needs a reference node with “zero voltage”. This is the 0/source ground. You need to have it in your circuits! (It looks like a

    ground symbol with a zero.) If you don't, PSpice may complain of "floating nodes" even if you have a ground.

To place the ground on the circuit:

    1) Go to Place => Ground. The ground you want to use is either listed as 0 or 0/source.

     If you don't see the 0/source ground, you will need to add the "source" library:

    a. Click Add Library…

    b. Navigate to C:\Program Files\OrCad_Demo\Capture\Library\Pspice (This is the location in

    the PSpice lab computers. The location may be different if you install PSpice on your own

    computer, but find the ...\Capture\Library\Pspice folder)

    c. Highlight source.olb.

    d. Click Open. You should now see the “source” library and the 0/source ground.

    2) Connect the ground to your circuit.

3.6 Changing the Value of a Part

    For the parts above, V2 and R4 are the names of the components, while 0Vdc and 1k are the values. To change a part’s value, double-click the value of the part. A new window will pop up where you can type in the value you want.

     Special Characters Meaning Example What to Type -3M milli (10) 10 mH 10m 3K kilo (10) 1 kΩ 1k 6MEG mega (10) 10 MΩ 10MEG

3.7 Other Notes

1) All parts must have unique names. You can't have two parts named "R1" in your circuit. If

    you are copying and pasting parts or circuits from another project, you will need to rename your parts because PSpice doesn't do this automatically.

    2) Labeling Nodes. I recommend you use aliases to label your input and output nodes. This makes your node easier to find when you start plotting out your data. V(Vout) is simpler than finding V(R1:1)

    a. Go to Place => Net Alias

    b. Enter a name, i.e., Vout or Vin

    c. Place the label on the wire connected to the node.

    An example of labeling from Lab 1 is shown on the next page.

4 SIMULATING YOUR CIRCUIT

4.1 General Instructions

    1) Go to PSpice => New Simulation Profile. Or if you already have a profile and would like to edit it, go to Edit Simulation Profile

    2) Choose the analysis type from the drop down menu.

    3) Adjust the settings on the right hand side. More instructions are given in the next four sections.

    4) Press OK.

    5) Go PSpice => Run. Or press the play button.

    6) A new window (the simulation window) will pop up. Any errors from your circuit will be displayed on the bottom left text window. Fix those errors before you continue. If there are no errors, you are now ready to do one of two things: plot data on the simulation window or display the DC calculations on your schematic.

4.2 Bias Point (DC Calculations)

    1) Analysis Type: Bias Point

    2) Options: General Settings

    3) Output File Options: None

    Press OK and then simulate your circuit. To display DC bias voltages and currents on your circuit after you run the simulation, go to PSpice => Bias Points, and check Enable, Enable Bias Current Display, and/or Enable Bias Voltage Display. You should now see values on your circuit representing current and/or voltage.

4.3 DC Sweep

    1) Analysis type: DC Sweep

    2) Options: Primary Sweep

    3) Sweep Variable: Voltage Source

    4) Type in the name of the source you are sweeping.

    5) Sweep Type:

    a. Select Linear if you are sweeping through a range of values

    b. Select Value List if you are sweeping through a select number of values and want to create

    a family of curves (like in Lab #3). For the list you type in, make sure to separate each value

    with a space and not a comma (1k 2k 3k, not 1k, 2k, 3k).

    Once you have set up the Sweep Type, press OK and then simulate your circuit. The simulation window should now include a place for you to plot your data. See Section 5.

4.4 Parametric Sweep

    You will need to make the following changes to your circuit first:

    1) Change the value of the part (not the name!) to {RL} (use curly braces, name is arbitrary) 2) Go to Place => Part

    3) Add the part PARAM/SPECIAL to your schematic

    4) Double click on the PARAM part

    5) Click "New Column..."

    6) Set the name to RL (same name as in “a” but with no curly braces)

    7) Set the value to something, e.g., 1k (this is the value that is used in calculating DC bias values, choose somewhere in the range of your sweep).

    8) Select the RL column (do not double click!) so that it is highlighted and then click Display... 9) Select "Name and Value" and press OK.

    10) An example schematic from Lab 1 is shown below:

Simulation Settings:

    1) Analysis type: DC Sweep

    2) Options: Primary Sweep (not Parametric Sweep!)

    3) Sweep variable: Global parameter

    4) Parameter name: RL (or name of the parameter you used without curly braces) 5) Set up the sweep type how you want. (Note that if you are sweeping resistance, you can't start at 0.)

    Press OK and simulate. The simulation window should now include a place for you to plot your data. See Section 5.

4.5 AC Sweep (Frequency Domain Simulation)

    1) Set up your circuit with VAC voltage sources.

    2) Go to PSpice => New or Edit Simulation Profile

    3) Analysis Type: AC Sweep/Noise

    4) Sweep Type: choose logarithmic and decade. Then select the frequency range of interest. Don't start frequency sweeps at 0!

    5) Set the Points/Decade to be at least 20.

    Press OK and simulate. The simulation window should now include a place for you to plot your data. See Section 5.

4.6 Transient Analysis (Time Domain Simulation)

    1) For a sine wave, use VSIN for your voltage source instead of VAC (VOFF is the DC offset, VAMPL is the amplitude, and FREQ is the frequency of the sine wave).

2) For a square or triangular wave, use VPULSE (Set delay time, TD = 0, for simulations in

    ECE65).

    a. Square Wave is the VPLUSE function in the limit of TR = TF = 0 and PW = 0.5 * PER (PER is the period of the wave). This limit case, however, causes numerical difficulties in calculations. In any case, we can never make such a square function in practice. In reality, square waves have very small TR and TF. Typically, we use a symmetric function, i.e., we set TR = TF and PW = 0.5 * PER - 2 * TR. Thus, for a given frequency we can set up the square function if we choose TR. If we choose TR too large, the function does not look like a square wave. If we choose TR too small, the program will take a long time to simulate the circuit and for TR smaller than a certain value, the simulation will not converge numerically. A good choice for TR is to set it to be 1% of the PER (a period): TR = TF = 0.01 * PER, PW = 0.48 * PER. This usually results in a nice signal without a huge amount of computational need. Note that TR does not have to be exactly 1% of PER. You can choose nice round numbers for TR, TF, and PW.

    b. Triangular Wave is the VPLUSE function in the limit of TR = TF = 0.5* PER and PW = 0 (convince yourself that this is the case). As before, the limit case of PW = 0 causes numerical difficulties in calculations. So we have to choose PW to be a reasonably small value. A good choice for PW is to be set at 1% of the PER (period): PW = 0.01* PER, TR = TF = 0.49 * PER (and not TR = TF = 0.495 * PER so that we get a symmetric function). This usually results in a nice signal without a huge amount of computational need. Again, note that PW does not have to be exactly 1% of PER. You can choose nice round numbers for TR, TF, and PW.

3) Simulation settings:

    a. Analysis Type: Time Domain (Transient)

    b. Options: General Settings

    c. Enter a Run to time so that a few periods will be displayed. Remember that the period (seconds) = 1/frequency (Hz), i.,e, if you are using a 1kHz sine wave, it has a 1/1kHz=1ms period, so use a Run to time of 5ms for 5 periods

    d. Set the Maximum step size to be much smaller than the period. i.,e, for a 1kHz sine wave:

    It has a 1ms period, so set a maximum step size of approx .01ms. (This works out to 100 data points per period). If you don't set the maximum step size, PSpice may choose one which is too big, making your sine wave look angular and ugly.

    Press OK and simulate. The simulation window should now include a place for you to plot your data. See Section 5.

5 GRAPHING IN PSPICE

5.1 General Instructions

    On the simulation window,

    1) Go to Trace => Add Trace

    2) Select the variable you want to plot on the y-axis. Or type in an expression on the Trace Expression prompt at the bottom of the window. Press OK

    3) To mark points:

    a. Click the "Toggle Cursor" button. (Or go through the menu, Trace => Cursor =>

    Display.) You will now be able to move the cursor along your plot.

    b. Click the "Mark Label" button to label that point. (Or go through the menu, Plot =>

    Label => Mark.)

5.2 How to Change the x-Axis Variable

    You can change the axis variable on your plot from, for example, resistance to voltage like in Lab 1 without adjusting the simulation settings. Here is how:

    1) Double click the x-axis.

    2) Select the x-axis tab.

    3) Click Axis Variable…

    4) Select new variable and press OK.

5.3 Bode Plots

    1) For the magnitude plot, use the PSpice DB() function to convert the transfer function to decibels. For example, you could type in DB(V(Vout)/V(Vin)) as your Trace Expression,

    assuming you have labeled your output and input nodes with "Vout" and "Vin" aliases. Note that DB(Vout) is NOT the transfer function in dB.

    2) For the phase plot, use the PSpice P() function to get the phase angle. For example, P(V(Vout)/V(Vin)).

    3) Be sure to mark the cutoff points on your bode plots (on both magnitude AND phase graphs). 4) To find the cutoff frequency on the magnitude plot, remember the cutoff frequency is 3dB below the highest point (NOT always at -3dB). Here are some instructions on how to label the cutoff frequencies.

    a. Click the "Toggle Cursor" button. (Or go through the menu, Trace => Cursor =>

    Display.)

    b. Click the "Cursor Max" button to find the highest point. (Or go through the menu,

    Trace => Cursor => Max.)

    c. Click the "Mark Label" button to label the max point. (Or go through the menu, Plot

    => Label => Mark.) This point is the center frequency f for a bandpass filter. o

    d. Click the "Cursor Search" button (Or go through the menu, Trace => Cursor

    =>Search Commands…)

Report this document

For any questions or suggestions please email
cust-service@docsford.com