IEEE PSpice – Transient Analysis Below is an amplifier in a feedback system that is expected to have a closed loop gain of -20. The circuit has a sinusoidal input with a DC offset of zero, an amplitude of 0.1 and a frequency of 1KHz. Net Aliases How to place a net alias: From the top menu: Place->Net alias OR from the side tool bar Place net alias ICON To create a more readable and less cluttered schematic we have named nets used net aliases. (This also helps with plotting) When nets have the same name they are considered to be connected. Here, for example, Vcc- on the opamp is assumed to be connected to Vcc- the -15 V DC voltage supply. We have also named ground the number zero. Placing Voltage/Current Markers How to place Voltage/Current Markers: From the top menu: Place->Marker->Voltage OR top toolbar ICON Placing a Voltage or Current Marker causes the voltage or current indicated to automatically be plotted after a simulation has run. Run PSpice Place Voltage and Current Markers (or Probes) ICONs Place net alias ICON Vsin Voltage Marker Placing parts (see next page) Placing parts How to place parts: From the top menu: Place->Part OR hotkey p After hitting hotkey p the pop-up menu shown below will appear. Here all libraries are selected (you can just select a subset of libraries). In the “parts list” the part is listed along with the library that it belongs to. It is important to add the part from the correct library. Otherwise it may not function as you intend. As you can see below there are multiple parts that are called R, and each is in a different library. To search through all libraries for your part. click on the menu where indicated and hit <ctrl> a Enter the name of the part that you wish to add by scrolling or typing it directly. Hit <OK> - this will close the menu Sometimes you will see a pop-up menu indicated that the part is not in the design cache. If you see this menu Hit <yes>. Move your cursor to where you want to place the part on your schematic. Click your mouse at the location You will continue to be able to place parts that are of the type that you selected. Hit <esc> to end the place part command. library part Click here and hit <ctrl>a to select all libraries Description DC voltage source Sinusoidal voltage source Resistor 741 op-amp School Version Part Name Library Vdc Source Vsin Source Student Version Part Name Vdc Vsin Library Source Source R OP AMP R EVAL Analog uA741 Analog LM741 Simulating From the main menu select Pspice->New Simulation Profile In the pop-up menu that appears type in a simulation name Hit <CREATE> You will see the pop-up menu below Select Transient Analysis as an analysis type Change the run time to 2msec Hit <OK> This will close the window To run the simulation from the main menu: Pspice-> run OR Run PSpice from the top toolbar Plotting After the simulation is complete a new window will appear. Because we placed voltage markers at the inputs and outputs these two voltages are automatically plotted. Sometimes the markers do not work or in debugging a circuit one wants to examine other voltages or currents. 4.0V 2.0V 0V -2.0V 0s V(VOUT) 0.2ms V(VIN) 0.4ms 0.6ms 0.8ms 1.0ms Time 1.2ms 1.4ms 1.6ms 1.8ms 2.0ms Adding Traces To plot traces after a simulation has run. In the window with the simulation results go to: Traces-> Add Trace The pop-up menu below will appear On the left hand side are all the voltages and currents that are available to plot. On the right hand side are mathematical functions that can be performed on the output variables The output variables are sensibly named: currents begin with an I, voltages with a V. For example I(R1) is the current going through the resistor called R1. – This is why it is helpful to name nets With your mouse select the Voltage or current that you wish to plot Hit <OK> - the windoiw will close at he plot should apprear Cursers After a simulation has run one can use cursers to get exact data values from simulation. There are two cursers one affiliated with the left mouse button and the other with the right mouse button In the window with your simulation traces plotted hit the Toggle Curser ICON on the top toolbar With your left mouse button click on the trace that you wish to plot at the bottom. Here we have selected V(VOUT) With your left mouse button select the position on the trace that you want a value for. A crosshair curser will appear and its value displayed in the Probe Curser window as A1 The process can be repeated with the right mouse button to create a second curser. Toggle curser ICON Then left mouse click here Left mouse click here Including Simulation Plots in Reports The Plotted simulation results can easily be copied to the clipboard and then pasted using <ctrl> V in a Microsoft Word Document. To copy to the clipboard: From the main menu: Window->Copy To Clipboard Resimulation At this time close the window where you simulation is plotted and return to the window with your schematic. Modify the parameters of your Vsin part so that the magnitude of the amplitude is 1 Volt. V3 VOFF = 0 VAMPL = 1 FREQ = 1K Resimulate. Note the clipping; the maximum output voltage should be +20Volts, but the amplifier saturates. In our next simulation we shall see that his goes away. 20V saturation 0V -20V 0s V(VOUT) 0.2ms V(VIN) 0.4ms 0.6ms 0.8ms 1.0ms Time 1.2ms 1.4ms 1.6ms 1.8ms 2.0ms AC simulation Replace the Vsin part with either the Vac or Vsrc part from the Source Library. It is possible to ad a dc offset to this AC source here we have left it zero. Note that the parameter Vac is one. This is the magnitude of the AC signal. 99.9% of the time this is a very good choice. This causes the transfer function to automatically be plotted. With this type of simulation, spice is unable to tell that the amplifier will saturate. R2 Vsrc or Vac part from SOURCE Library 200K Vcc- V4 0Vdc 1Vac TRAN = Vcc+ 4 uA741 2 - V- R1 Vin OS1 10K 3 0 0 + V+ OUT OS2 +15Vdc 6 5 Vcc- V1 1 V2 -15Vdc Vout V 0 0 U1 7 Vcc+ Performing the AC simulation From the schematic window menu: PSpice ->Edit Simulation Profile Select AC Sweep/Noise Enter the frequency range DO NOT START with 0, Note that 1M is equivalent to 1m = 10 -3 Logarithmic is customary Hit <OK> to close the window Do NOT start at ZERO! To run the simulation In the Schematic window menu: PSpice->Run Below is the output. You can see that the output at 1KHz appears to go to 20Volts even though the amplifier should saturate at +15Volts. Since the magnitude of Vin is one by plotting Vout we have in effect plotted Vout/Vin, the transfer function of the circuit. To remove a trace select it at the bottom and then hit <delete> 20V 10V 0V 1.0Hz V(VOUT) 10Hz 100Hz 1.0KHz 10KHz 100KHz 1.0MHz Select: then hit <delete> to Frequency remove Plotting traces from an AC simulation: When the simulation has complete in the window containing the plotted output variables. From the main menu of this window : Traces->Add Trace There are a number of functions that are helpful for AC simulations. Below we are plotting the phase. Again here it is helpful that we have named the output Vout. Function Phase Magnetude dB Imaginary Part Real Part Function name P() M() dB() IMG() R() Below is a plot of the phase. Remember the gain for low frequencies is -20. This is represented with the 180 degree phase shift. 173d 130d 87d 50d 1.0Hz P(V(VOUT)) 10Hz 100Hz 1.0KHz 10KHz 100KHz Frequency New Simulation: Replace the 200K resistor with a 5nF capacitor (C from the ANALOG Library). C2 5n VccVin V4 0Vdc 1Vac TRAN = Vcc+ 4 uA741 2 - V- R1 OS1 10K 0 0 + V+ OUT 3 OS2 V1 1 +15Vdc 6 5 VccV2 -15Vdc Vout V 0 0 U1 7 Vcc+ Perform an AC simulation from 1 to 1MHz plotting dB and phase. 1.0MHz Another Transient Simulation: Step response of an RC filter Build the simple RC circuit shown below with the parts and markers indicated. Now capacitors can have initial conditions. Here we use the part IC1 to assign the initial condition of 2Volts at the node Vout. There are two parts that are helpful for digital Spice simulations. One is Vpwl and the other is Vpulse. Here we are using Vpulse the parameters necessary for Vpulse are summarized below. + IC= 2V R1 Vin Vout 1k V1 V1 = 0 V2 = 5 TD = 1u TR = 1n TF = 1n PW = 1u PER = 2u V V C1 0.1n 0 Resistor Capacitors Vpulse (digital waveform) Initial condition Parameter V1 V2 TD TR/TF PW PER PART R C Vpulse LIBBARY ANALOG ANALOG SOURCE IC1 or IC2 (IC1 shown) SPECIAL Description First Voltage Second Voltage Delay Time Rise/Fall time Pulse width Period I.C. of 2 volts Run a Transient simulation simulating from 1-4usec He output should appear as follows 5.0V 2.5V 0V 0s V(VOUT) 0.5us V(VIN) 1.0us 1.5us 2.0us Time 2.5us 3.0us 3.5us 4.0us