SlideShare une entreprise Scribd logo
1  sur  39
PSPICE Tutorial Ankit G Doshi The University of Texas at Arlington July 22nd 2010
Introduction SPICE - Simulation Program with Integrated Circuits Emphasis Developed by the University of California, Berkeley in 1960s Still widely used simulator for analog circuit simulations in industry and R&D centers. Types of input file Netlist - Type in the circuit using simple text.  (*.cir) Schematics - Draw circuit using drag and drop parts. (*.sch)
Where to get the software http://www.cadence.com/products/orcad/pages/downloads.aspx
How to type in the given circuit Any SPICE input file is made up of 3 sections 1. Data statements - description of the components and the interconnections. 2. Control Statements - tells SPICE what type of analysis to perform on the circuit. 3. Output Statements - specifies what outputs are to be printed or plotted. Although these statements may appear in any order, it is recommended that they be given in the above sequence.
How to type in the given circuit Two other statements are required: the title statement and the end statement.  The title statement is the first line and can contain any information The end statement is always .END. This statement must be a line be itself, followed by a carriage return! In addition, you can insert comment statements, which must begin with an asterisk (*) and are ignored by SPICE.  If one wants to continue a statement to the next line, one uses a "+" sign (continuation sign) at the beginning of the next line. Numbers can be integers, or floating points. SPICE is not case sensitive. (i.e. Vbus, VBUS, vbus all are same).
A typical SPICE input file 		TITLE STATEMENT 		ELEMENT STATEMENTS 		. 		. 		COMMAND (CONTROL) STATEMENTS 		OUTPUT STATEMENTS 		.END <CR>
Scale Factors T(= 1E12 or 10^12) G(= E9) MEG(= E6) K(= E3) M(= E-3) U(= E-6) N(= E-9) P(= E-12) F(= E-15)
1. Data Statements To Specify the Circuit Components and Topology
Independent DC Sources Voltage source: Vname N1 N2 Type Value  Current source: Iname   N1 N2 Type Value  N1 is the positive terminal node N2 is the negative terminal node Type can be DC, AC or TRAN, depending on the type of analysis Value gives the value of the source The name of a voltage and current source must start with V and I, respectively. Examples: Vin 2 0 DC 10 Is 3 4 DC 1.5
Dependent Sources Voltage controlled voltage source: Ename N1 N2 NC1 NC2 Value Voltage controlled current source: Gname N1 N2 NC1 NC2 Value Current controlled voltage source: Hname N1 N2 Vcontrol Value Current controlled current source: Fname N1 N2 Vcontrol Value N1 and N2 are the positive and negative terminals of the dependent source, respectively. NC1 and NC2 are the positive and negative terminals of the controlling voltage source, respectively. Vcontrol is the zero value voltage source used to measure the controlling current (the positive current flows into the positive terminal of the controlling voltage source!). Example: Ebar    17   8   42   18    24.0		(VCVS) Glab    23  17    8     3    2.5		(VCIS) Hvx     20  12  Vhx       50.0		(CCVS)Vhx     80  76  DC        0V ; controls Hvx Ftrn     81   19   Vctl         50.0		(CCCS)Vclt     23   12   DC           0V ; controls Ftrn
Resistors, Capacitors and Inductors Resistor: RnameN1 N2 Value Capacitor: Cname N1 N2 Value <IC> Inductor:   Lname N1 N2 Value <IC> N1 is the positive node. N2 is the negative node. IC is the initial condition (DC voltage or current). The symbol < > means that the field is optional. If not specified, it is assumed to be zero.  In case of an inductor, the current flows from N1 to N2. Example: Rin 3 4 100k Cc  7 8  20f 5 L3  2 0  6.25m 1m
Sinusoidal Sources Sinusoidal Voltage Source:Vname N1 N2 SIN(VO VA FREQ TD THETA PHASE)  Vname = VO + VA exp[-THETA.(t - TD)] sin[2pi.f (t - TD) + (Phase/360)] VO - offset voltage in volt. VA - amplitude in volt. f = FREQ - the frequency in herz. TD - delay in seconds THETA - damping factor per second Phase - phase in degrees  If TD, THETA and PHASE are not specified, it is assumed to be zero.    Example: VG   1 2  SIN(5 10 50 0.2 0.1) VG2 3 4  SIN(0 10 50) To generate a cosine function, you can make use of the phase relationship between the sinusoid and cosine. Here is an example of an undelayed cosine with an amplitude of 5V and frequency of 50 Hz.  Vcos 1 2 SIN(0 5 50 0 0 90)
Piecewise Linear Sources (PWL) Vname N1 N2 PWL(T1 V1 T2 V2 T3 V3 ...) in which (Ti Vi) specifies the value Vi of the source at time Ti  Example: Vgpwl 1 2 PWL(0 0 10U 5 100U 5 110U 0)
Transformers SPICE has no model for an ideal transformer. An ideal transformer is simulated using two inductors mutual inducting on each other such that the transformer ratio N1/N2 = sqrt(L1/L2).  Make the coupling factor K close to one (ex. K=0.99999).  The secondary circuit needs a DC connection to ground. This can be accomplished by adding a large resistor to ground or giving the primary and secondary circuits a common node.
Transformers (Cont.) 	Example transformer 	VIN 2 0 SIN(0 170 60 0 0) 	* This defines a sinusoid of 170 *amplitude and 60 Hz.  	RS 2 1 10 	L1 1 0 2000 	L2 3 0 20 	K L1 L2 0.99999 	.TRAN 0.2M 25M 	.PLOT TRAN V(2) 	.PLOT TRAN V(3) 	.END
Subcircuits A subcircuit allows you to define a collection of elements as a subcircuit (e.g. an operational amplifier) and to insert this description into the overall circuit (as you would do for any other element). It is a kind of function or subroutine in C. Defining a subcircuit  A subcircuit is defined by a .SUBCKT control statement, followed by the circuit description as follows:  	   	.SUBCKT SUBNAME N1 N2 N3 ... 		Element statements 		Element statements 		Element statements 		ENDS SUBNAME in which SUBNAME is the subcircuit name and N1, N2, N3 are the external nodes of the subcircuit. The external nodes cannot be 0. The node numbers used inside the subcircuit are strictly local, except for node 0 which is always global.
Subcircuits (Cont.) 	.SUBCKT OpAmpp_inn_in com out 	Ex   int   com   p_inn_in   1e5 Rip_inn_in  500k 	Ro   int   out   50.0 	.ENDS
Subcircuits (Cont.) Using a subcircuit  The element statement for a subcircuit is similar to any other element. The format is as follows: Xname N1 N2 N3 ... SUBNAME Where Xname refers to the element (subcircuit) being used N1, N2, N3 are the nodes to which the external nodes of the subcircuit are being connected SUBNAME is the name of the subcircuit being used. 
Subcircuits (Cont.) Subcircuit Example - Inverting OpAmp 	.SUBCKT OpAmpp_inn_in com out 	Ex   int   com   p_inn_in   1e5 Rip_inn_in  500k 	Ro   int   out   50.0 	.ENDS 	Vg   1     0     DC      50mV Rg   1     2     5k Rf   2     3     50k 	RL   3     0     20k 	X1   0     2     0      3    OpAmp 	.END
Semiconductor Devices Most of the elements that have been described above require only a few parameters to specify its electrical characteristics.  However, the models for semiconductor devices require many parameter values. A set of device model parameters is defined in a separate .MODEL statement and assigned a unique name.  Thus a semiconductor device is specified by two command lines: an element and model statement. Element Line:		ElementName N+ N- MODName Model Statement:   	.MODEL MODName Type (parameter values) MODName is the name of the model for the device.  Type refers to the type of device and can be any of the following:  D: Diode NPN: npn bipolar transistor PNP: pnp bipolar transistor NMOS: nmos transistor PMOS: pmos transistor NJF: N-channel JFET model PJF: P-channel JFET model
Semiconductor Devices (Cont.) Diode Element line: Dname N+ N- MODName Model Statement: .MODEL MODName D (IS= N= Rs= CJO= Tt= BV= IBV=) Example: D1		5    3 D1N4148 .model D1N4148 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA)
Semiconductor Devices (Cont.) BJT Element Line:       Qname C B E BJT_modelName Model statement: .MODEL BJT_modName NPN (BF=val IS=val VAF=val) Example: Q3    4   2   0   Q2N2222A .model Q2N2222A NPN (IS=14.34F XTI=3 EG=1.11 VAF= 74.03 BF=255.9             + NE=1.307 ISE=14.34F IKF=.2847 XTB=1.5 BR=6.092 NC=2 ISC=0 IKR=0       + RC=1 CJC=7.306P MJC=.3416 VJC=.75 FC=.5 CJE=22.01P MJE=.377          + VJE=.75 TR=46.91N TF=411.1P ITF=.6 VTF=1.7 XTF=3 RB=10)
Semiconductor Devices (Cont.) MOSFET Element Line: 	Mname ND NG NS <NB> ModName L= W=  Model statement:	.MODEL ModName NMOS (KP= VT0= lambda= gamma=) Example: M5    4   2   0	CMOSN .model CMOSN NMOS (LEVEL=3 PHI=0.600000 TOX=2.1200E-08 XJ=0.200000U    +TPG=1 VTO=0.7860 DELTA=6.9670E-01 LD=1.6470E-07 KP=9.6379E-05 +UO=591.7 THETA=8.1220E-02 RSH=8.5450E+01 GAMMA=0.5863 +NSUB=2.7470E+16 NFS=1.98E+12 VMAX=1.7330E+05 ETA=4.3680E-02 +KAPPA=1.3960E-01 CGDO=4.0241E-10 CGSO=4.0241E-10 +CGBO=3.6144E-10 CJ=3.8541E-04 MJ=1.1854 CJSW=1.3940E-10 +MJSW=0.125195 PB=0.800000)
2. Control Statements Tells SPICE what type of analysis to perform on the circuit.
.OP Statement This statement instructs Spice to compute the DC operating points:   voltage at the nodes current in each voltage source operating point for each element
.DC Statement This statement allows you to increment (sweep) an independent source over a certain range with a specified step. The format is as follows:  .DC SRCname START STOP STEP in which SRC name is the name of the source you want to vary; START and STOP are the starting and ending value, respectively; and STEP is the size of the increment.  Example: .DC V1 0 20 2
.AC Statement ,[object Object],	.AC LIN NP FSTART FSTOP 	.AC DEC ND FSTART FSTOP 	.AC OCT NO FSTART FSTOP In which LIN stands for a linear frequency variation, DEC and OCT for a decade and octave variation respectively.  NP stands for the number of points and ND and NO for the number of frequency points per decade and octave.  FSTART and FSTOP are the start and stopping frequencies in Hertz  ,[object Object],[object Object]
Other Control Statements .NOISE	- For NOISE Analysis .DISTO	- For DISTORTION Analysis .FOUR	- For FOURIER Analysis 		etc.
3. Output Statements These statements will instruct PSpice what output to generate. If you do not specify an output statement, PSpice will always calculate the DC operating points.
.PRINT Statement It generates is a table of data points. Format: .PRINT TYPE OV1 OV2 OV3 ... in which TYPE specifies the type of analysis to be printed or plotted and can be: DC, TRAN, AC Example: .PRINT TRAN V(3,1) I(Vmeas)
.PROBE Statement It generates is a plot. Format: .PROBE When using .PROBE statement as output, after successfully simulating the netlist a blank graph is generated. User has to manually insert traces of interest to see the graph.
Example 1
Example 1 (Cont.) EXAMPLE Pspice		TITLE Line VIN 1 0 DC 10				 F1 0 3 VMEAS 0.5		   	   | VMEAS 4 0 DC 0		   	   |	 R1 1 2 1K		   	  	   | R2 2 3 10K		   	   	   |DATA R3 1 3 15K		   	   	   | R4 2 4 40K		   	   	   | R5 3 0 50K				 .OP					 .TF V(3,0) VIN			   	   |CONTROL .DC VIN 0 20 2				 .PRINT DC V(1,2) V(2,4) I(VMEAS)	 OUTPUT .PROBE				  	 OUTPUT .END					 END Statement
Example 2
Example 2 (Cont.) 		Full wave rectifier power supply 		Vin       5  0	SIN(0 170 60) 		* Transformer 		L1        6   0     330 		L2        1   0     3 		K L1 L2 0.99999 		RS       5   6     0.1 		*Bridge 		D1	2	1	diode 		D2	2	0	diode 		D3	1	3	diode	 		D4	0	3	diode 		R	3	4	98 		C	3	2	425u 		RL	4	2	450 		D	2	4	mod1 		.model diode D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA) 		.model mod1 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=10 IBV=0.1PA) 		.TRAN 0.2m 10 		.PROBE 		.END
References SPICE – Brief Tutorial, By Jan Van derSpigel from University of Pennsylvania SPICE, A Guide to Circuit Simulation and Analysis Using PSpice, 3rd Ed. By P. Tuinenga, Prentice Hall, Upper Saddle River, NJ, 1995 PSPICE Tutorial, By Dr. Dillon from The University of Texas at Arlington (http://www.uta.edu/ee/hw/pspice/)
Questions
THANK YOU
PSpice Tutorial

Contenu connexe

Tendances

superconductor fault current limiter
superconductor fault current limitersuperconductor fault current limiter
superconductor fault current limiter
Prem Dayal
 
Power system protection
Power system protectionPower system protection
Power system protection
Anu Priya
 
Overview of Grounding for Industrial and Commercial Power Systems
Overview of Grounding for Industrial and Commercial Power SystemsOverview of Grounding for Industrial and Commercial Power Systems
Overview of Grounding for Industrial and Commercial Power Systems
michaeljmack
 

Tendances (20)

superconductor fault current limiter
superconductor fault current limitersuperconductor fault current limiter
superconductor fault current limiter
 
Ebers moll model
Ebers moll modelEbers moll model
Ebers moll model
 
VLSI Introduction to PSPICE
VLSI Introduction to PSPICEVLSI Introduction to PSPICE
VLSI Introduction to PSPICE
 
ETAP - Ac networks
ETAP - Ac networksETAP - Ac networks
ETAP - Ac networks
 
Power system protection
Power system protectionPower system protection
Power system protection
 
ETAP - Power system modeling
ETAP - Power system modelingETAP - Power system modeling
ETAP - Power system modeling
 
Over current Relays
Over current RelaysOver current Relays
Over current Relays
 
Boost converter
Boost converterBoost converter
Boost converter
 
Buck converter
Buck converterBuck converter
Buck converter
 
Introduction to proteus
Introduction to  proteusIntroduction to  proteus
Introduction to proteus
 
Relay
RelayRelay
Relay
 
Three phase-circuits
Three phase-circuitsThree phase-circuits
Three phase-circuits
 
ETAP - Arc flash analysis done Right
ETAP - Arc flash analysis done RightETAP - Arc flash analysis done Right
ETAP - Arc flash analysis done Right
 
Power system protection topic 1
Power system protection topic 1Power system protection topic 1
Power system protection topic 1
 
ETAP - Coordination and protecion
ETAP -  Coordination and protecionETAP -  Coordination and protecion
ETAP - Coordination and protecion
 
学校図書館と著作権
学校図書館と著作権学校図書館と著作権
学校図書館と著作権
 
Overview of Grounding for Industrial and Commercial Power Systems
Overview of Grounding for Industrial and Commercial Power SystemsOverview of Grounding for Industrial and Commercial Power Systems
Overview of Grounding for Industrial and Commercial Power Systems
 
IEEE substation design
IEEE substation designIEEE substation design
IEEE substation design
 
MOS logic family
MOS logic familyMOS logic family
MOS logic family
 
Switch mode power supply
Switch mode power supplySwitch mode power supply
Switch mode power supply
 

En vedette

rekabentruk berbantu komputer Lab 4
rekabentruk berbantu komputer Lab 4rekabentruk berbantu komputer Lab 4
rekabentruk berbantu komputer Lab 4
mkazree
 
Multisim 9 for educators
Multisim 9 for educatorsMultisim 9 for educators
Multisim 9 for educators
dinhto1985
 
Multisim training in mohali
Multisim training in mohaliMultisim training in mohali
Multisim training in mohali
Arwinder paul singh
 
Tutorial getting started with multisim
Tutorial  getting started with multisimTutorial  getting started with multisim
Tutorial getting started with multisim
gato4048
 
Operational amplifiers
Operational amplifiersOperational amplifiers
Operational amplifiers
vshalsheth
 

En vedette (20)

Introduction to PSPICE
Introduction to PSPICEIntroduction to PSPICE
Introduction to PSPICE
 
Pspice Introduction
Pspice IntroductionPspice Introduction
Pspice Introduction
 
Intro to p-spice
Intro to p-spiceIntro to p-spice
Intro to p-spice
 
PSpice
PSpicePSpice
PSpice
 
WORKSHOP-Flyer
WORKSHOP-FlyerWORKSHOP-Flyer
WORKSHOP-Flyer
 
SPICE Model of Honda solar cell
SPICE Model of Honda solar cellSPICE Model of Honda solar cell
SPICE Model of Honda solar cell
 
rekabentruk berbantu komputer Lab 4
rekabentruk berbantu komputer Lab 4rekabentruk berbantu komputer Lab 4
rekabentruk berbantu komputer Lab 4
 
Multisim 9 for educators
Multisim 9 for educatorsMultisim 9 for educators
Multisim 9 for educators
 
Multisim training in mohali
Multisim training in mohaliMultisim training in mohali
Multisim training in mohali
 
Tutorial getting started with multisim
Tutorial  getting started with multisimTutorial  getting started with multisim
Tutorial getting started with multisim
 
National instruments for Academics: labview multisim &amp; elsvi
National instruments for Academics: labview multisim &amp; elsviNational instruments for Academics: labview multisim &amp; elsvi
National instruments for Academics: labview multisim &amp; elsvi
 
Seminar 1
Seminar 1Seminar 1
Seminar 1
 
B tech ee ii_ eee_ u-1_ dc circuit analysis_dipen patel
B tech ee  ii_ eee_ u-1_ dc circuit analysis_dipen patelB tech ee  ii_ eee_ u-1_ dc circuit analysis_dipen patel
B tech ee ii_ eee_ u-1_ dc circuit analysis_dipen patel
 
CMOS N P Twin Tub Well Formation
CMOS N P Twin Tub Well FormationCMOS N P Twin Tub Well Formation
CMOS N P Twin Tub Well Formation
 
PCB Virtual Prototyping with PSpice
PCB Virtual Prototyping with PSpicePCB Virtual Prototyping with PSpice
PCB Virtual Prototyping with PSpice
 
Introduction to MEMS and MEMS PRO
Introduction to MEMS and MEMS PROIntroduction to MEMS and MEMS PRO
Introduction to MEMS and MEMS PRO
 
Nmos design using synopsys TCAD tool
Nmos design using synopsys TCAD toolNmos design using synopsys TCAD tool
Nmos design using synopsys TCAD tool
 
twin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCADtwin well cmos fabrication steps using Synopsys TCAD
twin well cmos fabrication steps using Synopsys TCAD
 
Operational amplifiers
Operational amplifiersOperational amplifiers
Operational amplifiers
 
Memristor overview
Memristor overviewMemristor overview
Memristor overview
 

Similaire à PSpice Tutorial

Tutorial simulations-elec 380
Tutorial simulations-elec 380Tutorial simulations-elec 380
Tutorial simulations-elec 380
Moez Ansary
 
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docxreference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
debishakespeare
 
Electronics assignments(Transistors,OPAMPS)
Electronics assignments(Transistors,OPAMPS)Electronics assignments(Transistors,OPAMPS)
Electronics assignments(Transistors,OPAMPS)
soumyaranjan panda
 
Assignment 1 Description Marks out of Wtg() Due date .docx
Assignment 1  Description Marks out of Wtg() Due date .docxAssignment 1  Description Marks out of Wtg() Due date .docx
Assignment 1 Description Marks out of Wtg() Due date .docx
fredharris32
 
Design and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applicationsDesign and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applications
cuashok07
 
Current Transformers parameter design and graphs - size and design requirements
Current Transformers parameter design and graphs - size and design requirementsCurrent Transformers parameter design and graphs - size and design requirements
Current Transformers parameter design and graphs - size and design requirements
ssuser39bdb9
 
16th July 2015 Road lighting_modified
16th July 2015 Road  lighting_modified16th July 2015 Road  lighting_modified
16th July 2015 Road lighting_modified
Prateek Singh
 

Similaire à PSpice Tutorial (20)

nfc
nfcnfc
nfc
 
A novel voltage reference without the operational amplifier and resistors
A novel voltage reference without the operational amplifier and resistorsA novel voltage reference without the operational amplifier and resistors
A novel voltage reference without the operational amplifier and resistors
 
Analog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab ManualAnalog and Digital Electronics Lab Manual
Analog and Digital Electronics Lab Manual
 
Tutorial simulations-elec 380
Tutorial simulations-elec 380Tutorial simulations-elec 380
Tutorial simulations-elec 380
 
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docxreference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
reference notes455647_1_EE460-Project-131.pdfKing Fahd Un.docx
 
PVCOM-PV Coding & Modelling.
PVCOM-PV Coding & Modelling.PVCOM-PV Coding & Modelling.
PVCOM-PV Coding & Modelling.
 
Electronics assignments
Electronics assignmentsElectronics assignments
Electronics assignments
 
Electronics assignments(Transistors,OPAMPS)
Electronics assignments(Transistors,OPAMPS)Electronics assignments(Transistors,OPAMPS)
Electronics assignments(Transistors,OPAMPS)
 
Assignment 1 Description Marks out of Wtg() Due date .docx
Assignment 1  Description Marks out of Wtg() Due date .docxAssignment 1  Description Marks out of Wtg() Due date .docx
Assignment 1 Description Marks out of Wtg() Due date .docx
 
Low Power CMOS Analog Multiplier
Low Power CMOS Analog MultiplierLow Power CMOS Analog Multiplier
Low Power CMOS Analog Multiplier
 
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
PARASITIC-AWARE FULL PHYSICAL CHIP DESIGN OF LNA RFIC AT 2.45GHZ USING IBM 13...
 
Si Intro(100413)
Si Intro(100413)Si Intro(100413)
Si Intro(100413)
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Design and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applicationsDesign and implementation of cyclo converter for high frequency applications
Design and implementation of cyclo converter for high frequency applications
 
Ece523 folded cascode design
Ece523 folded cascode designEce523 folded cascode design
Ece523 folded cascode design
 
Current Transformers parameter design and graphs - size and design requirements
Current Transformers parameter design and graphs - size and design requirementsCurrent Transformers parameter design and graphs - size and design requirements
Current Transformers parameter design and graphs - size and design requirements
 
Lab sheet
Lab sheetLab sheet
Lab sheet
 
16th July 2015 Road lighting_modified
16th July 2015 Road  lighting_modified16th July 2015 Road  lighting_modified
16th July 2015 Road lighting_modified
 
Write your own generic SPICE Power Supplies controller models
Write your own generic SPICE Power Supplies controller modelsWrite your own generic SPICE Power Supplies controller models
Write your own generic SPICE Power Supplies controller models
 
CVT design
CVT designCVT design
CVT design
 

PSpice Tutorial

  • 1. PSPICE Tutorial Ankit G Doshi The University of Texas at Arlington July 22nd 2010
  • 2. Introduction SPICE - Simulation Program with Integrated Circuits Emphasis Developed by the University of California, Berkeley in 1960s Still widely used simulator for analog circuit simulations in industry and R&D centers. Types of input file Netlist - Type in the circuit using simple text. (*.cir) Schematics - Draw circuit using drag and drop parts. (*.sch)
  • 3. Where to get the software http://www.cadence.com/products/orcad/pages/downloads.aspx
  • 4. How to type in the given circuit Any SPICE input file is made up of 3 sections 1. Data statements - description of the components and the interconnections. 2. Control Statements - tells SPICE what type of analysis to perform on the circuit. 3. Output Statements - specifies what outputs are to be printed or plotted. Although these statements may appear in any order, it is recommended that they be given in the above sequence.
  • 5. How to type in the given circuit Two other statements are required: the title statement and the end statement. The title statement is the first line and can contain any information The end statement is always .END. This statement must be a line be itself, followed by a carriage return! In addition, you can insert comment statements, which must begin with an asterisk (*) and are ignored by SPICE. If one wants to continue a statement to the next line, one uses a "+" sign (continuation sign) at the beginning of the next line. Numbers can be integers, or floating points. SPICE is not case sensitive. (i.e. Vbus, VBUS, vbus all are same).
  • 6. A typical SPICE input file TITLE STATEMENT ELEMENT STATEMENTS . . COMMAND (CONTROL) STATEMENTS OUTPUT STATEMENTS .END <CR>
  • 7. Scale Factors T(= 1E12 or 10^12) G(= E9) MEG(= E6) K(= E3) M(= E-3) U(= E-6) N(= E-9) P(= E-12) F(= E-15)
  • 8. 1. Data Statements To Specify the Circuit Components and Topology
  • 9. Independent DC Sources Voltage source: Vname N1 N2 Type Value  Current source: Iname N1 N2 Type Value  N1 is the positive terminal node N2 is the negative terminal node Type can be DC, AC or TRAN, depending on the type of analysis Value gives the value of the source The name of a voltage and current source must start with V and I, respectively. Examples: Vin 2 0 DC 10 Is 3 4 DC 1.5
  • 10. Dependent Sources Voltage controlled voltage source: Ename N1 N2 NC1 NC2 Value Voltage controlled current source: Gname N1 N2 NC1 NC2 Value Current controlled voltage source: Hname N1 N2 Vcontrol Value Current controlled current source: Fname N1 N2 Vcontrol Value N1 and N2 are the positive and negative terminals of the dependent source, respectively. NC1 and NC2 are the positive and negative terminals of the controlling voltage source, respectively. Vcontrol is the zero value voltage source used to measure the controlling current (the positive current flows into the positive terminal of the controlling voltage source!). Example: Ebar 17 8 42 18 24.0 (VCVS) Glab  23  17    8     3    2.5 (VCIS) Hvx  20  12  Vhx       50.0 (CCVS)Vhx  80  76  DC        0V ; controls Hvx Ftrn   81   19   Vctl         50.0 (CCCS)Vclt   23   12   DC           0V ; controls Ftrn
  • 11. Resistors, Capacitors and Inductors Resistor: RnameN1 N2 Value Capacitor: Cname N1 N2 Value <IC> Inductor: Lname N1 N2 Value <IC> N1 is the positive node. N2 is the negative node. IC is the initial condition (DC voltage or current). The symbol < > means that the field is optional. If not specified, it is assumed to be zero. In case of an inductor, the current flows from N1 to N2. Example: Rin 3 4 100k Cc 7 8 20f 5 L3 2 0 6.25m 1m
  • 12. Sinusoidal Sources Sinusoidal Voltage Source:Vname N1 N2 SIN(VO VA FREQ TD THETA PHASE)  Vname = VO + VA exp[-THETA.(t - TD)] sin[2pi.f (t - TD) + (Phase/360)] VO - offset voltage in volt. VA - amplitude in volt. f = FREQ - the frequency in herz. TD - delay in seconds THETA - damping factor per second Phase - phase in degrees  If TD, THETA and PHASE are not specified, it is assumed to be zero.    Example: VG 1 2 SIN(5 10 50 0.2 0.1) VG2 3 4 SIN(0 10 50) To generate a cosine function, you can make use of the phase relationship between the sinusoid and cosine. Here is an example of an undelayed cosine with an amplitude of 5V and frequency of 50 Hz.  Vcos 1 2 SIN(0 5 50 0 0 90)
  • 13. Piecewise Linear Sources (PWL) Vname N1 N2 PWL(T1 V1 T2 V2 T3 V3 ...) in which (Ti Vi) specifies the value Vi of the source at time Ti  Example: Vgpwl 1 2 PWL(0 0 10U 5 100U 5 110U 0)
  • 14. Transformers SPICE has no model for an ideal transformer. An ideal transformer is simulated using two inductors mutual inducting on each other such that the transformer ratio N1/N2 = sqrt(L1/L2). Make the coupling factor K close to one (ex. K=0.99999). The secondary circuit needs a DC connection to ground. This can be accomplished by adding a large resistor to ground or giving the primary and secondary circuits a common node.
  • 15. Transformers (Cont.) Example transformer VIN 2 0 SIN(0 170 60 0 0) * This defines a sinusoid of 170 *amplitude and 60 Hz. RS 2 1 10 L1 1 0 2000 L2 3 0 20 K L1 L2 0.99999 .TRAN 0.2M 25M .PLOT TRAN V(2) .PLOT TRAN V(3) .END
  • 16. Subcircuits A subcircuit allows you to define a collection of elements as a subcircuit (e.g. an operational amplifier) and to insert this description into the overall circuit (as you would do for any other element). It is a kind of function or subroutine in C. Defining a subcircuit  A subcircuit is defined by a .SUBCKT control statement, followed by the circuit description as follows:      .SUBCKT SUBNAME N1 N2 N3 ... Element statements Element statements Element statements ENDS SUBNAME in which SUBNAME is the subcircuit name and N1, N2, N3 are the external nodes of the subcircuit. The external nodes cannot be 0. The node numbers used inside the subcircuit are strictly local, except for node 0 which is always global.
  • 17. Subcircuits (Cont.) .SUBCKT OpAmpp_inn_in com out Ex int com p_inn_in 1e5 Rip_inn_in 500k Ro int out 50.0 .ENDS
  • 18. Subcircuits (Cont.) Using a subcircuit  The element statement for a subcircuit is similar to any other element. The format is as follows: Xname N1 N2 N3 ... SUBNAME Where Xname refers to the element (subcircuit) being used N1, N2, N3 are the nodes to which the external nodes of the subcircuit are being connected SUBNAME is the name of the subcircuit being used. 
  • 19. Subcircuits (Cont.) Subcircuit Example - Inverting OpAmp .SUBCKT OpAmpp_inn_in com out Ex int com p_inn_in 1e5 Rip_inn_in 500k Ro int out 50.0 .ENDS Vg 1 0 DC 50mV Rg 1 2 5k Rf 2 3 50k RL 3 0 20k X1 0 2 0 3 OpAmp .END
  • 20. Semiconductor Devices Most of the elements that have been described above require only a few parameters to specify its electrical characteristics. However, the models for semiconductor devices require many parameter values. A set of device model parameters is defined in a separate .MODEL statement and assigned a unique name. Thus a semiconductor device is specified by two command lines: an element and model statement. Element Line: ElementName N+ N- MODName Model Statement: .MODEL MODName Type (parameter values) MODName is the name of the model for the device. Type refers to the type of device and can be any of the following: D: Diode NPN: npn bipolar transistor PNP: pnp bipolar transistor NMOS: nmos transistor PMOS: pmos transistor NJF: N-channel JFET model PJF: P-channel JFET model
  • 21. Semiconductor Devices (Cont.) Diode Element line: Dname N+ N- MODName Model Statement: .MODEL MODName D (IS= N= Rs= CJO= Tt= BV= IBV=) Example: D1 5 3 D1N4148 .model D1N4148 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA)
  • 22. Semiconductor Devices (Cont.) BJT Element Line: Qname C B E BJT_modelName Model statement: .MODEL BJT_modName NPN (BF=val IS=val VAF=val) Example: Q3 4 2 0 Q2N2222A .model Q2N2222A NPN (IS=14.34F XTI=3 EG=1.11 VAF= 74.03 BF=255.9 + NE=1.307 ISE=14.34F IKF=.2847 XTB=1.5 BR=6.092 NC=2 ISC=0 IKR=0 + RC=1 CJC=7.306P MJC=.3416 VJC=.75 FC=.5 CJE=22.01P MJE=.377 + VJE=.75 TR=46.91N TF=411.1P ITF=.6 VTF=1.7 XTF=3 RB=10)
  • 23. Semiconductor Devices (Cont.) MOSFET Element Line: Mname ND NG NS <NB> ModName L= W= Model statement: .MODEL ModName NMOS (KP= VT0= lambda= gamma=) Example: M5 4 2 0 CMOSN .model CMOSN NMOS (LEVEL=3 PHI=0.600000 TOX=2.1200E-08 XJ=0.200000U +TPG=1 VTO=0.7860 DELTA=6.9670E-01 LD=1.6470E-07 KP=9.6379E-05 +UO=591.7 THETA=8.1220E-02 RSH=8.5450E+01 GAMMA=0.5863 +NSUB=2.7470E+16 NFS=1.98E+12 VMAX=1.7330E+05 ETA=4.3680E-02 +KAPPA=1.3960E-01 CGDO=4.0241E-10 CGSO=4.0241E-10 +CGBO=3.6144E-10 CJ=3.8541E-04 MJ=1.1854 CJSW=1.3940E-10 +MJSW=0.125195 PB=0.800000)
  • 24. 2. Control Statements Tells SPICE what type of analysis to perform on the circuit.
  • 25. .OP Statement This statement instructs Spice to compute the DC operating points: voltage at the nodes current in each voltage source operating point for each element
  • 26. .DC Statement This statement allows you to increment (sweep) an independent source over a certain range with a specified step. The format is as follows: .DC SRCname START STOP STEP in which SRC name is the name of the source you want to vary; START and STOP are the starting and ending value, respectively; and STEP is the size of the increment. Example: .DC V1 0 20 2
  • 27.
  • 28. Other Control Statements .NOISE - For NOISE Analysis .DISTO - For DISTORTION Analysis .FOUR - For FOURIER Analysis etc.
  • 29. 3. Output Statements These statements will instruct PSpice what output to generate. If you do not specify an output statement, PSpice will always calculate the DC operating points.
  • 30. .PRINT Statement It generates is a table of data points. Format: .PRINT TYPE OV1 OV2 OV3 ... in which TYPE specifies the type of analysis to be printed or plotted and can be: DC, TRAN, AC Example: .PRINT TRAN V(3,1) I(Vmeas)
  • 31. .PROBE Statement It generates is a plot. Format: .PROBE When using .PROBE statement as output, after successfully simulating the netlist a blank graph is generated. User has to manually insert traces of interest to see the graph.
  • 33. Example 1 (Cont.) EXAMPLE Pspice TITLE Line VIN 1 0 DC 10  F1 0 3 VMEAS 0.5 | VMEAS 4 0 DC 0 | R1 1 2 1K | R2 2 3 10K |DATA R3 1 3 15K | R4 2 4 40K | R5 3 0 50K  .OP  .TF V(3,0) VIN |CONTROL .DC VIN 0 20 2  .PRINT DC V(1,2) V(2,4) I(VMEAS)  OUTPUT .PROBE  OUTPUT .END  END Statement
  • 35. Example 2 (Cont.) Full wave rectifier power supply Vin 5 0 SIN(0 170 60) * Transformer L1 6 0 330 L2 1 0 3 K L1 L2 0.99999 RS 5 6 0.1 *Bridge D1 2 1 diode D2 2 0 diode D3 1 3 diode D4 0 3 diode R 3 4 98 C 3 2 425u RL 4 2 450 D 2 4 mod1 .model diode D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA) .model mod1 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=10 IBV=0.1PA) .TRAN 0.2m 10 .PROBE .END
  • 36. References SPICE – Brief Tutorial, By Jan Van derSpigel from University of Pennsylvania SPICE, A Guide to Circuit Simulation and Analysis Using PSpice, 3rd Ed. By P. Tuinenga, Prentice Hall, Upper Saddle River, NJ, 1995 PSPICE Tutorial, By Dr. Dillon from The University of Texas at Arlington (http://www.uta.edu/ee/hw/pspice/)