5807 matlabsimulink intro
TRANSCRIPT
-
8/13/2019 5807 MATLABSimulink Intro
1/37
Introduction to Switched-Mode Converter Modeling
using MATLAB/Simulink MATLAB: programming and scripting environment
-
Motivation: Powerful environment for system modeling and simulation
More sophisticated controller models, analysis and design tools
But*: - ,
Not a traditional circuit simulator; specialized physics-based Spicedevice models or component libraries are not readily available
*Various add-ons to Simulink are available to allow traditional circuit diagramentry and circuit simulations (e.g. SimPowerSystems, PLECS), or to embed
ECEN5807 1
. -and will not be used in ECEN5807.
-
8/13/2019 5807 MATLABSimulink Intro
2/37
Introduction through an example
iLoadig Ron1
+ _vL
Synchronous buck converter
+
voutvg
+
_
Resr
C
+
_v
L
Ron2 iCBode Diagram
-20
0
20
40From: vc To: SyncBuck/vout
gnitude(dB)
PWM
v
dTs
TsVM
c
1 2 3 4 5 6-180
-135
-90
-45
0
Ph
ase(deg)
-80
-60
-Ma
5
Vg
v gv
v
Switching model
Averaged model
Frequency (Hz)
0
0.36
Vc
v c
iLoad
vout
i
vout
Small-signal linearization andfrequency responses
See MATLAB/Simulink a e on the course
ECEN5807 2
iLoad
g
SyncBuckScope
ig
Simulink model: syncbuck_OL.mdl
website (Materials page) for complete step-by-
step details, and to download the example files
-
8/13/2019 5807 MATLABSimulink Intro
3/37
Synchronous Buck Converter
iLoadig Ron1
+ _vL
+
voutvgResr
C
+
v
L
Ron2 iC
dTs
__
c
PWMTsVM
c
Inputs: vg, iLoad, vc
ECEN5807 3
ou, g
State variables: v, i
-
8/13/2019 5807 MATLABSimulink Intro
4/37
Converter state equations
iLoadig
+L RL
Ron1+
_vL
i
+ voutvg
_
esr
C+
_v
Ron2 iC
PWM
dTs
TsVM
c
vc
State equations Output equations
)0(
)1(
2
1
c
c
viRR
viRRv
dt
diLv
outLon
outLong
L)0(
)1(
0
c
ciig
ECEN5807 4
LoadC ii
dt
vCi Loadesrout iiRvv
-
8/13/2019 5807 MATLABSimulink Intro
5/37
Simulink
model
5
Vg
v gv
v
SyncBuck subsystem block
0.36
Vc
v c
i
vout
i
vout
iLoad
oaig
SyncBuckScope
ig
1
v
1
scapacitor integrator
v c c2
1
vg
dv /dt v
c
SyncBucksubsystem
blockinternals
3
2
i
1
s
inductor integrator
PWM
u yCCMbuck
CCM buck
3
iLoad
vc
idi/dt
yu
c
4
ig
vout
ig
ECEN5807 5
-
8/13/2019 5807 MATLABSimulink Intro
6/37
Synchronous buck (SyncBuck) subsystem
1
Integration of
state variables
1
v
1
1
scapacitor integrator
v c c
PWM
2
vc
dv /dt v
c
cInputs
subsystem
3
is
inductor integratoru yCCMbuck
CCM buck
3
iLoad
idi/dt
vout
yu Outputs
4
igig
Converter
state
equations
ECEN5807 6
-
8/13/2019 5807 MATLABSimulink Intro
7/37
PWM operation and model
cc
1
c
1
vc
PWM ramp
Comparator
ECEN5807 7
Simulink PWM model
-
8/13/2019 5807 MATLABSimulink Intro
8/37
Converter state equations: embedded MATLAB script
3
vout
2
i
1
v
1
s
inductor integrator
1
s
capacitor integratorvc c
PWM
u yCCMbuck
CCM buck
3
iLoad
2
vc
vg
dv /dt v
idi/dt
vout
yu
c
c
u = inputs = [vg c iLoad v i]y = outputs = [ic/C vL/L vout ig]
u y
4
igig
Converter
stateequations
)0(
)1(
0
c
ciig
Loadesrout
)1( cviRRvdi
LoadC iidt
dvCi
ECEN5807 8
)0(2
cviRRdtv
outLon
L
-
8/13/2019 5807 MATLABSimulink Intro
9/37
Numerical example
iLoadig
+R
L RL
Ron1+
_vL
i
Switching frequency:fs = 1MHz
+
voutvg
_C
+
_v
Ron2 iC
c
Iout = 0
Vg = 5 V
PWM
vc
s
TsVM L = 1 H
RL = 10 m Ron1 = Ron2 = 20 m
C= 200 F5
Vg
v gv
v
Resr = 0.8 m PWM ramp amplitude
V = 1 V
0.36
Vc
v c
vout
i
vout
ECEN5807 9
Vc
= 0.36, D= 0.36iLoad
ig
SyncBuckScope
ig
Simulink model: syncbuck_OL.mdl
-
8/13/2019 5807 MATLABSimulink Intro
10/37
Numerical example: synchronous buck converter model
5
Vg
v gv
v
0.36
Vc
v c
i
vout
i
vout
iLoad
iLoadig
SyncBuckScope
ig
Masking a Simulink subsystemallows parameterization
Same subsystem model can bere-used
Models and MATLAB scri ts can
ECEN5807 10
be collected in a library
-
8/13/2019 5807 MATLABSimulink Intro
11/37
Switching simulation: open-loop start-up transient
v
i
vout
ig
ECEN5807 11
,
-
8/13/2019 5807 MATLABSimulink Intro
12/37
Averaged model
)0(
)1(
2
1
c
c
viRR
viRRv
dt
diLv
outLon
outLong
L
Switching modelLoadC ii
dt
Ci
)1(
ci
ig
Loadesrout iiRvv
State-s ace avera in review Textbook Sections 7.1-7.3
sssss
s
s ToutTLonToutTLonTg
T
TL viRRdviRRvd
dt
idLv 21 1
ss
s
s TLoadT
TTC
iidt
Ci
ss TTg
idi
Large-signalaveraged model
ECEN5807 12
ssss TLoadTesrTTout
iiRvv
-
8/13/2019 5807 MATLABSimulink Intro
13/37
Converter averaged state equations: MATLAB
The MATLAB function stays exactly the same, except d (duty-cycle) replaces c (switch control)
ECEN5807 13
-
8/13/2019 5807 MATLABSimulink Intro
14/37
Synchronous buck (SyncBuck) subsystem:
switching or averaged model
1
Integration of
state
variablesInputs
1
v
1
sw
constant
1
scapacitor integrator
v c c
PWM2
vc
vg
dv /dt v
d
c
3vout
is
inductor integratorSwitchPWM Gain
uyCCMbuck
CCM buck
3
iLoad
idi/dt
v out
yu
d
4
igig
stateequations
Averagedmodel of the
PWM
ECEN5807 14
-
8/13/2019 5807 MATLABSimulink Intro
15/37
Start-up transient simulations
Switching model Averaged model
v
i
vout
ig
ECEN5807 15
-
8/13/2019 5807 MATLABSimulink Intro
16/37
Linearization of the large-signal averaged model
Large-signal (nonlinear) averaged model
LVgd iLRL
+
R
+
vvg+
D vgD iL
Resr Small-signal
avera edC
Iod model
The small-signal model can be solved for all important converter transfer functions:
vsGvd
)( vg
vsG
)( out
vsZ
)(
ECEN5807 16
g oa
Control-to-output Line-to-output Output impedance
-
8/13/2019 5807 MATLABSimulink Intro
17/37
Synchronous buck converter exampleReview textbook Chapter 8
LVgd iLRL
vsG ovd
)(
Buck SSM
+
C
R v
vg+
D vg
Iod
D iL
Resr
1 esr
s
VsG
Gvd(s)
11
oo
ss
Q
d
kHz112
1
CLfo
dBV14V5 vdoG
a r o po es:
Low-frequency gain:
1
dB2.73.2/
Lesr
lossRR
CLQ 5
/
CL
RQload ESR zero:
ECEN5807
z2
esr
esrCRdB2.73.2||
loadloss
loadlossloadloss
QQQQQ
17
-
8/13/2019 5807 MATLABSimulink Intro
18/37
Magnitude and phase Bode plots of Gvd
60dB
80dB
(1/VM)Gvd(s)
20dB
40dB
dB145)/1( Mvdo VG dB2.73.2 Q
0dB
-20dB
kHz11ofdB/dec40
0o
of10
-90oMHz1esrf
2/1
dB/dec20
ECEN5807
100 KHz10 KHz1 KHz100 Hz10 Hz 1 MHz
-180o
esro
18
-
8/13/2019 5807 MATLABSimulink Intro
19/37
Linearization and frequency responses inMATLAB/Simulink
5
Vg
vg v
vg v
0.36
Vc
vc
i
vout
vc
i
vout
1. Set transfer
function inputand outputpoints
0
iLoad
iLoadig
SyncBuck Scope
iLoadig
2. MATLAB scri t BodePlotter_scri t.m com utes DC o eratin oint linearizes themodel, computes and plots the transfer function magnitude and phase responses
ECEN5807 19
-
8/13/2019 5807 MATLABSimulink Intro
20/37
Magnitude and phase Bode plots of GvdBode Diagram
20
40From: vc To: SyncBuck/vout
-20
0
gnitude(dB)
0-80
-60
-M
-90
-45
se(deg)
101
102
103
104
105
106
-180
-135Ph
ECEN5807 20
Frequency (Hz)
-
8/13/2019 5807 MATLABSimulink Intro
21/37
-
8/13/2019 5807 MATLABSimulink Intro
22/37
Closed-loop SMPS block diagramReview Textbook Chapter 9
Control objectives: tight output voltage regulation
tat c or ynam c stur ancesInput (line) voltage vg
Load current iload
ECEN5807
Component tolerances
22
-
8/13/2019 5807 MATLABSimulink Intro
23/37
Small-signal model: loop gain T
T(s)
Loop gain: T(s) = H(s)Gc(s)(1/VM)Gvd(s)
ECEN5807 23
-
8/13/2019 5807 MATLABSimulink Intro
24/37
Small-signal model: closed-loop responses
T(s)
ECEN5807 24
-
8/13/2019 5807 MATLABSimulink Intro
25/37
Feedback loop design objectives
T(s)
To meet the control objectives, design Tas large as possible in aswide frequency range as possible, i.e. with as high fc as possible
ECEN5807
Limitation: stability and quality of closed-loop responses
25
-
8/13/2019 5807 MATLABSimulink Intro
26/37
Uncompensated loop gain Tu
L
iL(t)
+ +
Iout
+
Vg
_
vo
_
C R
Gvd(s)-
_
+PWM Compensator
s= 1 MHz
error
duty-cyclecommand
sense =(in this
example)
Vref
+Gc(s) = 11/VM
Tu(s) = Hsense(1/VM)Gvd(s)
Plot magnitude and phase responses of Tu(s) to plan how to design Gc(s)
ECEN5807 26
-
8/13/2019 5807 MATLABSimulink Intro
27/37
Magnitude and phase Bode plots of Tu
60dB
80dB
Tu(s) = Hsense(1/VM)Gvd(s)
20dB
40dB
dB145)/1( senseMvdouo HVGT dB2.73.2 Q
0dB
-20dB
kHz11ofdB/dec40
2
ofT
0o
of10
target fc
cf
-90oMHz1esrf
2/1
dB/dec20
ECEN5807
100 KHz10 KHz1 KHz100 Hz10 Hz 1 MHz
-180o
esro
27
-
8/13/2019 5807 MATLABSimulink Intro
28/37
Lead (PD) compensator design
om 53
kHz100cf1. Choose:
2. Compute:
z
kHz003
2 2
3. Find Gco to position the crossover frequency:
1 z
p
co
c
ouofGfT dB1545.5 p
z
o
c
uoco
ffTG
ECEN5807
Magnitudeof Tu at fc
Magnitudeof Gc at fc
28
-
8/13/2019 5807 MATLABSimulink Intro
29/37
Lead (PD) compensator summary
11
s
dB1545.5 coG
21
11
)(
pp
coc
ss
GsG
z
kHz3001pf
c sLead
compensatorHF pole
MHz12f = f = f in this exam leAdded high-frequency pole:
High-frequency gain of the lead compensator: Gcofp1/fz = 49 (34 dB)
ECEN5807 29
-
8/13/2019 5807 MATLABSimulink Intro
30/37
Loop gain with lead (PD) compensator
60dB
80dB
11
z
s
20dB
40dB
dB7.297.28 couoGT
21 11 pp
coc
sss
0dB
-20dB
kHz100cf
kHz10zf
0o
kHz300pfkHz33zf
-90o
ECEN5807
100 KHz10 KHz1 KHz100 Hz10 Hz 1 MHz
-180o
om 53
30
-
8/13/2019 5807 MATLABSimulink Intro
31/37
Add lag (PI) compensator
Integrator at low frequencies
Choose 10fL < fc so that phase margin stays approximately the same: fL = 8 kHz
ECEN5807
- . cmcoc
31
-
8/13/2019 5807 MATLABSimulink Intro
32/37
Adding PI Compensator
60dB
80dB
20dB
40dB
0dB
-20dB
L kHz100cf
0o
Lf10
-90o
Lf10/1
PI compensator phase
ECEN5807
100 KHz10 KHz1 KHz100 Hz10 Hz 1 MHz
-180
om 53
32
-
8/13/2019 5807 MATLABSimulink Intro
33/37
Complete PID compensator: summary
dB1545.5 cmG
kHz8Lf
kHz33zf
kHz3001pf
MHz12pf
kHz100cf (=1/10 of fs)Crossover frequency:
ECEN5807
53omPhase margin:
33
-
8/13/2019 5807 MATLABSimulink Intro
34/37
Magnitude and phase Bode plots of T
60dB
80dB
20dB
40dB
0dB
-20dB
kHz100cf
0o
ase o uncompensate u
-90oPhase of compensated T
ECEN5807
100 KHz10 KHz1 KHz100 Hz10 Hz 1 MHz
-180o
om 53
34
-
8/13/2019 5807 MATLABSimulink Intro
35/37
Closed-loop voltage regulator in Simulink
5 vg v
vg v
Simulink model: syncbuck_CL.mdl
Vg
vc
ii
x
iLoadig
Step
iLoad
vout
ig
SyncBuck
1H
vyvx
PID compensator
1.8
Vref
1/(2*pi*33e3)s+1
1/(2*pi*300e3)s+1
PD Compensator
1
Injectionpoint
1
1/(2*pi*1e6)s+1
HF pole
5.45
Gcm
1/(2*pi*8e3)s+1
1/(2*pi*8e3)s
Inverted zero
y
ECEN5807 35
Input and output linearization points for finding the loop-gain, T= -vy/vxThe output point (y) should be Open Loop , as shown by an x symbol next to the output arrow
-
8/13/2019 5807 MATLABSimulink Intro
36/37
Loop gain and stability margins
MATLAB script
BodePlotter_scriptT.m
(computes dc op,
near zes, ca cu a esand plots frequency
response and stabilitymargins)
Bode Diagram
50
100From: x To: Gcm/y
(dB
)
= , = . .
-100
-50
0
Magnitude
-
-90
- 5
hase(deg)
ECEN5807 36
102
103
104
105
106
107
-180
P
Frequency (Hz)
-
8/13/2019 5807 MATLABSimulink Intro
37/37
Closed-loop 0-5 Astep-load transient responses
Averaged model Switching model
v
i
vout
ig
ECEN5807 37
See MATLAB/Simulink page on the course website (Materials page)for complete step-by-step details, and to download the example files