Sie sind auf Seite 1von 21

ECEN5807DM

IntroductiontoModelingofSwitchedMode PowerConvertersUsingMATLABandSimulink
Extensive introductory tutorials for MATLAB and Simulink, including Control Systems Toolbox and SimulinkControlDesignareavailableonthemathworks.comsite.Assumingbasicfamiliaritywiththese tools, the purpose of this document is to introduce how they can be applied to modeling and simulations of switchedmode power converters. Using a synchronous buck converter as an example, thedocumentgoesthroughtheMATLAB/Simulinkmodelingstepsbasedonthematerialspresentedin ECEN5797(IntroductiontoPowerElectronics): Constructing switching models based on converter statespace description, and performing timedomainsimulationsoftheswitchingconvertermodel MaskingandparameterizingSimulinkmodels Constructing largesignal averaged models and performing timedomain simulations of the averagedmodels Smallsignallinearizationofaveragedmodelsandplottingconverterfrequencyresponses Construction of closedloop models, plotting loopgain frequency responses, and performing timedomainsimulationsbasedonaveragedorswitchingmodels

The approaches presented in this document require MATLAB Control System Toolbox and Simulink Control Design. Specialized circuitsimulation Simulink toolboxes such as SimPowerSystems are not required.AllexamplesaredoneinMATLAB/SimulinkreleaseR2010a.StudentversionwiththeSimulink ControlDesignaddonissufficient.

ECEN5807DM

Contents
Asynchronousbuckconverterswitchingmodel..........................................................................................3 ToplevelSimulinkmodel:syncbuck_OL ..............................................................................................3 . SyncBucksubsystem.............................................................................................................................4 Converterstateequations....................................................................................................................6 Maskingandparameterizingthesubsystem........................................................................................8 Switchingmodelsimulation..................................................................................................................9 Addingparameterstoamaskedsubsystem.......................................................................................11 Averagedmodelofthesynchronousbuckconverter.............................................................................13 Smallsignallinearizationandfrequencyresponses...............................................................................15 ControlSystemToolboxpreferences..................................................................................................15 Linearizationinputsandoutputs........................................................................................................16 Simulinkmodellinearizationandplottingoffrequencyresponses...................................................17 Closedloopmodelingandsimulations...................................................................................................18

ECEN5807DM

Asynchronousbuckconverterswitchingmodel
A synchronous buck converter is shown in Fig.1. To model the converter in Simulink, it is useful to explicitlyidentifytheconverterinputandoutputsignals.

ig

Ron1

+ i

vL L

_ iLoad RL Resr iC C + v _ + vout _

vg +

Ron2

c dTs Ts PWM VM

vc
Figure1:Synchronousbuckconverter.Numericalexample:Vg=5V,L=1H,RL=10m,C=200F, Resr=0.8m,Ron1=Ron2=20m,fs=1MHz,PWMrampamplitudeVM=1V.

IntheconverterofFig.1,theinputsare:inputvoltagevg,loadcurrentiLoad,andcontrolvoltagevcat the input of the pulse width modulator. The outputs are output voltage vout and input current ig. In addition,theconverterstates(inductorcurrentiandcapacitorvoltagev)willbeconsideredtheoutputs. ToplevelSimulinkmodel:syncbuck_OL StartMATLAB,andopenanewmodelwindow(File,New,Model)

Namethemodelsyncbuck_OL(File,SaveAs,syncbuck_OL)

ECEN5807DM ClicktoopentheSimulinkLibraryBrowser

AddthreeConstantblockstorepresentinputs,Vg,Vc,andiLoad AddaSubsystemblock,whichwillbeusedtomodelthebuckconverter,nameitSyncBuck

SyncBucksubsystem DoubleclickontheSyncBucksubsystem.Inthesubsystemwindow,add3inputports,4outputports,2 integrators(1/sblocks),aMux,aDemux,asubsystemtomodelthePWM,andanEmbeddedMATLAB functionblocktomodeltheconverterstateequations.

ECEN5807DM

