Top Banner
Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1 Matlab model files in C:\Powerelectronics\SyncBuck
63

Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

Jan 18, 2016

Download

Documents

Bruce Jacobs
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

1

Modeling of Power Converters using Matlab and Simulink

Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic

Matlab model files inC:\Powerelectronics\SyncBuck

Page 2: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

2

Page 3: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

3

We will construct models and perform simulation.

1. Constructing switching models based on converter state-space description, performing time-domain simulations of the switching converter models

2. Masking and parameterizing Simulink models

3. Constructing large-signal averaged models and performing time-domain simulations of the averaged models

4. Small signal linearization of averaged models and plotting converter frequency responses

5. Constructing closed-loop models, plotting loop-gain frequency responses, performing time-domain simulation based on averaged or switching models

Page 4: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

4

Develop a switching model of a synchronous buck converter

Top level simulation model

Start MATLAB, and open a new model window (File, New, Model)

A new window is shown in next page.

Page 5: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

5

Name the model syncbuck_OL (File, Save As, syncbuck_OL)

Page 6: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

6

Click to open the Simulink Library Browser

In the simulink library browser window, right click on the selected component, then click on Help for this selected component to see the usage of this selected component

Page 7: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

7

Add three constant blocks to represent Vg, Vc, and iLoadAdd a subsystem block to model the buck converter, called Syncbuck

Page 8: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

8

Build the SyncBuck Subsystem

Double click on the SyncBuck subsystem.In the subsystem window, add 3 input ports, 4 output ports, two integrators (1/s blocks), a mux, a demux, a subsystem to model the PWM, and an embedded MATLAB function block to model the converter state equations.

Page 9: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

9 Save our work constantly (ctrl-s is the key shortcut for save)

Page 10: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

10

Double click on the PWM subsystem,

Add a Relay block (from Discontinues),

Add a Repeating Sequence block (from Sources)

Add an Add block (from Math Operations)Change the Add block inputs to + and –

Relay block, zero the default comparison threshold

Block names can be modified to better describe the intended functions

Page 11: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

11

Double click on the PWM ramp (Repeating Sequence) block. The time value can be used to specify the switching period. For example [0 1e-6] corresponds to 1 MHz switching frequency. We can enter an expression [0 1/fs]. fs is specified externally as a parameter. Output values [0 VM] will allow us to externally specify the PWM ramp amplitude VM as another parameter.

Page 12: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

12

Double click on the PWM ramp (Repeating Sequence) block. The time value can be used to specify the switching period. For example [0 1e-6] corresponds to 1 MHz switching frequency. We can enter an expression [0 1/fs]. fs is specified externally as a parameter. Output values [0 VM] will allow us to externally specify the PWM ramp amplitude VM as another parameter.

Page 13: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

13

MATLAB function block for converter state equations

Double click on the block to open an Embedded MATLAB Editor window

Change the function name to better represent the intended function

In the function arguments add the parameters L, C, RL, Ron1, Ron2, Resr and write the converter state equations

Keep track of the order of variables in the input vector u and the output vector y.

Page 14: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

14

MATLAB function block for converter state equations

Click on Tools, Edit Data/Ports , Click on u, enter 5 in Size. u is a vector of 5 input variables

Page 15: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

15

Page 16: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

16

L, C, RL, Ron1, Ron2 and Resr are the parameters.Click on L, change Scope to Parameter, and click applyRepeat for all parameters

Page 17: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

17

After closing the Ports and Data Manager window and the embedded MATLAB Editor. The SyncBuck subsystem should look like this

Page 18: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

18

Masking and parameterizing the subsystem(Masking a Simulink subsystem allows parameterization and the same subsystem model can be reused.)

Set the parameters of the converter model, i.e., the SyncBuck subsystem.In the main syncbuck_OL window, right click on the SyncBuck block and select Edit Mask.

A Mask Editor window shows up. Click on the Parameters, Click on Add button, enter the Prompt and the name of the Variables representing the parameter.The Variable names should match exactly the symbols used for the parameters.Click Apply and Ok to close the Mask Editor.

Page 19: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

19

Page 20: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

20

In the syncbuck_OL model windowDouble click on the SyncBuck subsystem, a dialog window pops up to enter the converter parameters as shown in Figure 1

Page 21: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

21

Top-level simulation model

Back in the syncbuck_OL model windowConnect the inputs to the SyncBuck subsystemAdd a scope (from Sinks)

In the Scope block set the Number of Axes to 4 and uncheck the “Limit data points to last” box in the Data History.

Now the top-level Simulation model look as shown below

Page 22: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

22

Vc is set to 0.36VM = 1 V, duty cycle D = 0.36Given Vg = 5 V, the output dc voltage should be Vout = D*Vg = 1.8 V.

Page 23: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

23

Set up simulation parameters

Click on Simulation, Configuration Parameters, Enter desired stop time (e.g. 100 microseconds)

Change the Max step size from auto to one tenth of a switching period

Click Apply and OK to close the Configuration Parameters window.

Page 24: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

24

Page 25: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

25

In the syncbuck_OL window, Click on the Start simulation button.Double click on the Scope block to view the results

Page 26: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

26

Change the initial voltage of C

