You are on page 1of 40

Introduction to PSpice

John Evans IT/CE


September, 1999

A brief history of time (1)


MicroSim - 1980s(?) - 1997/8 OrCAD merges with MicroSim 1997/8 OrCAD merges with Symmetry 1998 OrCAD doesnt merge with Symmetry 1999 Cadence buys OrCAD 1999

Introduction to PSpice

A brief history of time (2)


Last MicroSim version - v8 First OrCAD version - v9 This used Capture - the OrCAD

schematic capture program. Not introduced at CERN. v9 to be introduced at CERN after Windows upgrade. OrCAD will use MicroSim schematics for next two years.
Introduction to PSpice 3

Where are we going to today?


Use Schematic capture
to enter schematic and set up simulation parameters before running

PSpice (simulation engine)


and then look at results in

Probe
Also available at CERN: Parts (modelling program) Stimulus Editor (to produce custom voltage/current/digital sources) Optimizer (can automatically vary circuit component values to satisfy design criteria)
Introduction to PSpice 4

Set-up PSpice
Run set-up from Windows menu Makes default directories for temp files, backup files and user libraries. Copies required files over to PC
msim.ini (contains all library paths, controls look of the programs) msim.prb (used while running Probe)

Introduction to PSpice

Freq1.sch (1)
Enter the circuit

shown.
Use components:
VDC R C VAC (VSIN) AGND OP-07 Bubble

Use the commands


Introduction to PSpice 6

Freq1.sch (2)
Get new part
toolbar menu - Draw/Get new part keyboard - ctrl-G

Flip/rotate part
menu - Edit/Flip/rotate keyboard - ctrl-F, ctrl-R

Cut/Copy/Paste part
menu - Edit Cut/Copy/Paste keyboard - ctrl-X, ctrl-C,ctrl-V
Introduction to PSpice 7

Freq1.sch (3)
Wire circuit
Draw/Wire ctrl-W use space bar/RMB

Change resistor values Change Ref(erence)

Des(ignators) Label node v_out Change VDC values Label bubble connectors

Introduction to PSpice

Set-up VAC source


Set-up VAC*
DC=0 used to find initial DC solution ACMAG=1 source p-to-p value during AC analysis ACPHASE=0 reference for phase measurements

*VSIN can also be used for AC analysis - see Appendix 1 for set-up explanation
Introduction to PSpice 9

Set-up AC analysis and Probe


From Menu

Analysis/Setup or Toolbar Click AC Sweep

Enter as shown Click OK

Introduction to PSpice

10

Set-up Probe and Run Analysis


Set-up Probe
From Menu
Analysis/Probe Setup

Under Data Collection tab, select All


N.B. other options allow to limit size of .dat file

Run Analysis From Menu


Analysis/Simulate

From keyboard
F11

From Toolbar Introduction to PSpice 11

Some Probe commands


Add Trace Trace/Add Insert Display manipulation functions

or

reduce traces shown, use voltage markers


Add Y-axis Plot/Add Y-axis Ctrl-Y
N.B >> indicates the active axis

from the menu View/Fit,In,Out,Area


or

from the keyboard Ctrl N,I,O,A To re-scale axes double-click on any axis
or

Plot X(Y)-Axis Settings...

Introduction to PSpice

12

Exercise: Measure the f3dB point of v_out using the cursors

In Probe:
Trace/Add, DB(V(v_out)) To make cursors active select Place one cursor on nominal 0dB point Move other cursor until dif shows difference of 3dB

Introduction to PSpice

13

Exercise: Measure the f3dB point of v_out using a goal function


In Probe:
Trace/Eval Goal Function Select: LPBW(1,db_level) Select: V(v_out) Enter 3 from the keyboard Click on OK

N.B. to see a detailed explanation of this goal function and its parameters, select: Trace/Goal Functions, LPBW, View The g.f. can also be evaluated from this window (select Eval instead of View)
Introduction to PSpice 14

Adding parameters
Change C1 value to {c_val}

N.B. name is unimportant but { } are mandatory Add a PARAM symbol (Draw/Get New Part/ Param) Set up NAME1 and VALUE1 PARAM values (double-click on the symbol).
Click OK