As you work through modeling steps, it is a good idea to save your work (as usual, ctrlS is the key shortcutforsave) Doubleclick on the PWM subsystem, add a Relay block (from Discontinuities), a Repeating Sequence block(fromSources),andanAddblock(fromMathOperations).ChangetheAddblockinputsto+and. IntheRelayblock,zeroisthedefaultcomparisonthresholdthatsfine.Optionally,youmayrename theblockstobetterdescribetheintendedfunctions.

DoubleclickonthePWMramp(RepeatingSequence)block.TheTimevaluescanbeusedtospecifythe switchingperiod.Forexample,[01e6]wouldbecorrespondto1MHzswitchingfrequency.Betteryet, we can enter an expression [0 1/fs] so that the same model can be used with switching frequency fs specifiedexternallyasaparameter.Similarly,outputvalues[0VM]willallowustoexternallyspecifythe PWMrampamplitudeVMasanotherparameter.

ECEN5807DM

Converterstateequations WenowturntowritingtheconverterstateequationsintheEmbeddedMATLABfunctionblock.Double clickontheblocktoopenanEmbeddedMATLABEditorwindow.Changethefunctionnametobetter represent the intended function. In the function arguments add the parameters L, C, RL, Ron1, Ron2, Resr,andwritetheconverterstateequations.Itisimportanttokeeptrackoftheorderofvariablesin theinputvectoruandtheoutputvectory.

Next,itisnecessarytoletthefunctionknowthattheinputuisavectorof5inputvariables,andthatL, C,RL,Ron1,Ron2,andResraretheparameters. OpenthePortsandDataManagerwindow(ClickonTools,EditData/Ports) Clickonu,enter5inSize,andclickApply

ECEN5807DM

ClickonL,changeScopetoParameter,andclickApply

Repeat this step with other parameters: C, RL, Ron1, Ron2, Resr. Close the Ports and Data Manager window,andtheEmbeddedMATLABEditor.TheSyncBucksubsystemshouldnowlooklikethis:

ECEN5807DM

Maskingandparameterizingthesubsystem Itremainstoprovideawaytosettheparametersoftheconvertermodel,i.e.theSyncBucksubsystem. AconvenientwaytodosoinSimulinkistomaskthesubsystem.Inthemainsyncbuck_OLwindow, rightclickontheSyncBuckblockandselectMaskSubsystem.AMaskEditorwindowshowsup.Click on the Parameters, Click on the Add button, and enter the Prompt and the names of the Variables representing the parameters. The order is not important, but the Variable names must exactly match thesymbolsusedfortheparameters.ClickApplyandOKtoclosetotheMaskEditor.

ECEN5807DM Back in the syncbuck_OL model window, double click on the SyncBuck subsystem. Instead of the subsystem internals, a dialog window now pops up, allowing you to enter the converter parameters. FollowingthenumericalexampleinFig.1,enterthefollowingparameters,clickApplyandOKtoclose thedialogwindowfortheSyncBucksubsystem.

Furthermodificationsinthemaskedsubsystemcanalwaysbemadebyrightclickingonthesubsystem and selecting Look Under Mask (to view or modify the model) or Edit Mask (to view or modify the parameters,description,help,orappearanceoftheblock). Switchingmodelsimulation Backinthesyncbuck_OLmodelwindow,connecttheinputsandaddaScopeblock(fromSinks).Inthe ScopeblocksettheNumberofAxesto4andunchecktheLimitdatapointstolastboxinDataHistory. The toplevel Simulink model should now look as shown below. Note that Vc is set to 0.36. Since VM=1V,thisVcresultsindutycycleD=0.36.GivenVg=5V,theoutputdcvoltageshouldideallybe Vout=D*Vg=1.8V.

ECEN5807DM

5 Vg

vg

0.36 Vc

vc v out

v out

0 iLoad

iLoad

ig

ig

SyncBuck

Scope

Finally,tosetupthesimulationparameters,clickonSimulation,ConfigurationParameters,enterdesired stoptime(e.g.100microseconds),andchangetheMaxstepsizefromautotoonetenthofaswitching period.ClickApplyandOKtoclosetheConfigurationParameterswindow.