At the top-level modelRight click on the SyncBuck block, Click on Look Under Mask, Double Click on the capacitor integrator and enter v0 in the initial condition field.Click on Edit Mask and enter the new parameters

Similarly, enter i0 as initial value of the inductor current in the inductor integrator block.

Page 27: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

27

Page 28: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

28

Masking and Parameterizing of the subsystem

i.e., To set the parameters of the converter model

In the main syncbuck_OL window, right click on the SyncBuck block and select Mask Subsystem.A Mask Editor window shows up.Click on the ParametersClick on the Add buttonEnter the Prompt and the names of the Variables representing the parameters.Variable names must match symbols used in the parametersClick Apply and OK to close the Mask Editor

Page 29: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

29

Page 30: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

30

Back in the top-level syncbuck_OL model window, double click on the SyncBuck subsystem to enter iL(0) = 0 and vc(0) = 1.8 and run the simulation again

Page 31: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

31

Page 32: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

32

Zoom in to look at the switching ripple details

Page 33: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

33

Averaged Model of the synchronous buck converter

Replacing the switch control signal c(t) with the averaged duty cycle waveform d(t)

Look Under Mask of the SyncBuck subsystem, modify the path between the control voltage vc and the switch control c using a Switch block (from Signal Routing), a Gain block (from Math Operations) and a Constant block.

Change the Switch threshold to 0.5, and enter parameter sw as the constant. This parameter can be set to 0 (to get an averaged model in which the PWM is modeled as 1/VM gain to generate the duty cycle d), or 1 (to get a switching model in which the actual PWM is used to generate the pulsating switch control c(t))

Page 34: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

34

Page 35: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

35

Right click on the SyncBuck subsystem block in the top-level model, Select Edit Mask, and add another parameter as checkbox.

Double click on the SyncBuck subsystem block in the top-level model, clock on the Mask Parameters. The parameter dialog window now includes a checkbox that can be used to activate the switching model. Leave it unchecked to work with the averaged model.

Page 36: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

36

Page 37: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

37

Switching model sw=1

Page 38: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

38

Averaged model sw = 0

Page 39: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

39

Small signal linearization and Frequency Response

MATLAB/Simulink can linearize the large-signal averaged model. The linearized model can be used to examine converter open-loop or closed-loop frequency responses, perform or verify controller design.

MATLAB Simulink capabilities with the Control System Toolbox and the Simulink Control Design components far exceeds Spice simulation tools.

In the main MATLAB window, at the command prompt enter>> ctrlprefand adjust the preferences as shown below

Page 40: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

40

Page 41: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

41

Page 42: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

42

Linearization inputs and outputs

Working with the averaged converter model, i.e. checkbox is unchecked.

First input and output points for the linearized model must be added to the syncbuck_OL model.Suppose we want to find the open-loop control-to-output transfer function Gvc = (1/VM)Gvd, i.e., the small signal transfer function from vc to vout. Right click on the vc signal , i.e. the connection between the Vc constant block and the vc input port of the SyncBuck subsystem.

Page 43: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

43

Right click on the vc signal , i.e. the connection between the Vc constant block and the vc input port of the SyncBuck subsystem. Select Linearization Points, Input Point.Right click on the vout signal, and select Linearization Points, Output Point.

Page 44: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

44

Note the small arrows indicating the input and output point

Page 45: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

45

Plotting of frequency response

Writing MATLAB scripts to plot magnitude and phase response

From the main MATLAB window, do File, New, Script save the file as BodePlotter_script and enter the script as follows (shown next page)

Page 46: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

46

Click on the Run button or In the MATLAB main window type BodePlotter_script and enter

Page 47: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

47

In the MATLAB main window type BodePlotter_script and enter

Buck Converter Open loop Control to Output Magnitude and Phase response

Page 48: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

48

Closed loop modeling and simulation

Linearization Input point

Linearization output point

Page 49: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

49

Three transfer function blocks (from Continuous) and a Gain block are added.The sensor gain is H =1.The loop includes an additional Gain block with a gain of 1. This block serves as the injection point for evaluation of the loop-gain.

To perform linearization, Add an input point at the output of the injection point Gain block,Add an output point at the input of the injection point Gain block, To get the loop gain, make sure that you select Open Loop for the output point, (right-click, linearization Points, Open Loop)

A small x next to the output point arrow signifies that the system is linearized in open-loop (effectively breaking the small signal loop at the injection point, while still keeping the loop closed in operating point calculation)

Page 50: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

50

The script to plot the loop-gain magnitude and phase responses is a small modification of the BodePlotter_script.

Instead of the LTI viewer, MATLAB function margin is used to plot the loop-gain magnitude and phase response, and to calculate the cross-over frequency, phase margin and gain margin.

Note that a minus sign is added in front of the small-signal model ssm, so that the loop gain is correctly displayed as T = -vy/vx.

Page 51: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

51

Page 52: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

52

Page 53: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

53

Step load transient Averaged Model switching model

Page 54: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

54

Extra Slides

Page 55: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

55

Page 56: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

56

Page 57: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

57

Page 58: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

58

Page 59: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

59

Page 60: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

60

Page 61: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

61

Page 62: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

62

Page 63: Modeling of Power Converters using Matlab and Simulink Reference : Fundamentals of Power Electronics second edition By R. Erickson and D. Maksimovic 1.

63