Introduction to PSpice

15

Set-up Parametric sweep


Setup a Parametric

sweep (Analysis/Setup/ Parametric) Click OK


Run AC analysis

Introduction to PSpice

16

Parametric analysis results


When Probe opens, it will

(typically) show:
The analysis results are split

into sections. There is one section for each value of parametric sweep
Click on OK

Introduction to PSpice

17

Exercises - Performance Analysis


Select Trace/Add. Plot DB(V(v_out)) Select Trace/Performance Analysis (or Click OK

from the toolbar).

- a new window appears. The X-axis is R, the parameter varied

Select Trace/Add. Plot (LPBW(V(v_out),3)) Select Plot/Add Plot Select Trace/Add. Plot 1/(LPBW(V(v_out),3))

Introduction to PSpice

18

Transient.sch (1)
Load transient.sch Complete by adding

IPWL*
(IPWL is a Piece Wise Linear current source)

Set-up IPWL by adding (time,current) points:


(T1=0, I1=0), (T2=10ms, I2=0), (T3=10.1ms, I3=1)
*to set-up the ISTIM part, see appendix 3 Introduction to PSpice 19

Set-up transient and exercises


Set-up transient run:

Print step: 100ms final time: 20s


What range of values of R1

satisfies:
risetime I(L1) < 2s overshoot I(L1) < 10% ?

Hints:
Range is somewhere between 0.4 and 1.5 Ohms (set-up Parametric Analysis in Schematics using Analysis/Setup/Parametric) In Probe, select Trace/Performance Analysis , click OK Use GenRise() and Overshoot() goal functions
20

Exercises
Exercise 1 Design a perfect non-inverting voltage op-amp using E (voltage-controlled voltagesource). Verify using VPULSE (appendix 2) and transient analysis Design a perfect non-inverting voltage op-amp using A(nalog) B(ehavioral) M(odelling) parts (found in ABM library) Design an imperfect non-inverting voltage op-amp (output limited to supply voltage). Exercise 2 Design an attenuator with input parameters IMP and ATT. Calculate values for R1,R2 such that: v_out = v_in - ATT dB The impedance seen from RS = IMP Add parameter checking
21

Slow.sch
Load and simulate

slow.sch Zoom in on the output Replace the digital pullup with a 1k resistor to +5V and re-simulate Whats the difference?

Introduction to PSpice

22

Digital simulation (1)


PSpice is two simulators - one analogue and one digital
The analogue one solves Kirchoffs laws The digital one uses Boolean arithmetic

The digital simulator has an extensive library of

characterised digital parts - these are mostly behavioural models only (which includes timing information) To simulate real (analogue) input/output behaviour, find the transistor-level circuits
proprietary information very slow simulation speeds
Introduction to PSpice 23

Digital simulation (2)


Digital device libraries are usually specified in families. Each device has its own timing model (typical, min., max.

times specified here) Each device has an I/O model. This will be shared by all devices in the same logic family
The I/O model includes a nominal impedance representation for each I/O pin. It also includes information on which type of AtoD and DtoA converter to use for each device. These converters are powered off the supplies defined by IPIN(supply).

The converters are ONLY USED when interfacing between

the analogue and digital simulators!


Introduction to PSpice 24

Digpower.sch (see Appendices 4, 5)

Introduction to PSpice

25

Digital Setup
Timing mode leave on Typical Flip-flop initialization depends on circuit Default Interface leave on Level 1
If you have lots of unimportant digital warnings - set Default A/D Interface to Level 2 (see Appendix 6)
Introduction to PSpice 26

Setting Initial Conditions


Initial conditions can be set in the analogue

simulator using:
IC on components Setpoints Nodeset Save/Load Bias Point

(also see Appendix 7)


Introduction to PSpice 27

Introduction to PSpice

28

Appendices
1) 2) 3) 4) 5) 6) 7)

Setup VSIN Setup VPULSE Setup ISTIM Default digital power supplies Changing CMOS power supplies Default A/D interface definitions Setting Initial Conditions

Introduction to PSpice

29

Appendix 1 - Setup VSIN