Inthesyncbuck_OLmodelwindowClickontheStartsimulationbutton.DoubleclickontheScopeblock to view the results. The waveforms show a startup transient from zero initial conditions, and include switchingripples.

10

ECEN5807DM

Addingparameterstoamaskedsubsystem It would be convenient to add initial values for the capacitor voltage and the inductor current as additional parameters for the SyncBuck subsystem. To do so, Look Under Mask, doubleclick on the capacitorintegrator,andenterv0intheInitialconditionfield.

Similarly,enteri0astheinitialvalueoftheinductorcurrentintheInductorintegratorblock.

11

ECEN5807DM NextEditMaskandenterthenewparameters

Backinthesyncbuck_OLmodelwindow,doubleclickontheSyncBucksubsystemtoenteriL(0)=0and vc(0)=1.8,andrunsimulationagain.Sincetheconverterstartsfromtheinitialconditionsmuchcloser tothesteadystatevalues,thestartuptransientwaveformsarenowclosetosteadystate.

Youmayzoomintolookattheswitchingrippledetails

12

ECEN5807DM

Averagedmodelofthesynchronousbuckconverter
While transient simulations may be of interest to verify converter operation or performance, such simulations are of limited value in the design process. As emphasized in ECEN5797 and ECEN5807, averagingprovidesawaytoremoveswitchingrippleandmodulationsidebandcomplexities,andfocus on lowfrequency converter dynamics most relevant in the controller design process. To construct an averaged model of the synchronous buck converter example, we follow the statespace averaging approachandtakeadvantageofthefactthattheconverterstateequationshavealreadybeenwrittenin theformthatallowsreplacingtheswitchcontrolsignalc(t)withtheaverageddutycyclewaveformd(t). As a result, simple modification described below allows the same Simulink model to be used for switchingorforaveragedmodelsimulations. LookUnderMaskoftheSyncBucksubsystemagain,andmodifythepathbetweenthecontrolvoltagevc andtheswitchcontrolcusingaSwitchblock(fromSignalRouting),aGainblock(fromMathOperations) andaConstantblock.ChangetheSwitchthresholdto0.5,andenterparameterswastheconstant.This parametercanbesetto0(togetanaveragedmodelinwhichthePWMismodeledasa1/VMgainto generatethedutycycled),or1(togetaswitchingmodelinwhichtheactualPWMisusedtogenerate thepulsatingswitchcontrolc(t)).

13

ECEN5807DM

1 vg
vc c dv /dt c

1 s

1 v

capacitor integrator sw constant


d di/dt

2 vc

PWM 1/VM PWM Gain 3 iLoad

1 s

2 i

Switch
u u

inductor integrator CCMbuck y


y

CCM buck

v out

3 vout

ig

4 ig

NextEditMask,andaddanotherparameterasacheckbox.Theparameterdialogwindownowincludes a check box that can be used to activate the switching model. Leave it unchecked to work with the averagedmodel.

Leave the box unchecked and rerun the startup simulation from zero initial conditions. You may compare the waveforms to the switching simulations: switching ripples are no longer shown, but the largesignalaveragedmodelretainstheconverterdynamicsessentialforthecontrollerdesign. 14

ECEN5807DM

Smallsignallinearizationandfrequencyresponses
Similar to Spice .ac simulation, MATLAB/Simulink can linearize the largesignal averaged model. The linearizedmodelcanthenbeusedtoexamineconverteropenlooporclosedloopfrequencyresponses, perform or verify controller design, etc. In this area, MATLAB Simulink capabilities (with the Control Systems Toolbox and the Simulink Control Design components) far exceed capabilities of traditional Spicesimulationtools. ControlSystemToolboxpreferences Before starting work on linearized models, lets change a few Control System Toolbox preferences. In themainMATLABwindow,atthecommandpromptenter >>ctrlpref andadjustthepreferencesasshownbelow

15

ECEN5807DM

