ECE 220: PSpice DC Sweep with a Nested Parameter Sweep Before you start you should have the schematic below using the parts indicated in the table below Vcc Vcc R1 1k V2 DC = 5V AC = TRAN = Vo Q1 0 Vin V1 DC = AC = TRAN = Q2N2222 0 0 Part Vsrc R Q2N2222 Library Source Analog Bipolar Description Voltage source Resistor Transistor Creating a Variable 1) Double click on the 1K value of the resistor and change it to the equation {res*1K} (curly brackets are needed) – res is a variable. 2) Hit bindkey p and add the part param from the library special. This part is used to define variables 3) Click on <OK> to close the window and place the part Vcc PARAMETERS: Vcc R1 {res*1K} V2 DC = 5V AC = TRAN = Vo Q1 0 Vin V1 DC = AC = TRAN = Q2N2222 0 0 4) On the schematic double click on the word PARAMETERS. You will see the window below. 5) Click on New Column 6) If prompted answer yes Close window 7) In the Add New Column window type the variable name and give it a default value (as shown below) 8) Click OK to close the Add New Column window 9) Close the Property Editor Window (top right) Now you are ready to simulate Placing Probes To automatically plot results when a simulation is complete place voltage probes to plot voltages or current probes for currents. 10) Place a voltage probe at the output of the amplifier as shown below and a current probe to plot the current Ic. Note current probes must be placed on the pins of devices (the very edge) Current probe Voltage probe Running a DC sweep with a Nested Parametric sweep 11) To simulate from the top toolbar select Pspice->New Simulation Profile 12) Enter a name 13) Click on create to close the window 14) 15) 16) 17) 18) In the Simulation Settings menu (shown below) select a DC sweep analysis type Specify that you wish to sweep a voltage source Specify the voltage source that you wish to sweep (V1) Specify the Start and stop voltages as well as the voltage increment Note: Spice understands m to be 10-3 19) 20) 21) 22) 23) Select Parametric Sweep (you will see the window on the next page) Select Global Parameter Specify the parameter you wish to sweep (res) Specify the range for res (start: 1, stop: 4, Increment 2) Click on <OK> to close the window 24) To simulate click on the run Pspice icon at the top of the schematic Run Pspice icon 25) The simulation will run Note if your simulation fails check for errors: from top toolbar: Window->Session Log 26) Click on <OK> to plot all three parametric sweeps 27) If your simulation runs successfully the voltages will be plotted as shown below (the current is so small in comparison to the voltage it will appear to be zero) (see below) Deleting Traces 28) Click on the V(Vo) icon (the text) at the bottom left of the simulation window (as shown below) 29) click <delete> to delete it 30) Also delete the current trace V(Vo) ICON Adding Traces and Plotting expressions We will add back the traces for V(Vo) to show another way of plotting traces 31) In the top toolbar of the Allegro Simulation Simulator window select: Trace->Add Trace You will see the Add Traces pop-up menu shown below. On the left circuit voltages and currents are listed, on the right available functions 32) Select V(Vo) (you could also form an expression) 33) Select <OK> to close the window and plot the expressions Using Cursors Cursors can be used to determine precise simulation values. 34) To activate the cursors click on the toggle cursor on icon at the top of the Simulation window Toggle cursor on There are two cursors A1 and A2. A1 is controlled with the left mouse and A2 with the right. 35) Affiliate cursor A1 with the left trace of V(Vo)by clicking on its trace icon with the LEFT mouse button (see below) 36) Affiliate cursor A2 with the left trace of V(Vo) by clicking on its trace icon with the RIGHT mouse button (see below) 37) Click on the actual V(Vo) trace with the RIGHT mouse button to define the position of the A2 cursor. Crosshairs will be shown. X and Y values for this trace at the position of the cross hairs are displayed in the small Probe Cursor window. The crosshairs can be moved by dragging the mouse with the right button. Note: o The position of the A1 cursor is similarly controlled with the left mouse button o The difference between the A1 and A2 cursors is shown in the Probe Cursor menu as well. o Cursors A1 and A2 can be used for the same trace or different ones crosshair crosshair ICON