Professional Documents
Culture Documents
0s 1ms 2ms 3ms 4ms 5ms 6ms 7ms 8ms 9ms 10ms
V(out) AVG (V(out))
0V
20V
40V
V(error) AVG (V(error))
-20V
0V
20V
V(control) AVG (V(control))
0V
10V
20V
SEL>>
AVG (V(out))
V(out)
V(error)
AVG(V(error))
V(control)
AVG(V(control))
Chapter 9
Simulation
of
Switching Converters
Power switching converters Simulation of switching converters 2
Overview
PSpice
Matlab
Simulink
Power switching converters Simulation of switching converters 3
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
L
O
10mH
C
O
R
V
PWM
+
-
1 2
0
100F
5O
Open-loop buck converter simulation
* SWITCHING FREQUENCY = 1 KHZ ; DUTY CYCLE = 50%
VPWM 1 0 PULSE(0 10 0 1US 1US 0.5MS 1MS)
* PULSE PWM SOURCE: PULSED VOLTAGE = 10 V, RISE TIME = 1 US,
* FALL TIME = 1 US, PULSE WIDTH = 500 US, PERIOD = 1 MS.
L0 1 2 10M
C0 2 0 100U
RL 2 0 5
.TRAN 50US 20MS
.OPTION ITL5=0
.PROBE
.END
Power switching converters Simulation of switching converters 4
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms
V1(RL) I(C0) I(L0)
-4.0
0
4.0
8.0
I(C0)
I(L0)
V1(RL)
Power switching converters Simulation of switching converters 5
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms 45ms 50ms
I(C0) I(L0) V(2)
-2.0
0
2.0
4.0
6.0
I(CO)
I(LO)
V(2)
L = 50 mH
Power switching converters Simulation of switching converters 6
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms
V(2) I(LO) I(CO)
0
2.0
4.0
6.0
-1.0
V(C2)
I(LO)
I(CO)
L = 5 mH
Power switching converters Simulation of switching converters 7
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms
V(2) I(LO) I(CO)
-2
0
2
4
6
8
10
V(2)
I(LO)
I(CO)
L = 1.25 mH
Power switching converters Simulation of switching converters 8
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms
V(2) I(LO) I(CO)
-2.0
0
2.0
4.0
6.0
8.0
I(CO)
I(LO)
V(2)
L = 10 mH
and
C = 500 uF
Power switching converters Simulation of switching converters 9
PSpice Simulations using .CIR
An Ideal Open-Loop Buck Converter
Time
0s 5ms 10ms 15ms 20ms
V(2) I(LO) I(CO)
-5
0
5
10
I(CO)
I(LO)
V(2)
L = 1.25 mH
and
C = 500 uF
Power switching converters Simulation of switching converters 10
PSpice Simulations using .CIR
S
R
on
N
N
N
+
c
+
N
-
-
c
Voltage-controlled switch
S<name> N+ N- NC+ NC- SNAME
.MODEL SNAME VSWITCH (RON=0.01 ROFF=1E+7 VON=0.7 VOFF=0)
Power switching converters Simulation of switching converters 11
PSpice Simulations using .CIR
Current-controlled switch
R
on
W
N
-
+
N
N
V
W<name> N+ N- VN WNAME
.MODEL WNAME ISWITCH (RON=0.01 ROFF=1E+7 ION=0.1 IOFF=0)
Power switching converters Simulation of switching converters 12
PSpice Simulations using .CIR
Buck Converter with an Ideal Switch
CO
100uf
LO
10mH
1
S1
VPWM
DFW
0
VS 10V R
5ohms
2
RSX
3
OPEN-LOOP BUCK CONVERTER WITH AN IDEAL SWITCH
* SWITCHING FREQUENCY = 1 KHZ ; DUTY CYCLE = 50%
VS 1 0 10.0
VPWM 100 101 PULSE(0 1 0 1US 1US 500US 1MS)
S1 1 2 100 101 SX
RSX 100 0 10G
DFW 0 2 D1
L0 2 3 10M
C0 3 0 100U
RL 3 0 5
.MODEL SX VSWITCH (RON=0.01 ROFF=1E+7 VON=1 VOFF=0)
.MODEL D1 D
.TRAN 0.05MS 20MS
.PROBE
.END
Power switching converters Simulation of switching converters 13
PSpice Simulations using .CIR
Buck Converter with an Ideal Switch
Time
0s 5ms 10ms 15ms 20ms
V(3) I(LO) I(CO)
0
2.0
4.0
6.0
-1.0
I(CO)
I(LO)
V(3)
Power switching converters Simulation of switching converters 14
PSpice Simulations using .CIR
Buck Converter with an Ideal Switch
Time
15.0ms 15.5ms 16.0ms 16.5ms 17.0ms 17.5ms 18.0ms
V(3) 20* I(CO)
0
5.0
-3.0
I(CO)*20
V(3)
Power switching converters Simulation of switching converters 15
PSpice Simulations using .CIR
L0 2 3 100U IC=1
C0 3 0 IC=5
.TRAN 2NS 200NS UIC
Using Initial Conditions IC
Time
0s 5ms 10ms 15ms 20ms
V(3) I(LO) I(CO)
0
2.0
4.0
6.0
-1.0
I(CO)
I(LO)
V(3)
Power switching converters Simulation of switching converters 16
PSpice Simulations using schematics
entry
Boost converter
+
-
+
-
S
1
S
VON = 1.0V
VOFF = 0.0V
ROFF = 1e6
RON = 1.0
pwm
D
break
D
1
0
V
2 TD = 0
TF = 1n
PW = 0.5m
PER = 1m
V1 = 0
TR = 1n
V2 = 1 R1 C
1
V
1
10V
dc
out
L
1
10mH
20O
+
-
100F
Power switching converters Simulation of switching converters 17
PSpice Simulations using schematics
entry
Time
0s 5ms 10ms 15ms 20ms 25ms 30ms
V(out)
5V
10V
15V
20V
25V
Power switching converters Simulation of switching converters 18
PSpice Simulations using schematics
entry
Time
0s 5ms 10ms 15ms 20ms 25ms 30ms
I(L
1
) I(C
1
)
-2.0A
-1.0A
0A
1.0A
2.0A
3.0A
I(C
1
)
I(L
1
)
Power switching converters Simulation of switching converters 19
PSpice Simulations Using
Behavioral Modeling
_
_
+
,
,
2
2
1 1
1 10 1 10 10
( ) 20 (2 ) 40 1 40 1
comp
z p
f f
M f Log f Log Log
f f
_
_
_
_
+ + +
,
,
,
,
1
1
1
1
90 2tan
tan
2
comp
p
z
z
f
f
f
f
f
_
_
+ +
,
,
( )
2
2 1
1 10 1 10 1 10
( ) 20 (2 ) 40 1 40 1
comp z
p
f
M f Log f Log f Log
f
_
_
+ + +
,
,
Power switching converters Simulation of switching converters 63
PID compensation
1 p
3 3
1
= f
2
C R
2
1 2
p
2 1 2
( + )
C C
= f
2
C C R
1 z
2 1
1
= f
2
C R
2 z
1 3 3
1
= f
2 ( + )
C R R
2
1
1
R
=
K
R
2 1 3
2
1 3
( + )
R R R
=
K
R R
3 1 2
3
2 1 2
C C R
= .
C
+
C C R
Mag_comp_f1 = -7.0985
Ph_comp = 32
k1_db = -24.6094
k1 = 0.0588
k2_db = -5.0259
k2 = 0.5607
R2 = 588.2076
R3 = 269.7258
C1 = 5.0034e-005
C2 = 1.3496e-006
C3 = 2.8658e-006
Power switching converters Simulation of switching converters 64
Boost switching converter with
PID compensator
-15
pwm
R
s
1
+15
saw
C
out
100uF
IC = 20
L
1
10mH
IC = 4
C
1
5.0014e-005
R
2
518.3291
V
1
10V
dc
0
R
1
10k
0
-15
sense
R
6
100
V
3
-15
out
5
+15
LM311
+
- G
V
+
V
-
B/S
B
R
s3
1k
0
0
D
1
MUR420
+15
C
3
2.5483e-006
Error amplifier
R
20
R
4
10meg
V
ref
V
4
TD = 0
TF = 1n
PW = 1n
PER = 1m
V1 = 0
TR = 999u
V2 = 10
R
s2
3k
TL084
+
-
V
+
V
-
E
SR
10m
R
8
300
R
3
173.0498
V
2
`15
control
V
X2
MTP15N05E/MC
PWM
modulator
C
2
1.1461e-006
-15
pwm_out
+
-
Power switching converters Simulation of switching converters 65
Simulation results with a PID
compensator
Time
0s 5ms 10ms 15ms 20ms 25ms 30ms
V(out)
0V
20V
40V
V(control)
5.0V
7.5V
10.0V
SEL>>
I(L
1
)
4.0A
4.5A
5.0A
Power switching converters Simulation of switching converters 66
PI compensation
0
C
out
200uF
IC = 0
0
EAO
0
10
-10
L
1
10mH
IC = 0
V
g
10V
dc
R
s
1
out
100k
R
esr
10m
0
10
10 + s
error
R
20
V
f
0
R
1
1k
V
1
1V
ac
0V
dc
V
f
C
1
500n
U7
VMSSCCM
D = 0.5
IC = -1.84
RD = 1e-6
RE = 10m
RM = 1e-6
RMPHITE = 10
RSW = 10m
VAP = -17.6
1
3
2
4
A
C
P
V
C
0
-
+
+
-
E1
E
GAIN = 0.25
R
2
10k
+
-
Small-signal model of the boost converter with PI
compensation
1 1
1 2
1 s C R
TF
s C R
+
Start the PSpice Model Editor and from the File menu, choose
Create Parts
Browse to find the input model library (.LIB file) and click
OK to start
To place the new part into the schematic, open Capture, and
from the Place menu choose Part. Click Add library, then find
and add the new .OLB file
Power switching converters Simulation of switching converters 74
Solving convergence problems
No convergence in DC analysis
PIVTOL Error
Singular Matrix
Set RELTOL=.01
+ +
$
2
(1 )
s
d
V
K
D
1
1
z
ESR
s
R C
2
2
(1 )
( || )
ind
z ESR
R D
s R R R
L L
0
(1 ) 1
ind e
ESR
R r D D
R R
LC
+
||
e ESR
r R R
0
(1 ) 1
( )
ind e
ESR
Q
R r D
L C R R
+
+
+
Power switching converters Simulation of switching converters 93
Switching converter simulation using
Matlab
% this is a comment
% parameters
R= 4;
L = 1.330 e-3;
Rind = 100 e-3;
C = 94 e-6;
Resr = 10 e-3
Vs = 42;
Va = 12;
D=Va/Vs;
Kd= Vs/(1-D)^2;
Sz1=1/(Resr*C);
Req = R-(Resr*R/(Resr+R));
Sz2 = (1/L)*(1-D)^2* Req Rind/L;
Re=(Resr*R)/( Resr+R);
Wo = (1/sqrt(L*C)) * sqrt((Rind+re*D*(1-D))/(Resr+R));
Q = Wo/(((Rind+re*(1-D))/L)+(1/(C*(Resr+R))));
Power switching converters Simulation of switching converters 94
Switching converter simulation using
Matlab
% polynomials are entered in descending order of S.
n1=[1/Sz1 1]
n2=[-1/Sz2 1]
NUM=conv(n1,n2)
% the convolution realizes the product of 2 polynomials
% define denumerator
DEN = [1/(Wo^2) 1/(Wo*Q) 1]
% create TF variable
sysTF = Kd * tf(NUM,DEN)
which returns
Transfer function:
-5.317e-008 s^2 - 0.05648 s + 82.32
4.913e-006 s^2 + 0.01343 s + 1
sysTF
Power switching converters Simulation of switching converters 95
Switching converter simulation using
Matlab
The location of the poles can be
found using
poles = roots(DEN)
and the frequency response can be
plotted using
bode(sysTF)
Bode Diagram
Frequency (rad/sec)
P
h
a
s
e
(
d
e
g
)
M
a
g
n
i
t
u
d
e
(
d
B
)
-40
-20
0
20
40
10
1
10
2
10
3
10
4
10
5
10
6
10
7
-270
-225
-180
-135
-90
-45
0
Power switching converters Simulation of switching converters 96
Switching converter simulation using
Matlab
The small signal transient step response can be plotted using
Figure % this command opens a new figure window
step(sysTF) Step Response
Time (sec)
A
m
p
l
i
t
u
d
e
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
-10
0
10
20
30
40
50
60
70
80
90
Power switching converters Simulation of switching converters 97
Switching converter simulation using
Matlab
Working with matrices
Consider a buck converter designed to operate in the continuous conduction mode
having the following parameters: R = 4, L = 1.330 mH, C = 94 f, Vs = 42 V,
Va = 12 V.
% state-space averaged model of a Buck converter
Rload= 4;% load resistance
L= 1.330e-3; % inductance
cap=94.e-6; % capacitance
Ts=1.e-4; % switching period
Vs=42; % input DC voltage
Vref=12; % desired output voltage
The average duty cycle is:
D=Vref/(Vs); % ideal duty cycle
Power switching converters Simulation of switching converters 98
Switching converter simulation using
Matlab
^
^ ^ ^
1
^
2
1
0
1 1
0 0
s
V D
x
L
x u d
L L
x
C RC
1 1 1 1
1 1 1 1
+ +
1 1 1 1
] ] ] ]
A=[ 0 -1/L
1/cap -1/(Rload*cap)]
B1=[ 1/L
0]; %during Ton
B2=[ 0
0]; %during Toff
B=B1*D+B2*(1-D)
C=[0 1];
Power switching converters Simulation of switching converters 99
Switching converter simulation using
Matlab
OLpoles = eig(A)
sysOL=ss(A,B,C,0)
step(sysOL)
Time (sec.)
A
m
p
l
i
t
u
d
e
Step Response
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
x 10
-3
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
From: U (1)
T
o
:
Y
(
1
)
Power switching converters Simulation of switching converters 100
Switching converter simulation using
Matlab
gamma=[ Vs/L
0];
closed-loop poles:
P=1e3*[-0.3298 + 0.10i -0.3298 - 0.10i]';
Bf= gamma*(D/Vref);
F=place(A,Bf ,P)
Power switching converters Simulation of switching converters 101
Switching converter simulation using
Simulink
-5.317e-8 s^2 - 0.05648 s + 82.32
4.913e-6 s^2 + 0.01343 s + 1
sysTF
[NUM,DEN] = TFDATA(sysTF,v)
-5.317e-8s -0.0565s+82.32
2
4.913e-6s +0.0134s+1.0
2
Transfer Fcn
time
To Workspace1
output
To Workspace
Step Scope
Clock
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
-10
0
10
20
30
40
50
60
70
80
90
Time (s)
O
u
t
p
u
t
Power switching converters Simulation of switching converters 102
Switching converter simulation using
Simulink
sysZPK = zpk(sysTF)
-0.010821 (s+1.064e006) (s-1455)
(s+2657) (s+76.6)
sysZPK
zeroes: [-1.0638e+006 +1455]
poles: [-2657 -76.6]
gain: [-0.010821]
Power switching converters Simulation of switching converters 103
Switching converter simulation using
Simulink
[ ]
[ ]
0 752
10638 2660
214.82 0 '
0 1 '
0
A
B
C
D
1
time
To Workspace1
output
To Workspace
Step
x' = Ax+Bu
y = Cx+Du
State-Space
Scope
Clock