Linearizationinputsandoutputs Inthesyncbuck_OLmodel,firstmakesurethattheSwitchingmodel?checkboxisunchecked,i.e.that you are working with the averaged converter model. Otherwise, linearization and frequencydomain simulationstepsdescribedbelowcannotbeappliedthesestepsdonotmakesensewiththeswitching model. First input and output points for the linearized model must be added to the syncbuck_OL model. Suppose that we are interested in finding the openloop controltooutput transfer function Gvc=(1/VM)Gvd,i.e.thesmallsignaltransferfunctionfromvctovout.Rightclickonthevcsignal,i.e. theconnectionbetweentheVcconstantblockandthevcinputportoftheSyncBucksubsystem

SelectLinearizationPoints,InputPoint.Similarly,rightclickon thevoutsignalandselectLinearization Points,OutputPoint.Notethesmallarrowsindicatingtheinputandtheoutputpoint.

16

ECEN5807DM

Simulinkmodellinearizationandplottingoffrequencyresponses There are many ways to perform smallsignal linearization, including a graphical user interface with manyoptions(Tools,ControlDesign,LinearAnalysis).Instead,weshowherehowsimpletaskssuchas plottingmagnitudeandphaseresponsescanbeautomatedbywritingMATLABscripts. FromthemainMATLABwindow,doFile,New,Script,savethefileasBodePlotter_scriptandenterthe scriptasfollows

ClickontheRunbutton,orintheMATLABwidowtypeBodePlotter_scriptandenter.AnLTI(lineartime invariant)viewerwindowsopensandshowstheconverteropenloopcontroltooutputmagnitudeand phaseresponses.TheLTIViewerhasmanyoptions,e.g.toadjustthescales,displayotherpropertiesof thelinearizedmodel,etc.TheBodeDiagramshowsthefamiliarmagnitudeandphaseresponsesofthe buckconvertercontroltooutputtransferfunction.

17

ECEN5807DM
Bode Diagram From: vc To: SyncBuck/vout 40 20 Magnitude (dB) Phase (deg) 0 -20 -40 -60 -80 0

-45

-90 -135

-180 10
1

10

10

10

10

10

Frequency (Hz)

Closedloopmodelingandsimulations
Next,savethemodelsyncbuck_OLassyncbuck_CL,andaddfeedbackcomponentstoclosethevoltage modecontrolloopusingthePIDcompensatordesignexampledescribedinclassnotes.

InSimulink,thecompensatortransferfunctioncanberealizedinanumberofdifferentways.Forclarity, therealizationshownaboveconsistsofthreeTransferFcnblocks(fromContinuous)andaGainblock. ThesensorgainisH=1.TheloopincludesanadditionalGainblockwithagainof1.Thisblockservesas the injection point for evaluation of the loopgain (following the injection approach discussed in the ECEN5797/5807Textbook).Toperformlinearization,addaninputpointattheoutputoftheinjection pointGainblock,andanoutputpointattheinputoftheinjectionpointGainblock.Togettheloopgain, makesurethatyouselectOpenLoopfortheoutputpoint,(rightclick,LinearizationPoints,OpenLoop). 18

ECEN5807DM Asmallxnexttotheoutputpointarrowsignifiesthatthesystemislinearizedinopenloop(effectively breaking the smallsignal loop at the injection point, while still keeping the loop closed in operating pointcalculations). The script to plot the loopgain 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 loopgain magnitude and phase responses, and to calculate the crossover frequency, phase margin and gain margin.Notethataminussignisaddedinfrontofthesmallsignalmodelssm,sothattheloopgainis correctlydisplayedasT=vy/vx.

19

ECEN5807DM
Bode Diagram Gm = Inf dB (at Inf Hz) , Pm = 51.6 deg (at 1.05e+005 Hz) From: x To: Gcm/y 100

50 Magnitude (dB) Phase (deg)

-50

-100 -45

-90

-135

-180 10
2

10

10

10

10

10

Frequency (Hz)

Theresultsconfirmthedesignedcrossoverfrequencyandthephasemargin. Finally,youmayperformtransientsimulationswiththeaveragedmodelorwiththeswitchingmodelto verifyperformanceundersteploadtransientsorotherdisturbances.

20

ECEN5807DM

21

Das könnte Ihnen auch gefallen