Академический Документы
Профессиональный Документы
Культура Документы
2
Full form of SPICE
3
WHY SIMULATE?
4
To run Spice
• Start P-Spice
• Draw a schematic of the circuit (can
be skipped)
or
• Create an input file describing circuit
• Run the program
• Look at the output file and/or print
the results
5
To start with P-Spice A/D
• Create a new text file
• Write program in the text file
• Save the program
• Open the circuit file
• Run the program
• See required output file
6
Input File of P-Spice A/D
• A SPICE input file, called source file, consists of
five parts :
Page 38 Page 35 7
Format for a SPICE file
• titles statement
• circuit description
• analysis requests
• output requests
.end
8
Some Facts and Rules
about P-Spice A/D
• PSpice is not case sensitive
– Names such as Vbus, VBUS, vbus50
andHz ACvBuS
even Circuit
are equivalent
in the program. Vs 1 0 AC 120V 0
• All element names must be uniqueRg 1 2 0.5
– Therefore, you can't have two resistors that are named "R2“
and “r2“ Lg 2 3 3.183mH
• The first line in the data file is usedRm 3 as 4a title
16.0
Lm data.
– PSpice will ignore this line as circuit 4 0 31.83mH
Cx 3 0 132.8uF
– Do not place any actual circuit information in the first line.
• There must be a node designated.AC "0"LIN 1 50. 50
(Zero)
– This is the reference node against .PRINT ACvoltages
which all VM(3) VP(3)
are
calculated +IM(Rm) IP(Rm) IM(Cx)
• Each node must have at least two+IP(Cx) elements attached to it
.END
9
Some Facts and Rules about
PSpice (Contd….)
• All lines that are not blank (except for the title line) must
have a character in column 1, the leftmost position on the
line
Use "*" (an asterisk) in column 1 in order to create a comment
line
10
Some more Facts and
Rules about P-Spice A/D
• Use ";" (semicolon) to terminate data on a line if
you wish to add commentary information on that
same line
11
Large and Small Numbers in
PSpice
Number symbol Common Name
12
An alternative approach
• “Textual scientific notation"
This notation is written by typing an "E" followed
by a signed or unsigned integer indicating the
power of ten
656,000 = 6.56E5
-0.0000135 = -1.35E-5
8,460,000 = 8.46E6
13
Types of circuit analyses
• Linear DC analysis
• Linear AC analysis
• Linear AC Analysis: calculates the output as a
function of frequency. A bode plot is generated.
• Linear Transient analysis (time domain)
• Non-linear transient analysis
• Noise analysis
• Sensitivity analysis
• Distortion analysis
• Fourier analysis: calculates and plots the
frequency spectrum.
14
Components
• Independent and dependent voltage and current
sources
• Resistors
• Capacitors
• Inductors
• Mutual inductors
• Transmission lines / paths
• Operational amplifiers
• Switches
• Diodes
• Bipolar transistors
• Digital gates
15
Data Statements to Specify the
Circuit Components and Topology
• name a component
• designate the nodes where it's connected,
• and give it a value.
For example,
RS 1 2 1000 ;
16
Data Statements to Specify the
Circuit Components and Topology….
• VOLTAGE SOURCE
SPICE has many voltage sources
available:
SINEWAVE, PULSE, AC, DC, etc.
17
Data Statements to Specify the
Circuit Components and Topology….
• Time domain example
18
To Start With ………
Independent DC Sources
Voltage source: Vname N1 N2 Type Value
Current source: Iname N1 N2 Type Value
19
Independent voltage
sources
Examples:
*name +node -node type value comment
vwx 14 23 DC -1.8E4 ;
20
Independent current
source
*name +node -node type value comment
I12 43 29 DC 1.5E-4 ;
21
Resistors
22
Linear Inductors in PSpice
23
Mutual Inductances in PSpice
*name node1 node2 inductance (comment line)
L1 1 2 40mH
L2 3 4 10mH
24
Linear Capacitors in Pspice
25
Example1
EXMPL01.CIR • Circuit Diagram
Vs 1 0 DC 20.0V
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA
.END
27
Still More Components ……
D device – Diode
M device – MOSFET
Q device - Bipolar Transistor
S device - Voltage-Controlled Switch
T device - Transmission Line
K device - Inductor Coupling
X device – Sub-circuit Call
28
Commands or Control Statements
to Specify the Type of Analysis
.DC Statement [DC Analysis]
This statement allows you to increment
(sweep) an independent source over a certain
range with a specified step
29
Commands or Control Statements
to Specify the Type of Analysis
.TRAN Statement [Transient Analysis]
This statement specifies the time interval
over which the transient analysis takes
place, and the time increments.
.TRAN TSTEP TSTOP <UIC>
.TRAN 5NS 100NS
30
Output Statements
The two types of outputs are the prints and plots.
31
Output Statements
Examples:
32
Output Statements
.PROBE
This statement that causes PSpice to save the
data in a Common Simulation Data Format (CSDF)
which is a text format that allows us to look at
the raw data with a text editor
.PROBE V(5,23) I(Rx) I(L4)
The above statement tells PSpice to save only the voltage
drop between nodes 5 and 23, the current through resistor,
Rx, and the current through inductor, L4, all in binary
format. No other data will be saved.
33
Programming in PSPICE
DC Analysis
Vs 1 0 DC 20.0V
Ra 1 2 5.0k
Rb 2 0 4.0k
Rc 3 0 1.0k
Is 3 2 DC 2.0mA
.DC vs 0 20 2
.probe I(Rb) ; how I varies with Vs
.END
43 Page 7 35
DC Analysis in PSpice
Probe the magnitude of current through Rb as Vs
is varied from 0 to 20 Volts.
36
AC Analysis in PSpice
Print the magnitude and phase of voltage across
capacitor Cx and also magnitude and phase of
current flowing through Rm at 50 Hz.
50 Hz AC Circuit
Vs 1 0 AC 120V 0
Rg 1 2 0.5
Lg 2 3 3.183mH
Rm 3 4 16.0
Lm 4 0 31.83mH
Cx 3 0 132.8uF
.AC LIN 1 50 50
.PRINT AC VM(3) VP(3)
+IM(Rm) IP(Rm) IM(Cx)
+IP(Cx)
.END
43 Page 7 37
Steady-State AC Analysis in PSpice
50 Hz AC Circuit
**** SMALL SIGNAL BIAS SOLUTION TEMPERATURE
= 27.000 DEG C
*************************************************************
*****************
NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE
NODE VOLTAGE
( 1) 0.0000 ( 2) 0.0000 ( 3) 0.0000 ( 4)
0.0000
VOLTAGE SOURCE CURRENTS
NAME CURRENT
Vs 0.000E+00
TOTAL POWER DISSIPATION 0.00E+00 WATTS
*************************************************************
*****************
FREQ VM(3) VP(3) IM(Rm) IP(Rm) IM(Cx)
5.000E+01 1.188E+02 -2.937E+00 6.296E+00 -3.494E+01
4.956E+00
FREQ IP(Cx)
5.000E+01 8.706E+01
JOB CONCLUDED
TOTAL JOB TIME 0.00
38
Using P-Spice to find Thevenin’s
Equivalent Circuit
5 Ohm 10 Ohm
1 2 3
A
B
0
THEVENIN EQUIVALENT CIRCUIT
V1 1 0 DC 10
R1 1 2 5
R2 2 0 5
R3 2 3 10
R4 3 0 5
.TF V(3,0) V1
.END
39
Using P-Spice to find Thevenin’s
Equivalent Circuit
THEVENIN VOLTAGE
**** SMALL SIGNAL BIAS SOLUTION TEMPERATURE = 27.000 DEGC
***********************************************************************
*******
NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE NODE
VOLTAGE
( 1) 10.0000 ( 2) 4.2857 ( 3) 1.4286
VOLTAGE SOURCE CURRENTS
NAME CURRENT
V1 -1.143E+00
TOTAL POWER DISSIPATION 1.14E+01 WATTS
**** SMALL-SIGNAL CHARACTERISTICS
V(3,0)/V1 = 1.429E-01 Transfer Function
INPUT RESISTANCE AT V1 = 8.750E+00
OUTPUT RESISTANCE AT V(3,0) = 3.571E+00 Thevenin’s Resistance
JOB CONCLUDED
TOTAL JOB TIME .02
40
Application of Thevenin’s Theorem
5 Ohm 10 Ohm
1 2 3
APPLICATION OF THEVENIN'S THEOREM
I(5 V1 1 0 DC 10
10V 5 Ohm
5 Ohm Ohm) R1 1 2 5
R2 2 0 5
R3 2 3 10
0 R4 3 0 1Meg
.TF V(3,0) V1
.END
41
Application of Thevenin’s Theorem
THEVENIN EQUIVALENT CIRCUIT
**** SMALL SIGNAL BIAS SOLUTION TEMPERATURE = 27.000
DEG C
*********************************************************************
*********
NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE NODE
VOLTAGE
( 1) 10.0000 ( 2) 5.0000 ( 3) 4.9999
VOLTAGE SOURCE CURRENTS
NAME CURRENT
V1 -1.000E+00
TOTAL POWER DISSIPATION 1.00E+01 WATTS
**** SMALL-SIGNAL CHARACTERISTICS
V(3,0)/V1 = 5.000E-01 Transfer Function
INPUT RESISTANCE AT V1 = 1.000E+01
OUTPUT RESISTANCE AT V(3,0) = 1.250E+01 Thevenin’s Resistance
JOB CONCLUDED
TOTAL JOB TIME 0.00
42
Example of Transient
Circuit Analysis
Natural Response of a parallel RLC circuit
Rp 0 1 1.0
Lp 1 0 8mH IC=20A
Cp 1 0 10mF IC=0V
.TRAN 500us 100ms
.PROBE
.END
43
Example of Transient Circuit
Analysis
Voltage across node 1 & 0 (V1)
44
Example of Transient Circuit
Analysis
Current through inductor I(Lp)
45
R-C Series Circuit
Transient Analysis
RC transient analysis
Vpulse 1 0 pulse(0 5 0 0 0 50m 100m)
R 1 2 20
C 2 0 500u R
47
R-C Series Circuit
Transient Analysis
Charging Current through R I(R)
48
Assignment Sheet
1. Write down a SPICE program to calculate the current
through the 5 ohm resistance in the following circuit
given below.
49
Circuit Example
Example_1 EXMPL01.CIR
Va 1 0 DC 20.0V ; note the node placements
Vb 4 0 DC 10.0V
Vc 5 0 DC 50.0V
R1 1 2 15.0
R2 4 2 10.0
R3 3 2 20.0
R4 3 5 10.0
R5 3 0 5.0
.END
The output file EXMPL01.OUT is below. This has been edited to remove
extra lines.
Example_1 EXMPL01.CIR <== Title Line
Va 1 0 DC 20.0V ; note the node placements
Vb 4 0 DC 10.0V
Vc 5 0 DC 50.0V
R1 1 2 15.0
.DC Va 20 20 1 ; this enables the .print R2 4 2 10.0
commands R3 3 2 20.0
.PRINT DC V(1,2) I(R5) R4 3 5 10.0
R5 3 0 5.0
.DC Va 20 20 1 ; this enables the .print commands
.PRINT DC V(1,2) I(R5)
.END
Example_1 EXMPL01.CIR <== Title Line
**** DC TRANSFER CURVES TEMPERATURE = 27.000 DEG C
Va V(1,2) I(R5)
2.000E+01 5.455E+00 3.273E+00
JOB CONCLUDED
TOTAL JOB TIME .02 50
Assignment Sheet
2. Use PSpice to find voltage across 103.2ohm in the circuit
given below. Magnitude of voltage is varied between 5 to
105 v in steps of 10v.
51
Program:assign.2
50 Hz AC Circuit
Vs 2 0 AC 105V 0
R1 1 0 36.0
R2 1 0 12.0
R3 1 2 74.0
R4 2 3 16.4
R5 3 4 103.2
R6 0 4 28.7
.AC LIN 1 50 50
.step Vs 5 105 10
*.step variable startvalue stopvalue incrementstep
.PRINT AC V(3,4)
.END
52
Assignment Sheet
3. A circuit with two coupled inductors is shown in figure
below. If the input voltage is120V peak; calculate the
magnitude and phase of the output current for
frequencies varying 60 to 120Hz with a linear increment
using PSpice. The total number of points in the sweep is
2.The coefficient of coupling for the transformer is
0.999.
53
Program:assign.3
mutuAL inductance
Vin 1 0 ac 120
R1 1 2 0.5
R2 4 3 0.5
RL 4 0 150
L1 2 0 0.5M
L2 0 3 0.5M
K L1 L2 0.999 n+ node is taken as that
.ac lin 2 60 120 node where
*.AC [LIN] {points} {fstart} {fend}
Dot is marked
.PRINT AC IM(RL) IP(RL)
.END
54
Using P-Spice to find Thevenin’s
Equivalent Circuit
Thevenin Example- No. 2
Vs 2 5 DC 100V
Vc 2 3 DC 0V; controls Fx
Fx 6 7 Vc 4.0; gain = 4
* n+ n- NC+ NC gain
Ex 2 1 5 4 3.0; gain = 3
R1 3 4 5.0
R2 4 7 5.0
R3 5 4 4.0
R4 7 0 4.8
R5 5 6 1.0
R10 1 0 1MEG; satisfies PSpice
* out_var input_source
.TF V(1,0) Vs
.END
32
29 55
Using P-Spice to find Thevenin’s
Equivalent Circuit
Thevenin Example No. 2
**** CIRCUIT DESCRIPTION
Vs 2 5 DC 100V
Vc 2 3 DC 0V; controls Fx
Fx 6 7 Vc 4.0; gain = 4.0
Ex 2 1 5 4 3.0; gain = 3.0
R1 3 4 5.0
R2 4 7 5.0
R3 5 4 4.0
R4 7 0 4.8
R5 5 6 1.0
Rab 1 0 1MEG
.TF V(1,0) Vs
Thevenin Example No. 2
**** SMALL SIGNAL BIAS SOLUTION TEMPERATURE = 27.000 DEG C
NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE NODE VOLTAGE
( 1) 180.0000 ( 2) -60.0010 ( 3) -60.0010 ( 4) -80.0010
( 5) -160.0000 ( 6) -176.0000 ( 7)-864.0E-06
VOLTAGE SOURCE CURRENTS
NAME CURRENT
Vs -4.000E+00
Vc 4.000E+00
TOTAL POWER DISSIPATION 4.00E+02 WATTS
**** SMALL-SIGNAL CHARACTERISTICS
V(1,0)/Vs = 1.800E+00 <== Transfer function
INPUT RESISTANCE AT Vs = 2.500E+01
OUTPUT RESISTANCE AT V(1,0) = 5.000E+00 <== Thévenin resistance
JOB CONCLUDED
TOTAL JOB TIME .01 56
THANK
YOU
57