Set-up VSIN
DC=0 AC=1* VOFF=2 VAMPL=2 FREQ=5 TD=1 DF=1 PHASE=45 *AC Analysis only

Introduction to PSpice

30

Appendix 2 - Setup VPULSE


Example
DC=0 AC=1* V1=1 V2=4 TD=1 TR=1 TF=1 PW=2 PER=6 *AC Analysis only
Introduction to PSpice 31

Appendix 3 - Setup ISTIM


Double click on Stimulus= Enter name test Double click on ISTIM body to open STMED - Select PWL Double-click on axis Set X-axis to range 10.1ms, resolution 0.1ms Set Y-axis to range 1, resolution 0.2 Enter (time,value) points using the pencil :
(t1=0, I1=0), (t2=10ms, I1=0), (t3=10.1ms, I3=1)

Save and exit Stimulus Editor N.B this saves the stimulus test in transient.stl

32

Appendix 4 - Default digital power supplies


Most digital parts and

stimulii already have a default power supply. The four default power supplies provided in the model library are:

DIGIFPWR (TTL) CD4000_PWR (CD4000 series CMOS) ECL_10K_PWR (ECL10K) ECL_100K_PWR (ECL 100K).
Introduction to PSpice 33

Appendix 5 - Changing CMOS power supplies


Change default values for $G_CD4000_VDD/ $G_CD4000_VSS Use the PARAM symbol Enter the required values for CD4000_VDD and CD4000_VSS Create a custom CMOS supply use the symbol CD4000_PWR Name VDD_NODE and VSS_NODE Give values to VOLTAGE and REFERENCE* Change power pins on IC symbol to reference custom supply
See example digpower.sch
* VSS_NODE = REFERENCE Volts VDD_NODE = (VOLTAGE + REFERENCE) Volts
Introduction to PSpice 34

Appendix 6 - Default A/D interface definitions


Default A/D interface Level 1 (AtoD1/DtoA1) - AtoD generates intermediate R,F, and X levels Level 2 (AtoD2/DtoA2) - AtoD does not generate R,F, and X levels Level 3 (AtoD3/DtoA3) => same as level 1* Level 4 (AtoD4/DtoA4) => same as level 2* N.B. DtoA1 is always the same as DtoA2 For HC/HCT parts, there are two different DtoA models Simple (level 1 or 2) - assumes fixed supply of +5V at 25C Elaborate (level 3 or 4) - valid from 2-6V, temperature derated N.B. Elaborate is much slower than simple - dont use unless required

Introduction to PSpice

35

Appendix 7 - Setting Initial Conditions


(Following extracted from the PSpice Reference Manual) IC Initial Condition A voltage assigned to <node> (or a current assigned to an inductor) for the duration of the bias point calculation. The voltage between two nodes and the current through an inductor can be specified. During bias calculations, PSpice clamps the voltages to specified values by attaching a voltage source with a 0.0002 ohm series resistor between the specified nodes. After the bias point has been calculated and the transient analysis started, the node is released. .NODESET This helps calculate the bias point by providing an initial best guess for some node voltages and/or inductor currents. Some or all of the circuits node voltages and inductor currents can be given the initial guess, and in addition, the voltage between two nodes can be specified. The command is effective for the bias point (both small-signal and transient bias points) and for the first step of the DC sweep. It has no effect during the rest of the DC sweep, nor during a transient analysis. Unlike the .IC (Initial Bias Point Condition) command, .NODESET provides only an initial guess for some initial values. It does not clamp those nodes to the specified voltages. However, by providing an initial guess, .NODESET can be used to break the tie in, for instance, a flip-flop, and make it come up in a required state. If both the .IC command and .NODESET command are present, the .NODESET command is ignored for the bias point calculations (.IC overrides .NODESET). Introduction to PSpice Other methods of setting initial conditions are by using Save Bias Point and Load Bias Point options - refer to the PSpice Reference manual for more information. 36

Introduction to PSpice

37

Exercise 1 Solution

38

Exercise 2 Solution (no parameter checking)

Introduction to PSpice

39

Exercise 2 Solution (with parameter checking)

40

You might also like