control strategy for a dc/dc buck converter based …421258/fulltext01.pdfcontrol strategy for a...

50
Degree Project Mutaz Tuffaha, Dhafer Yahia Saleh 1977-07-03 1955-04-08 Subject: Electrical Engineering Level: Advanced, Master Course code: 5ED06E Control Strategy for a DC/DC Buck Converter based on a Hamiltonian Model to suppress the Ripples at the Input stage

Upload: trinhliem

Post on 26-Mar-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Degree Project

Mutaz Tuffaha, Dhafer Yahia Saleh 1977-07-03 1955-04-08 Subject: Electrical Engineering Level: Advanced, Master Course code: 5ED06E

Control Strategy for a DC/DC Buck Converter based on a Hamiltonian Model to suppress the Ripples at the Input stage

SE-351 95 Växjö / SE-391 82 Kalmar Tel +46-772-28 80 00 [email protected] Lnu.se

Control Strategy for a DC/DC Buck Converter based on aHamiltonian Model to suppress the Ripples at the Input stage

Mutaz Tuffaha Dhafer Yahia Saleh

June 8, 2011

1

Abstract

AC/DC Buck converters have been used widely in many applications from cell phonesto vehicle battery chargers. Due to their importance many researchers have been study-ing their behavior to improve their efficiency and reduce their size and/or cost. One ofthe most common defects of these converters, whether they are used for high power orlow power applications, is the unwanted ripples in the input voltage across the inputstage. It is believed that these ripples are caused by the interaction between the con-verter itself or its controller with the rectifier required to change the AC input into DCfollowed by an input filter. Many strategies have been suggested to tackle this problem.A new strategy to improve the controller of that converter was suggested by M. Lenells[1] and it was based on a Hamiltonian model for the 3-phase AC/DC converter togetherwith its rectifier. As a first step, we simulated this model for a single-phase DC/DC buckconverter only using the so-called S-Functions in MATLAB/SIMULINK. Then we couldfind a control law that would reduce the ripples in the input voltage and keep the outputvoltage constant simultaneously. In this report, we present this model and its simulationto pave the way for the control and simulation of the 3-phase AC/DC converter.

2

1 Introduction

AC/DC converters is a fertile arena for research and treatises due to their proliferation in manyapplications such as battery chargers. The quest of all these researches revolves around increasingthe efficiency, reducing the cost and/or size of those converters and reducing the unwanted ripplesin the input voltage. This report is about a new control strategy that aims to reduce the ripples ofthe input voltage which are referred to as the Total Harmonic Distortion (THD) in some litera-ture, see [2] for example.

This report is based on a report presented by M. Lenells [1]-From here on, this report is referredto as [1]- which was based on a problem formulated by MicroPower E.D. Marketing AB. MicroP-ower which has its main operation in Växjö, Sweden, develops and manufactures chargers fortractionary batteries that are used in trucks. They use high power buck converters in the orderof 8KW , and they have reasons to think that the ripples in the input voltage cause disturbancesin the electrical network which in turn may be harmful to the chargers and other elements of theelectrical network [1].

In [1] an explanation to the problem of the ripples in the input voltage was suggested depend-ing on the interaction between the controller and the feeding network. A controller is needed forthe converter to keep the output voltage regulated. The feeding network contains large inductancesand a rectifier with an input filter to transfer the AC input into DC. This feeding network introducesa resonance frequency that interacts with the control signal. One way to tackle this resonance isto increase the output capacitance of the rectifier C f in fig.1, or to decrease the inductance of thefeeding network Ls in fig.1. However, increasing C f would be an impractical solution due to thecost and size of large capacitors [1], while decreasing Ls is not feasible.

Because it was believed that a better controller could be designed such that it would interactmore delicately with the feeding network, a mathematical model based on a Hamiltonian systemof the three-phase AC/DC converter was suggested (see [1]). In that approach the inductance ofthe feeding network was modeled as a separate inductor, Ls in fig.1. Such systems are referred toas Port-Controlled Hamilton (PCH) in some articles like [3].In addition, that Hamiltonian model was linearized in [1] since converters, in general, are believedto be nonlinear due to the "nonlinearities in the electronic switches and the external disturbances[4]". Then a strategy to find a control law was proposed in [1] to achieve the two important targets:keeping the output voltage constant and reducing the ripples in the input voltage.

In our project, we merely simulated the model of the single-phase DC/DC buck converter sug-gested in [1] using the so-called S-Function (stands for system-function) in MATLAB/SIMULINK.We think that this simulation can be considered as one of the most important results of this project,since simulating a multi-input multi-output system using S-functions as not a common task in lit-erature. From this simulation we prove that the ripples in the input voltage (THD) are caused bythe interaction or resonance between the feeding network and the controller of the converter. Inaddition, we prove that increasing the output capacitance of the rectifier would solve the problem,however as mentioned earlier this would be a very expensive solution. Finally, we could find acontrol law which could keep the output voltage constant and the ripples in the input voltage mini-mum. Unfortunately, we could not prove that this control strategy would work for the three-phaseAC/DC converter because our simulations were for a single-phase DC/DC converter only.

In the next section we present a brief review of the treatises we have found which are relatedin a way or another to our research here. In section 3 we present the Hamiltonian model of theDC/DC buck converter suggested in [1], then we show the simulation of that model using the so-called S-Function in MATLAB/SIMULINK in two different techniques to prove eventually thatthese two techniques are equivalent.

3

In section 4 we present another model for the buck DC/DC converter based on transfer functionsproposed by B. Johansson [5] together with its simulation in MATLAB then we set a comparisonbetween the simulation of this model with the simulation of the Hamiltonian system to show thatthey are equivalent.

In section 5 we introduce the linearized Hamiltonian system suggested in [1] to adapt with thenonlinearities in the DC/DC buck converter, then we simulate this model in two different cases;the first when the duty-cycle is constant and the second when the duty-cycle is varying with time.Then we show the simulation of the model based on the transfer functions proposed in [5] againbut this time when the duty-cycle is varying with time to compare the results of the two simula-tions and to prove eventually that the linearized Hamiltonian system is equivalent to the transferfunctions except at certain ranges of frequencies due to the resonance between the converter andthe input filter.In section 6 we use the simulations explained in section 5 to analyze the ripples in the input voltageto show that they are caused by the resonance between the input filter and the converter, then weshow that these ripples can be suppressed by using large capacitance at the output of the filter.

In section 7 we introduce a better control strategy proposed in [1] based on augmenting the Hamil-tonian system by adding a suitable target output and finding a suitable control law for this aug-mented system to show eventually that the Hamiltonian system is controllable and it can be usedto achieve the two targets mentioned above: keeping the output voltage constant and reducing theripples in the input voltage as suggested in [1]. Finally, in section 8 we try to point out someconclusions from the results we had and recommendations for future work.

2 Literature Review

Actually, AC/DC converters have been representing a fertile field for researches and studies, andgoing through them was really troublesome. One can classify these articles into two main cat-egories: low power converters and high power converters. Of course, we are not so interestedin the low power converters since most of the researchers in that field attack the problems of theconverters from electronic point of view and these components are usually sensitive to high power,for further information the reader is advised to see articles like [6].

On the other hand, many articles try to address the problems of the high power converters bysuggesting new topologies. For example, the authors of [2] suggest a new controller for a newconverter topology called Single-Ended Primary Inductance Converter (SEPIC). They prove thatthis controller can "reduce the (THD) of the input current, increase the power factor at the AC sideof the converter and at the same time keep the output voltage regulated [2]".Similarly, L. Yang et al. in [7] proposed a new topology for the three-phase AC/DC converterwhich "comprises two converters: Buck-boost converter at the input and a forward DC/DC con-verter at the output [7]". Eventually, they proved by simulations that this proposed converter wouldreduce the (THD), adjust the output voltage and reduce the ripples of the input voltage.

While, Y. W. Li in [8] proposed completely different methods to reduce the ripples caused bythis resonance, then he compared between these methods to conclude that the choice of the bestmethod depends on the load. One of the methods he suggested was to use a virtual damping re-sistance [8]. Bearing in mind that a resistance could damp these ripples but this would increasethe conduction losses so the efficiency would decrease, Y. W. Li in [8] suggested using multipliersand/or differentiators to give the effect of a resistance without causing losses.M. U. Iftikhar et al. in [4] suggested a "full state-feedback model to stabilize the Pulse-Width Mod-ulator (PWM) converter [4]". They proposed a state-space model, and they linearized it around aDC value then they augmented this model by adding another state representing the integral of the

4

error between the output voltage and a reference voltage. To find the control law, they used thepole-placement technique. We think that this proposal is the closest from all the literature we havefound to that in [1]. However, in [4] the authors did not use the Hamiltonian model. Furthermore,they used the pole-placement technique in which one finds a characteristic polynomial from thestate-space model, the degree of this polynomial is equal to the number of states used in the model.Then the coefficients of this polynomial are found such that the poles are placed in the Left HalfPlane (LHP) of the s-domain to ensure stability, then the control law can be determined from thesecoefficients. Apparently, in this technique one needs to choose the locations of the poles of thecharacteristic polynomial and this usually involves guessing specially when one does not have aclear criterion to locate these poles. In [4], the model suggested has five states, i.e., five poles haveto be located and as we understood the only criterion set by the authors for locating these poles isthat "the linearized averaged models are generally valid up to about 1/5 of the switching frequency[4]". While, using the technique suggested in [1] to find the control law one has to guess only threeparameters as will be shown later, so we think that the latter technique would be less complicated.

The Hamiltonian system by itself is not a new strategy, it was suggested "by Maschke et al. (1995),van der Schaft and Maschke (1993) [9]". Since then the Hamiltonian formalism has been used inmany articles to describe the converters and their controllers, for example you can see [9]. Anotherexample is in [10], where the authors held a comparison between the port-Hamiltonian systems(PH) and the Brayton−Moser equations (BM) to conclude that they were some discrepancies be-tween the two models so they suggested some kind of criteria to know when one should use eitherof them.

Actually, we found two articles in which the authors suggested the use of the Hamiltonian sys-tem to model the AC/DC converters. In [3] the authors described the 3-phase AC/DC convertersbased on the (PCH) theory in "dq rotating frame [3]", which is different from the technique usedin [1]. The second is presented in [11], in which the authors compare three approaches to improvethe controllers of the AC/DC converters using "Lyapunov control theory, passivity control theoryusing Euler-Lagrange( EL) model and port controlled Hamiltonian with dissipation (PCHD)model[11]". They concluded that using Lyapunov control theory would make the system too complex,and the (PCHD) would not deliver good dynamic performance, while the EL model would bea better choice. Conversely, in [1] it is believed that the (PCH) would provide better control ofthe AC/DC converter, unfortunately we could not prove that because our simulations were for asingle-phase DC/DC converter. However, the results we had were so promising as will be shownin this report.

The Hamiltonian model suggested in [1] was based on previous work. In [12], M. Karlsson etal. used the so-called graph theory to model the switched electrical circuits like converters by aHamiltonian system of differential algebraic equations. For further information on using the graphtheory in Modeling the switching circuits the reader is advised to read [13].Whereas, H. Cormerais et al. in [14] formulated a Hamiltonian model for a serial converter basedon the so-called bond graph formalism which is a different approach to construct models ofswitching circuit.

In addition to all that, we have found many articles in which the authors treat the signals andparameters as probabilistic or stochastic signals, for example, some of them suggest using fuzzylogic controllers [15]. However, this approach is far from our model presented in this reportbecause we try to treat the controller and its parameters in a deterministic approach. For furtherreading in that field see [16] and [17].

Finally, it is worth mentioning here that we have not found articles that address in details the useof the S-Function technique in MATLAB/SIMULINK for similar controllers. In fact, S-Function

5

is a technique that can be implemented by codes written as M-files in MATLAB, or C-MEX files(using C, C++ or Fortran) or by ready-made blocks in SIMULINK as will be explained later.Many of those who mentioned the use of the S-Functions used the ready-made blocks from theSIMULINK library, minority only use the programming technique. For example, the authors in [?] used S-function technique to model and simulate aircraft movement, and they implemented it byC-MEX file written by C, which is a clever choice because these languages give more flexibilityin programming while we chose to use M-Files.In summary, we think that the model suggested in [1] with its simulation presented here is differentfrom other treatises in the sense that:

1. It models the inductance of the feeding network as a separate inductance Ls in fig.1 to studyits effect on the ripples in the input voltage.

2. It provides a control strategy that aims to reduce the ripple at the input voltage and keepthe output voltage constant simultaneously with less complexity than others like [4] forexample.

3. The simulation was made in MATLAB/SIMULINK using S-Functions, and to our bestknowledge, we have not seen a simulation like that for multi-input multi-output switchingcircuits.

3 Hamiltonian Model of the DC/DC converter

A Hamiltonian model of the DC/DC converter was suggested in [1] . This model is expected to benon-linear, and to linearize it a DC-Solution must be found as a first step by simulating the model.In this section the Hamiltonian model is presented. Then the simulation using MATLAB of thismodel is elucidated in two different techniques to find the DC-Solution. In the first technique themodel is treated as a multi-input multi-output system, which makes the simulation so cumbersome.Instead, in the second technique the model is treated as a single-input single-output system assuggested in [1]. Then the results of these simulations which represent the desired DC-Solutionare shown and compared to deduce eventually the equivalence of the two techniques.

3.1 Hamiltonian system

The whole idea is to formulate the converter as a Hamiltonian system using the so-called graphtheory. The derivation of this Hamiltonian system is beyond our research here, but it is presentedin [1]. So we leave the mathematical details of the derivation and start directly with the simulationafter presenting the system.

Fig.1 shows a schematic circuit of the model of the DC/DC buck converter. The switch (S) is con-trolled by a signal from the controller denoted by dn, this control signal is actually the pivot aroundwhich this project revolves. dn is supposed to assign the value of the duty-cycle d of the converter,which is the ratio of the time interval during which the switch is ON (ton) to the switching period

(T ) i.e., d =ton

T.

To illustrate the action of the duty-cycle d see fig.2. If the input voltage vmain and d are con-stant, we can see from fig.2 that the output voltage vo will be constant and equal to vmain duringthe time interval tON which is equal to dT and zero for the rest of the switching period T . Theaverage output voltage denoted in the figure by (v_av) can be calculated as follows:

v_av = 1T

∫ T

0vmaindt =

vmain×dTT

= dvmain

Of course, the output voltage is not constant and it contains many harmonics. That is why a con-troller is needed to regulate this output voltage.

6

Figure 1: The model of the DC-DC buck converter

Figure 2: A sketch to illustrate the action of the duty-cycle d. Output voltage vo solid, averageoutput voltage v_av dashed.

7

The section of the circuit after the switch (S) models the DC/DC buck converter in its simplestform, while the section before (S) comprises two elements:

• Ls: models the inductance of the conductors of the feeding network.

• C f : the output capacitance of the rectifier used before the converter.

We restricted ourselves to the notation used in [1] all through the equations in this report. So thecapacitances C and C f were replaced by C1 and C2 respectively, the inductances L and Ls by L1and L2 respectively, while the resistances RC and R were replaced by R4 and R5 respectively.In order to model the system one usual defines states according to (see [1]):

x =

x1x2x3x4

=

q1q2φ1φ2

=

C1uC1

C2uC2

L1iL1

L2iL2

(1)

whereq1 and q2: represent the charges on C1 and C2 respectively.φ1 and φ2: represent the flux through L1 and L2 respectively.i4: corresponds to the current through R4.iin: corresponds to the current through the main supply as shown in fig. 1.uC1 and uC2 : correspond to the voltages across C1 and C2 respectively.iL1 and iL2 : correspond to the currents through L1 and L2 respectively.

Because of the switch (S) the mathematical model of the system will be a state space ABC-systemwhere the matrices shift between two modes. This is done for such a high frequency so one canobtain what is called a continuous state average model of the system. The state vector of thismodel is here denoted by xa where the subscript "a" alludes to "average". This system is given bythe following equations (see [1]):

xa = Jx(d)∂H(xa)

∂xa+(−N Bx

)( M−1z za

u

)(2)

(−za

wa

)=(−N Bx

)T ∂H(xa)

∂xa+

(−Jz −Bz

BTz −JD

)(M−1

z za

u

)(3)

z and w form the output of this system and they are given by (see [1]):

z =(

z1z2

)=

(i4vo

), w = (−iin) (4)

while the input u is given by (see [1]):

u = (vmain) (5)

The rest of the quantities used in equation (2) and (3) are given below (see [1]):

Jx(d) =

0 0 1 00 0 −d 1−1 d 0 00 −1 0 0

(6)

8

in the preceding equation d is the duty-cycle we talked about earlier

Mx = diag(C1,C2,L1,L2) =

C1 0 0 00 C2 0 00 0 L1 00 0 0 L2

(7)

N =

0 10 01 00 0

(8)

Bx =

0001

(9)

Bz =

(00

)(10)

Jz =

(0 −11 0

)(11)

JD = (0) (12)

Mz = diag(R−14 ,R5) =

(R−1

4 00 R5

)(13)

Finally, the variable H represents the Hamiltonian of the system which "expresses the energy ofthe system [1]". We present a basic definition of the Hamiltonian H as stated, for example, by G.Escobar et al. [9] in their article:

H(x) =12

xT Qx (14)

where Q is a "diagonal matrix containing the circuit parameters 1\Ci, 1\Li [9]", we think that thisis the most basic definition of the Hamiltonian for further information the reader is recommendedto read [1].It is expected that the Hamiltonian system described by equations (2) and (3) is not linear becauseof the switch operation and to linearize it (see section.5) one has to begin by finding a point aroundwhich the system can be linearized. This point is called here the ’DC-solution’ of the Hamiltoniansystem which is sufficient -at least at this stage- to provide a good comparison between the twotechniques used for the simulation of the Hamiltonian system. Without going through the math-ematical details this ’DC-solution’ can be found from the following equations which results aftersome manipulations to cancel the term ∂H(xa)

∂xafrom equations (2) and (3) (see [1]):

xaD = Jx(D)M−1x xaD +

(−N Bx

)( M−1z zaD

uaD

)(15)

9

(−zaD

waD

)=(−N Bx

)T M−1x xaD +

(−Jz −Bz

BTz −JD

)(M−1

z zaD

uaD

)(16)

The subscript aD here denotes the DC-solution of the system. It should be noted here that the sys-tem described by equations (15) and (16) is considered multi-input multi-output system because

the input of this system is represented by the vector(

M−1z zaD

uaD

), while the output is considered

to be(−zaD

waD

)and this made our task much harder as mentioned earlier.

3.2 Simulation of the Hamiltonian system-First Technique

We used S-function technique in MATLAB, because it extends the capabilities of SIMULINK andit would make it easier for us to edit the program and to adjust our simulation as much as we need.Actually, the S-function technique was not as easy as we expected, but eventually we could dealwith it specially for this system which has multiple inputs and outputs. This simulation techniqueexplained here can be considered one of the most important results of this project, because theS-function technique in MATLAB has not been used too often in simulation specially for systemswith multiple inputs and/or outputs.The S-function technique is a tool in MATLAB/SIMULINK to describe a SIMULINK block. Thistool can be implemented by: an M-file in MATLAB, a C-MEX file (written by C, C++ or FOR-TRAN) or the S-function builder which contains some kind of ready-made blocks. We used thelevel-2 M-file language to implement this tool for simplicity, and herein we summarize the steps:

1. Build a block for the model in SIMULINK. No need to use the ready-made blocks, only theTo Workspace block to store the output and/or input variables, Level-2 M-file S-Functionblock to contain in a way the code (which is called M-File) that includes the commands tooperate SIMULINK and a Source block to assign the input of the desired type.

2. Write an M-File i.e. a code in which one should assign the parameters of the simulationto the desired values, start the simulation by invoking the block of the model and plot therequired signals.

3. Write another M-File that operates the block. The language used to write this M-File isobject-oriented so certain methods must be called as Inputs, Outputs, Derivatives,.. whichcorrespond to the input, output, derivatives,.. of the state-space model of the system andthen a code is written for each method.

4. Finally, open the block of the model by double-clicking it to set the second M-File as asource file and to set the parameters used.

To simulate the model described by equations (15) and (16) above by the means of the S-functionswe firstly commenced as mentioned above by building the model block shown in fig.3 in SIMULINK(we dropped the aD-subscript in the codes to simplify the notations). In this model we used a DCvalue of the input voltage u of 350V . This value may not be as close as wanted to the values usedby MicroPower, and even not based on a justified reasoning. However, the value by itself is not soimportant since we are interested in the harmonics only.The next step was to write the first M-File which we called (RunConverter65). As mentionedabove this M-File is used to assign the values of the parameters of the simulation, to start thesimulation and plot the required signals. The values of these parameters were obtained from the

10

Figure 3: The model used to simulate the system using SIMULINK

specifications of MicroPower for their charger listed in [1] and are listed here:

C1 =C = 47µF

C2 =C f = 12.7µF

L1 = L = 344µH

L2 = Ls = 500µH

R4 = RC = 50mΩ

R5 = R = 2Ω

D = 0.5 (17)

It should be mentioned here that some of the values listed in equations (17) lack the reliabilityrequired for this simulation because Ls ∈ [100,500]µH according to [1]. This surely will makeour task harder since we have to check and to try as will be shown later. Actually, determiningthe value of Ls is an important task by itself, because Ls models the inductance of the feedingnetwork so it can not be measured it can only be estimated based on the resonance frequency aswill be demonstrated later. However, we chose it to be 500µH and this will be justified later (seesection.6).In addition, RC was estimated roughly because we did not have a clear clue about its value.Finally,R is supposed to be set to suit the output power which is in the order of 8KW , but theoutput power depends on the output voltage which in turn depends on the duty-cycle so we de-cided to estimate the values randomly and to keep them the same through out all simulations.Actually, this is not as bad as it looks because we believe that the harmonics we are interested independ mainly on the values of C f , C, L and Ls.

We decided to plot the signals of the state vector xaD and the output vector(−zaD

−waD

). Note that

waD by definition is negative so we multiplied it by a negative sign just to make the graph smaller.Again the subscript (aD) was dropped in the code to simplify the notation in MATLAB. The first

11

M-File is written here:

RunConverter65:%RunConverter65

C1=47e-6;

C2=12.7e-6;

L1=344e-6;

L2=500e-6;

R4=50e-3;

R5=2;

D=0.5;

tspan = [0 0.1];

optionvec=simset(’MaxStep’,0.01,’RelTol’,1e-5);

optionvec=simset(optionvec,’InitialState’,[0 0 0 0]);

plot(t,x(:,1),t,x(:,2),’:’,t,x(:,3),’-.’,t,x(:,4),’-’);

figure(2); %Generating the graph in fig.4(a)title(’The Signals of the State vector’)

xlabel(’Time(seconds)’);

ylabel(’Signal Amplitude’);

figure(3) %Generating the graph in fig.4(b)plot(t,-z1,t,-z2,’:’,t,-w,’-.’);

title(’The signals of the output vector’)

xlabel(’Time(seconds)’);

ylabel(’Signal Amplitude’);

The second M-File which we called (msfn_Converter65) is used to tell the block createdin SIMULINK for the model how to proceed based on the Hamiltonian system given by equa-tions (15) and (16). To do that, we had to obtain a straight forward formulas for these equations,because MATLAB deals with the outputs and the derivatives of the states separately, i.e., in theDerivative and Output methods we had to write directly the formulas of each output and statederivative. In fact we think it is impossible to assign the formulas of the outputs and derivativesof the states otherwise. So we inserted equations (10) to (17) in the Hamiltonian system given byequations (15) and (16) to get:

xaD =

xaD3/L1− zaD2/R5

−DxaD3/L1 + xaD4/L2

−xaD1/C1 +DxaD2/C2−R4zaD1

−xaD2/C2 +uaD

(18)

(−zaD

waD

)=

−xaD3/L1 + zaD2/R5

−xaD1/C1−R4zaD1

−xaD4/L2

(19)

Now, we could easily assign to each output and state derivative its own formula as shown in theM-File below:

msfn_Converter65:

12

%msfn_Converter65

function msfn_Converter65(block)

setup(block)

function setup(block)

block.NumDialogPrms=7;

block.NumInputPorts=3;

block.NumOutputPorts=3;

block.SetPreCompInpPortInfoToDynamic;

block.SetPreCompOutPortInfoToDynamic;

block.InputPort(1).Dimensions=1;

block.InputPort(1).DirectFeedthrough=false;

block.InputPort(2).Dimensions=1;

block.InputPort(2).DirectFeedthrough=false;

block.InputPort(3).Dimensions=1;

block.InputPort(3).DirectFeedthrough=false;

block.OutputPort(1).Dimensions=1;

block.OutputPort(2).Dimensions=1;

block.OutputPort(3).Dimensions=1;

block.SampleTimes=[0 0];

block.NumContStates=4;

block.RegBlockMethod(’PostPropagationSetup’, @DoPostPropSetup);

block.RegBlockMethod(’InitializeConditions’,@InitConditions);

block.RegBlockMethod(’SetInputPortSamplingMode’, @SetInpPortFrameData);

block.RegBlockMethod(’Outputs’,@Output);

block.RegBlockMethod(’Update’, @Update);

block.RegBlockMethod(’Derivatives’,@Derivative);

function DoPostPropSetup(block)

block.NumDworks = 1;

block.Dwork(1).Name = ’z2’;

block.Dwork(1).Dimensions = 1;

block.Dwork(1).DatatypeID = 0;

block.Dwork(1).Complexity = ’Real’;

function InitConditions(block)

block.ContStates.Data(1)=0;

block.ContStates.Data(2)=0;

block.ContStates.Data(3)=0;

block.ContStates.Data(4)=0;

block.Dwork(1).Data = 0;

function SetInpPortFrameData(block,idx , fd)

block.InputPort(idx).SamplingMode = fd;

block.OutputPort(idx).SamplingMode = fd;

function Output(block)

L1 = block.DialogPrm(3).Data;

L2 = block.DialogPrm(4).Data;

R5 = block.DialogPrm(6).Data;

x3 = block.ContStates.Data(3);

x4 = block.ContStates.Data(4);

z2 = block.OutputPort(2).Data;

block.OutputPort(2).Data = block.Dwork(1).Data;

block.OutputPort(1).Data = -x3/L1- z2/R5 ;

block.OutputPort(3).Data = -x4/L2;

function Update(block)

13

C1 = block.DialogPrm(1).Data;

R4 = block.DialogPrm(5).Data;

x1 = block.ContStates.Data(1);

z1 = block.OutputPort(1).Data;

block.Dwork(1).Data = -x1/C1 + R4*z1;

function Derivative(block)

C1 = block.DialogPrm(1).Data;

C2 = block.DialogPrm(2).Data;

L1 = block.DialogPrm(3).Data;

L2 = block.DialogPrm(4).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

D = block.DialogPrm(7).Data:

u = block.InputPort(3).Data;

x1 = block.ContStates.Data(1);

x2 = block.ContStates.Data(2);

x3 = block.ContStates.Data(3);

x4 = block.ContStates.Data(4);

z2 = block.OutputPort(2).Data;

z1 = block.OutputPort(1).Data;

block.Derivatives.Data(1)=x3/L1 + z2/R5;

block.Derivatives.Data(2)=-D*x3/L1 +x4/L2;

block.Derivatives.Data(3)=-x1/C1 + x2*D/C2 + R4*z1;

block.Derivatives.Data(4)=-x2/C2 + u;

In the above M-File several methods were used, each method is invoked by the commandfunction method name (block)To explain thoroughly this M-File the methods are listed here:

a. setup: It is a compulsory method used to assign the various factors required for the simulationof the block such as the number of input ports and output ports and the dimension of each one,the number of the parameters (i.e. the constants) needed for the simulation, the number of thestates, the feedback possibility and the other methods required in the rest of the M-File.

b. DoPostPropSetup: It is used to activate and define one (Dwork) vector (or more) which is(are) used to store any variable(s) temporarily. In this method the dimension and name of each(Dwork) vector must be assigned.

c. InitConditions: It is used to set the initial conditions of the states and the (Dwork) vector.

d. Output: It is used to set a formula for each output in the output vector according to the state-space description of the model. The parameters used in these formulas must be declared beforebeing used.

e. Update: It is used to update the (Dwork) vector because it is temporary. The parameters usedin these formulas must be declared before being used.

f. Derivative: It is used to set a formula for each state derivative according to the state-spacedescription of the model. The parameters used in these formulas must be declared before beingused.

We assigned three input ports, namely: u, R4z1 and z1R5

, and three output ports: z1, z2 and w, thatwas because the Hamiltonian system given in (15) and (16) was multi-input multi-output. Theoutput ports z1 and z2 were fed back to the input ports (1) and (2) through the gain blocks to

14

achieve the desired inputs as shown in fig.3. With this feedback MATLAB could not calculate theoutput even if the initial values were assigned, so it was necessary to use the (Dwork) function,which we used to store the output z2 in a (Dwork) vector to be used later.In fact, this code took us too much time to design. As will be shown later, the complexity of thiscode was avoidable given that the Hamiltonian system described in equations (15) and (16) canbe simplified by a usual, single-input single-output state-space description. However, M. Lennelsrecommended us to include this complex technique to show that MATLAB and SIMULINK havea strong ability for simulation even for complex systems.

3.2.1 Results and Analysis by the First Technique

After running theses codes in MATLAB we got two graphs; fig.4(a) which shows the variationof the states xaD1 to xaD4 with time, and fig.4(b) which shows the variation of the output signalswith time. These results form the DC-solution sought. Actually, the results coincide with ourexpectations bearing in mind that zaD2 = vo,aD and waD = iin,aD. We notice that the output voltagevo is constant and equal to 175V , which is true since the input voltage u and the duty cycle Dused are both constant and their values are (350V ) and (0.5) respectively. At this stage, we haveto document also the final values of the states because we will need them later:

xaD =

0.00820.00440.03010.0219

(20)

15

(a)

(b)

Figure 4: (a) The graph representing the solutions of the state-vector (xaD). (b)The graph repre-

senting the solutions of the output vector(−zaD

−waD

).

16

3.3 Simulation of the Hamiltonian system-Second Technique

Now we present another technique to simulate our Hamiltonian model using S-Functions in MATALB.Other equations which describe the linearized solution of the system were derived in [1] to sim-plify the simulation. This system of equations was described in the usual state-space form andcontained one input and one output (We mean by one output here one vector which may con-tain several elements). We could imitate this system to present an easier technique for the ’DC-solution’ described previously because it made our simulation much easier than the first techniquedescribed earlier, the system is presented here (see [1]):

xaD = Fx,xxaD +Fx,uuaD (21)

zaD = Fz,xxaD +Fz,uuaD (22)

waD = BTx M−1

x xaD +BTz M−1

z zaD− JDuaD (23)

whereFx,x = (Jx(D)−NM−1

z (I− JzM−1z )−1NT )M−1

x (24)

Fx,u = (Bx−NM−1z (I− JzM−1

z )−1Bz) (25)

Fz,x = (I− JzM−1z )−1NT M−1

x (26)

Fz,u = (I− JzM−1z )−1Bz (27)

Of course the vectors xaD, zaD and waD are the same as those described earlier. The matrices Jx(D),Mx, N, Bx, Bz, Jz, JD and Mz are also given by equations (10) to (17) respectively. As mentionedearlier, this form of matrix equations is not practical to use in S-functions, so we had to find theoutputs and the derivatives of the states directly as shown below:

xaD =

−xaD1C1(R4+R5)

+R5xaD3

L1(R4+R5)

−DxaD3L1

+xaD4L2

−R5xaD1C1(R4+R5)

+DxaD2

C2− R4R5xaD3

L1(R4+R5)

−xaD2C2

+uaD

(28)

zaD =

−xaD1

C1(R4+R5)+

R5xaD3L1(R4+R5)

R5xaD1C1(R4+R5)

+R4R5xaD3

L1(R4+R5)

(29)

waD =

(xaD4

L2

)(30)

The system described by equations (21), (22) and (23) was easier to simulate because this time wehad one input and one output. The simulation of this model in MATLAB -just like the previousone- consisted of a block of the model in SIMULINK and two M-Files; the first one to give the

17

Figure 5: The model used to simulate the system described by equations (21) and (22).

order to the model to operate and it was called RunConverter65_1st. The other containedthe equations needed to operate the model and it was called msfn_converter65_1st.The model block is shown in fig.5 below. Unlike the model in fig.3 we had here one input: u whichrepresented uaD in the previous equations and it was chosen to be 350V as in the previous model,and one output zaD.

The first M-File used for this simulation is presented here, the values of the various parametersused here were as same as the values used in the previous simulation:

RunConverter65_1st:%RunConverter65_1st

C1=47e-6;

C2=12.7e-6;

L1=344e-6;

L2=500e-6;

R4=50e-3;

R5=2;

D=0.5;

tspan = [0 0.1];

optionvec=simset(’MaxStep’,0.01,’RelTol’,1e-5);

optionvec=simset(optionvec,’InitialState’,[0 0 0 0]);

([t,x])=sim(’ModelConverter65_1st’,tspan,optionvec);

figure(4) %Generating the graph in fig.6(a)plot(t,x(:,1),t,x(:,2),’:’,t,x(:,3),’-.’,t,x(:,4),’-’);

title(’The Signals of the State vector’);

xlabel(’Time(seconds)’);

ylabel(’Signal Amplitude’);

figure(5) %Generating the graph in fig.6(b)plot(t,z_aD(:,1),t,z_aD(:,2),’:’);

title(’The signals of the output vector’)

xlabel(’Time(seconds)’);

ylabel(’Signal Amplitude’);

figure(6) %Generating the graph in fig.6(c)plot(t,x(:,4)/L2);

18

title(’The signals of w_aD’)

xlabel(’Time(seconds)’);

ylabel(’Signal Amplitude in (A)’);

The second M-File used in this simulation is written here, and in this M-File the details of equa-tions (28) and (29) are included:

msfn_converter65_1st:%msfn_converter65_1st

function msfn_Converter65_1st(block)

setup(block)

function setup(block)

block.NumDialogPrms=7;

block.NumInputPorts=1;

block.NumOutputPorts=1;

block.SetPreCompInpPortInfoToDynamic;

block.SetPreCompOutPortInfoToDynamic;

block.InputPort(1).Dimensions=1;

block.InputPort(1).DirectFeedthrough=false;

block.OutputPort(1).Dimensions=2;

block.SampleTimes=[0 0];

block.NumContStates=4;

block.RegBlockMethod(’InitializeConditions’,@InitConditions);

block.RegBlockMethod(’Outputs’,@Output);

block.RegBlockMethod(’Derivatives’,@Derivative);

function InitConditions(block)

block.ContStates.Data(1)=0;

block.ContStates.Data(2)=0;

block.ContStates.Data(3)=0;

block.ContStates.Data(4)=0;

function Output(block)

C1 = block.DialogPrm(1).Data;

L1 = block.DialogPrm(3).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

x1=block.ContStates.Data(1);

x3=block.ContStates.Data(3);

block.OutputPort(1).Data(1)=-x1/(C1*(R4+R5))+R5*x3/(L1*(R4+R5));

block.OutputPort(1).Data(2)=R5*x1/(C1*(R4+R5))+ R4*R5*x3/(L1*(R4+R5));

function Derivative(block)

C1 = block.DialogPrm(1).Data;

C2 = block.DialogPrm(2).Data;

L1 = block.DialogPrm(3).Data;

L2 = block.DialogPrm(4).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

D = block.DialogPrm(7).Data;

u=block.InputPort(1).Data;

x1=block.ContStates.Data(1);

x2=block.ContStates.Data(2);

x3=block.ContStates.Data(3);

x4=block.ContStates.Data(4);

19

block.Derivatives.Data(1)=-x1/(C1*(R4+R5))+R5*x3/(L1*(R4+R5));

block.Derivatives.Data(2)=-D*x3/L1+x4/L2;

block.Derivatives.Data(3)=-R5*x1/(C1*(R4+R5))+D*x2/C2-R4*R5*x3/(L1*(R4+R5));

block.Derivatives.Data(4)=-x2/C2+u;

This M-File is much easier than (msfn_Converter65), as can be seen the methods DoPost-PropSetup and Update were not used here. The dimensions of the output port was set to twobecause zaD is a 2x1 vector, while the dimension of the input port was set to one because u is ascalar.

3.3.1 Results and Analysis of the Second Technique

This simulation was designed to give three graphs, they are depicted in fig.6 below. Fig.6(a) showsthe variations of the states xaD1 to xaD4 with time, fig.6(b) shows the variation of the output zaD

which is a 2x1 vector with time, while fig.6(c) shows the variation of xaD4L2

with time which is equalto waD according to equation (30).

20

(a)

(b)

(c)

Figure 6: (a)The graphs representing (a) The solutions of the state vector (xaD) (b) Tthe solutionsof the output vectorzaD (c) The solutions of waD

.21

Obviously, the results presented in fig.6 are identical to those presented in fig.4 and shownin equation (20), which means that the two techniques are identical. For simplicity we used thiseasier technique in the next simulations.

In summary of this section, we presented the Hamiltonian model of the DC/DC Buck converter,we explained in details two techniques that can be used to simulate that model using the so-calledS-functions in MATLAB and we proved that the two techniques give the same results. In addition,the results obtained from these simulations were documented as a DC-Solution in equation (20) tobe used later to linearize the Hamiltonian system.

4 Transfer Functions

B. Johansson in his PhD thesis [5] formulated different transfer functions for several kinds of DC-DC converters. In this section we introduce his model for the DC/DC buck converter representedby transfer functions, then we present a simulation of this model using same values used in pre-vious simulations and finally we compare the results of this simulation with the results we had inthe preceding section to show that the Hamiltonian model suggested in [1] matches the transferfunctions suggested by in [5] at least when the duty-cycle signal is constant with time.

4.1 Transfer functions of the DC/DC buck converter

For buck converters the author of [5] used a model similar to our model presented in fig.1, buthe did not consider the input part components Ls and C f , because his work was concentrated onthe converter itself, while we are more concerned with the interaction between the converter, therectifier and the feeding network. However, this model still resemble our model and thus we thinkthat a comparison between our results in the previous section and the results of the simulation ofhis model will be of great help.Of these transfer functions we chose two which will be easier to compare with our results. Thetransfer functions are presented here keeping the same notation used through our report (see [5]):

Vo(s)D(s)

= H1(s) =R5u(1+ sR4C1)

R5 + s(L1 +R4R5C1)+ s2(R4 +R5)L1C1(31)

IL1(s)D(s)

= H2(s) =u(1+ s(R4 +R5)C1)

R5 + s(L1 +R4R5C1)+ s2(R4 +R5)L1C1(32)

Where of course, the symbols C1, L1, R4, R5, u and vo(t) represent the same quantities as before.iL1(t) is the current through the inductor L shown in fig.1 which was called L1, while d(t) is thesignal used to control the duty cycle.

4.2 Simulation

The following M-file was used to simulate the transfer functions presented above in equations (31)and (32):

TransferFunctions_vo/d and il/d:%TransferFunctions_vo/d and il/d

L1=344e-6;

C1=47e-6;

R4=50e-3;

R5=2;

u=350;

D=0.5;

w_in=0;

22

Ad=0;

H1=tf([R4*R5*C1*u R5*u],[(R4+R5)*L1*C1 (R4*R5*C1+L1) R5]);

H2=tf([(R4+R5)*C1*u u],[(R4+R5)*L1*C1 (R4*R5*C1+L1) R5]);

t=linspace(0,1,2000);

d=D+Ad*sin(w_in*t);

figure(1) %Generating the graph in fig.8(a) and fig.12(a)lsim(H1,d,t)

title(’Signal Of Output Voltage with time’, ’fontsize’,14)

ylabel(’v_o(t) (V)’, ’fontsize’, 12)

xlabel(’Time’,’fontsize’,12)

figure(2) %Generating the Bode diagram in fig.7(a)bode(H1),grid

title(’Bode Diagram of H_1(j\omega)’,’fontsize’,14)

figure(3) %Generating the graph in fig.8(b) and fig.12(b)lsim(H2,d,t)

title(’Signal Of the current i_L_1’, ’fontsize’,14)

xlabel(’Time’,’fontsize’,12)

ylabel(’i_L_1(t) (A)’,’fontsize’,12)

figure(4) %Generating the Bode diagram in fig.7(b)bode(H2),grid

title(’Bode Diagram of H_2(j\omega)’,’fontsize’,14)

The same values of the parameters were used to ensure fair comparison with the results shownin equation (20), fig.4 and fig.6.Actually, we are interested in the interaction between the DC/DC converter and the input filter.More precisely, we intend to study the effect of the control signal d(t) on the ripples at the input ofthe converter. So, the control signal d(t) was set in the code above to the function D+Ad sin(ωint),which consists of two parts:

a) The DC-part set to a value of 0.5.

b) The time-varying part because this code is used later when the control signal d(t) is assumedto be varying with time to study the relation between the controller and the input filter. For thesimulation purposes the time-varying part of d(t) was assumed to be sinusoidal of amplitudeAd and angular frequency ωin = 2π fin where fin is the proposed frequency of the variation ofthe duty-cycle signal that controls the switch (S) in fig.1 and it is different from the switchingfrequency itself. From here on this frequency will be called the input frequency and denotedby fin, while switching frequency is denoted by fs.

For this simulation, the time-varying part was canceled by setting its coefficient Ad to zero justlike in the simulation of the Hamiltonian system presented earlier in section.3.

4.3 Results and Analysis

After running the code above four diagrams were obtained; fig.7 which depicts the the bode dia-grams of the transfer functions H1( jω) and H2( jω). And fig.8 which depicts the signals vo(t) andiL1(t).The results are quiet identical to those obtained from the simulation of the Hamiltonian modelshown in equation (20), fig.4 and fig.6. The output voltage vo(t) is constant and equal to 175V ,so is iL1(t) and it is equal to 87.5A. It may not be so clear that iL1(t) is as same as the valueobtained from the simulation of the Hamiltonian model. To show that, we need to remember first

23

(a) (b)

Figure 7: The bode diagrams of the transfer functions (a)H1( jω), and (b)H2( jω) given in equa-tions (31) and (32) suggested by B. Johansson [5].

(a) (b)

Figure 8: Results of the simulation of the model of the transfer functions suggested by B. Jo-hansson [5] when d(t) is constant: (a)vo(t), and (b)iL1(t). The graphs are zoomed in to show thebehavior of the signals before reaching stability.

that iL1 =x3L1

from equation (1), and x3 was obtained to be constant and equal to 0.0301 in equa-tion (20)from the simulation of the Hamiltonian model, so inserting the value of the parameterL1 = 344×10−6H we get that iL1 =

0.0301344×10−6 = 87.5A which is equal to the value obtained in fig.8.

In conclusion of this section, we can say that from this humble comparison that the Hamiltonianmodel suggested in [1] describes the model of the DC/DC buck converter identically to the transferfunctions proposed in [5], at least when the control signal is constant. In the next section we checkthe case when the control signal d(t) is not constant.

5 The Linearized Hamiltonian Model

So far we have proved that the simulation of the Hamiltonian system suggested in [1] is identicalto the simulation of the transfer functions proposed by the author of [5] when the duty-cycle isconstant. In this section we present the linearized Hamiltonian system, because it is believed-aswe mentioned earlier- that the Hamiltonian system is not linear. Then we show the simulation ofit in two cases: first when the duty-cycle is constant just like what we did in section.3 in orderto make sure that the two results match. The second when the duty-cycle is changing with time,then we compare the results of this simulation with the results of the simulation of the transferfunctions proposed in [5] after adjusting the parameters to obtain a fair comparison, hence we

24

show that the two systems are equivalent when the duty-cycle signal is not constant but for merelycertain ranges of input frequencies. Furthermore, we show that these frequencies in which theequivalence between the two systems is invalid are due to the resonance in the input circuit of ourmodel.

5.1 Linearizing of The Hamiltonian Model

There are a few different strategies to linearize a signal (see). One of the most well-known strate-gies is to find a DC point and consider the variations of that signal around it within a small range.This DC point was already found in section.3 and it was called there the ’DC-solution’ and it isgiven by equation (20). The equations of the linearized system are similar to those used beforewith a slight difference that will be explained after presenting them (see [1]):

˙xl = Jx(D)M−1x xl +BDd +

(−NBx

)(M−1

z zlu

)(33)(

−zlwl

)=(−N Bx

)T M−1x xl +

(−Jz −Bz

BTz −JD

)(M−1

z zlu

)(34)

The difference between equations (15), (16) and equations (33), (34) is the tilde sign, which de-notes the linearized difference of each variable from its ’DC-solution’ as follows (see [1]):

xl = x− xaD, zl = z− zaD (35)

andwl = w−waD, u = u−uaD, d = d−D (36)

and

BD = (Jx(d)− Jx(D))M−1x xaD =

0

−xaD3L1

xaD2C2

0

(37)

Of course, we need to prove that this linearized Hamiltonian system represented by equations (33)and (34) above is equivalent to the transfer functions proposed in [5] in equations (31) and (32). Itwould be reasonable to find the transfer function Vo(s)

D(s) or IL1 (s)D(s) from this Hamiltonian system above

in (33) and (34) and compare them with the transfer functions H1(s) and H2(s) in equations (31)and (32), but this would be a tedious task to do due to the complexity of the Hamiltonian system.So, instead we compare the results after carrying out the two simulations at different frequencies,and from this comparison we show the equivalence of the two systems.At this stage, we need to say that the values of the ’DC-solution’ of the state-vector xaD in equa-tion eq:xadresults were needed in this simulation as can be seen in equation (37), therefore all theparameters given in equation(17) were kept the same.

5.2 The simulation of the linearized Hamiltonian system

In section.3 two different techniques for the simulation of the Hamiltonian system were presented.It was proven that the two techniques are identical, but the second one was much easier than thefirst one. So, the second technique was used here also. This easier technique is described by thefollowing equations (see [1]):

˙xl = Fx,xxl +BDd +Fx,uu (38)

25

Figure 9: The model used to simulate the linearized Hamiltonian system described by equa-tions (38), (39) and (40) using SIMULINK

zl = Fz,xxl +Fz,uu (39)

wl = BTx M−1

x xl +BTz M−1

z zl− JDu (40)

As we did in section.3 with the S-functions in MATLAB, we first constructed a block for the lin-earized model in SIMULINK as shown in the fig.9 below. In this model d(t) was chosen to be afunction of time in the form (Ad sin(ωint)) because according to equation (36)d(t) = d(t)−D = D+Ad sin(ωint)−D = Ad sin(ωint)Thus we could change the control signal to get several simulations by changing the input frequencyfin of this signal. However, the value of u was set to zero here, because u = u−uaD and as in theearlier simulations uaD = 350V and u = 350V also.

Then we constructed two M-Files: the first was called RunConverter83_84, and the secondmsfn_Converter83_84. As explained earlier we needed to get an explicit formula for eachof the derivatives and the outputs to insert them in the M-File. So, we inserted equations (24),(25), (26) and (27) in equations (38), (39) and (40) to get:

˙xl =

−xl1C1(R4+R5)

+R5xl3

L1(R4+R5)

−Dxl3L1

+xl4L2− xaD3

L1d

−R5xl1C1(R4+R5)

+Dxl2C2− R4R5xl3

L1(R4+R5)+

xaD2C2

d

−xl2C2

+ u

(41)

zl =

−xl1

C1(R4+R5)+

R5xl3L1(R4+R5)

R5xl1C1(R4+R5)

+R4R5xl3

L1(R4+R5)

(42)

wl =

(xl4L2

)(43)

The first M-File is written here:

RunConverter83_84::%RunConverter83_84

C1=47e-6;

26

C2=12.7e-6;

L1=344e-6;

L2=500e-6;

R4=50e-3;

R5=2;

D=0.5;

tspan = [0 0.1];

optionvec=simset(’MaxStep’,0.01,’RelTol’,1e-5);

optionvec=simset(optionvec,’InitialState’,[0 0 0 0]);

([t,x_tilde])=sim(’ModelConverter83_84’,tspan,optionvec);

figure(1) %Generating the graphs in fig.10(a) and fig.11(a)plot(t,x_tilde(:,1),t,x_tilde(:,2),’:’,t,x_tilde(:,3),’-.’,t,x_tilde(:,4),’-’);

title(’Signals of stae vector x_l’,’fontsize’,16)

xlabel(’Time(sec)’,’fontsize’,12)

ylabel(’Amplitude of the signal’,’fontsize’,12)

figure(2) %Generating the graphs in fig.10(b) and fig.11(b)plot(t,z_tilde(:,1),t,z_tilde(:,2),’:’);

title(’Signals of output vector z_l’,’fontsize’,16)

xlabel(’Time(sec)’,’fontsize’,12)

ylabel(’Amplitude of the signal’,’fontsize’,12)

figure(3) %Generating the graphs in fig.10(c) and fig.11(c)plot(t,x_tilde(:,4)/L2)

title(’Signal of w_l’,’fontsize’,16)

xlabel(’Time(sec)’,’fontsize’,12)

ylabel(’Amplitude of the signal (A)’,’fontsize’,12)

And the second M-File is given here:

msfn_Converter83_84:%msfn_Converter83_84

function msfn_Converter83_84(block)

setup(block)

function setup(block)

block.NumDialogPrms=7;

block.NumInputPorts=2;

block.NumOutputPorts=1;

block.SetPreCompInpPortInfoToDynamic;

block.SetPreCompOutPortInfoToDynamic;

block.InputPort(1).Dimensions=1;

block.InputPort(2).Dimensions=1;

block.InputPort(1).DirectFeedthrough=false;

block.OutputPort(1).Dimensions=2;

block.SampleTimes=[0 0];

block.NumContStates=4;

block.RegBlockMethod(’InitializeConditions’,@InitConditions);

block.RegBlockMethod(’Outputs’,@Output);

block.RegBlockMethod(’Derivatives’,@Derivative);

function InitConditions(block)

block.ContStates.Data(1)=0;

block.ContStates.Data(2)=0;

block.ContStates.Data(3)=0;

block.ContStates.Data(4)=0;

27

function Output(block)

C1 = block.DialogPrm(1).Data;

L1 = block.DialogPrm(3).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

x_tilde1=block.ContStates.Data(1);

x_tilde3=block.ContStates.Data(3);

block.OutputPort(1).Data(1)=-x_tilde1/(C1*(R4+R5))+R5*x_tilde3/(L1*(R4+R5));

block.OutputPort(1).Data(2)=R5*x_tilde1/(C1*(R4+R5))+ R4*R5*x_tilde3/(L1*(R4+R5));

function Derivative(block)

C1 = block.DialogPrm(1).Data;

C2 = block.DialogPrm(2).Data;

L1 = block.DialogPrm(3).Data;

L2 = block.DialogPrm(4).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

D = block.DialogPrm(7).Data;

u_tilde=block.InputPort(2).Data;

d_tilde=block.InputPort(1).Data;

x_tilde1=block.ContStates.Data(1);

x_tilde2=block.ContStates.Data(2);

x_tilde3=block.ContStates.Data(3);

x_tilde4=block.ContStates.Data(4);

block.Derivatives.Data(1)=-x_tilde1/(C1*(R4+R5))+R5*x_tilde3/(L1*(R4+R5));

block.Derivatives.Data(2)=-D*x_tilde3/L1+x_tilde4/L2-0.0301*d_tilde/L1;

block.Derivatives.Data(3)=-R5*x_tilde1/(C1*(R4+R5))+D*x_tilde2/C2-R4*R5*x_tilde3/(L1*(R4+R5))

+0.0044*d_tilde/C2;

block.Derivatives.Data(4)=-x_tilde2/C2+u_tilde;

Note that the values of the state-vector xaD given in equation (20) were used in this M-File, thismay be a poor technique and it may affect the efficiency of the simulation of the linearized model.

5.3 Results and analysis

The simulation explained above were run and the results are discussed in the following subsec-tions:

5.3.1 When d(t) = D

The signal d(t) was set to the constant value D = 0.5, i.e. d(t) = 0 in the model in fig.9. Af-ter running the simulation above we got the results shown in fig.10 which shows that all of thevariables have zero values, and this makes sense because the tilde-signed variables represent thedifference between the real values and the DC-solution as shown in equations (35) and (36), and inthis case here they both are the same because the time-varying part of the duty-cycle was canceledby setting Ad to zero, that is why the difference is zero.

5.3.2 When d(t) = D+Ad sin(ωint)

The signal d(t) = D+Ad sin(ωint) was then tried in our model of fig.9 to check the behavior ofthis model when the duty-cycle signal is changing with time,i.e. d(t) = Ad sin(ωint) as mentionedearlier. Ad was set to 0.05 because we think that reducing the time-varying part of the duty-cycle

28

(a) (b) (c)

Figure 10: Graphs of the signals of (a) State vector xl (b) output vector zl (c)wl . The tilde sign wasdropped from the figure for simplicity.

compared to the DC-part would be more realistic.The real switching frequency fs used by MicroPower is around 50KHz. Note that the input fre-quency fin used to express the variation of the duty-cycle signal d(t) is different from the switchingfrequency fs. To study the behavior of the system when the duty-cycle varies with time differentfrequencies were tried, for example let us commence with the case when the input frequency fin

was set to 1KHz, the results shown in fig.11 were obtained.

29

(a)

(b)

(c)

Figure 11: Graphs of: (a) The state vector xl (b) The output vector zl (c)xl4L2

= wl when fin = 1KHz.The graphs are zoomed in by taking a window from 0.02s to 0.024s to clarify their oscillations.The tilde sign was dropped for simplicity. 30

(a) (b)

Figure 12: Results of the simulation of the transfer function model suggested by B. Johansson [5]when d(t) = 0.5+0.05sin(2π×1000t): (a)vo(t), and (b)iL(t) = iL1(t). The graphs are zoomed inby taking a window from 0 to 0.008s.

While the simulation of the transfer functions H1(s) and H2(s) in equations (31) and (32)gave the results shown in fig.12 when the values of the Ad and ωin in the code given in sec-tion.4 (TransferFunctions_vo/d and il/d) were set to 0.05 and 2π × 1000 respec-tively. Comparing fig.11 with fig.12 we see that both show that the signals oscillate about theDC-solutions obtained previously, bearing in mind that zl2 = vo−vo,aD and

xl3L1

= iL1− iL1,aD. Thismeans that the signal of vo is oscillating around the DC-value vo,aD = 175V and similarly iL1 isoscillating around iL1,aD = 87.5A.

Then, the oscillations themselves had to be compared. We began with the results of the simula-tion of the transfer function in equation (31) shown in fig.12(a), from which the amplitude andfrequency of the oscillations could be determined. By taking peak values the frequency was foundto be 1000Hz which was identical to the input frequency fin used. While the amplitude was foundto be 190−160

2 = 15V . To check this amplitude it looked intuitive to calculate the amplitude of thetransfer function H1(s) in dB at s = jωin = j2π×1000, so:|H1( jωin)|= 20log( 15

0.05) = 49.5dBFrom bode diagram in fig.7(a), it can be seen that this value is acceptable. The results of the sim-ulation of the linearized Hamiltonian system shown in fig.11(b) show that the frequency is again1000Hz and the amplitude of the oscillation is 12V .The preceding calculations were carried out for a wide spectrum of input frequencies to providea good comparison between the two simulations. The results are presented in table(2) below, inwhich for every different input frequency the two simulations were run and different values wereobtained:

• fin,T : The frequency of the ripples of vo(t) measured from the simulation of the transferfunction H1(s) in equation (31).

• Av,T : The amplitude of the ripples of vo(t) measured from the simulation of the transferfunction H1(s) in equation (31).

• fin,L: The frequency of the ripples of vo(t) measured from the simulation of the Hamiltoniansystem defined by equations (33) and (34).

• Av,L: The amplitude of the ripples of vo(t) measured from the simulation of the Hamiltoniansystem defined by equations (33) and (34).

31

• |H1( jωin)|: The magnitude of the transfer function H1(s) given by equation(31) obtainedfrom the bode diagram in fig.7(a).

Simulation of transfer function H1(s) Simulation of Hamiltonian systemfin(KHz) fin,T (KHz) Av,T (V ) 20log(Av,T

Ad)(dB) fin,L(KHz) Av,L(V ) |H1( jωin)|(dB)

0.5 0.5 17.0 50.6 1 16.3 50.51 1 15.0 49.5 1 12 49.52 2 6.0 41.6 2 11.2 43.02.5 2.5 4.2 38.5 2.5 31.4 38.63 3 3.0 35.6 3 5.6 364 4 1.7 30.6 4 2.0 314.5 4.5 1.3 28.3 4.5 1.5 28.55 5 1.0 26 5 1.1 267.5 7.5 0.5 20 7.5 0.45 20.510 10 0.27 14.6 10 0.2 1512.5 12.5 0.175 10.9 12.5 0.15 1115 15 0.12 8 15 0.1 6.020 20 0.07 2.9 20 0.016 3.525 25 0.045 -0.9 25 0.045 -1.030 30 0.032 -3.8 25 0.035 -3.540 40 0.02 -8.0 25 0.018 -7.5

Table 1: Comparison between the results of the simulation of the transfer function H1(s) in equa-tion(31) obtained by B. Johansson in his PhD thesis [5] and the linearized Hamiltonian system inequations (33) and (34).

From table(2) many observations can be made:

1. The frequencies of the oscillations of vo(t) obtained by the two simulations are identical andequal to the switching frequency in each case as expected, except at high frequencies wherethe oscillations obtained from the Hamiltonian system in equations (33) and (34) were less.

2. The values of 20log(Av,TAd

) are very close to the magnitude of the transfer function H1( jωin)as expected.

3. The values of Av,L are far from the values of Av,T when the input frequency fin ∈ [1000,3000]Hz,and they are close otherwise.

The last observation is peculiar and it needs investigating. Here we have to remember that theauthor in [5] did not consider the inductance of the conductors of the feeding network Ls and theoutput capacitance of the rectifier C f -as mentioned earlier- when he proposed the transfer functionH1(s). Although it looks intuitive to cancel Ls and C f in the Hamiltonian system by setting themto zero and a very large value respectively, this is unfeasible because MATLAB does not acceptzero as a value for Ls.Actually, the values Ls and C f play a crucial role in this project because it is believed that the mainreason of the unwanted ripples in the input signal is the resonance created by the inductance of thefeeding network represented by Ls which was set to 500µH and the rectifier output capacitance atthe input of the converter C f which was set to 12.7µF , so:

fresonance =1

2π√

LsC f= 1

2π×√

500×10−6×12.7×10−6 = 1997.25Hz

Hence, it seems logical to have mismatch between the amplitudes of the oscillations of vo(t)

32

obtained by the two simulations since the resonance frequency ∼ 2000Hz is transfered to the out-put voltage which causes magnification in the amplitude of the output voltage when the inputfrequency is around 2000Hz.Anyways, we will leave the issue of the resonance frequency to the next section and we concludethis section by the following result: The linearized Hamiltonian system describes the model ofthe DC/DC buck converter identically to the transfer functions even when the duty-cycle signal ischanging with time at least when the input frequency fin is not close to the resonance frequency.

6 Resonance frequency

The problem formulated by MicroPower is about unwanted ripples in the input voltage believedto be caused by the resonance between the inductance of the feeding network Ls and the outputcapacitance of the rectifier C f . We believe that the resonance is transfered to the output voltageas explained in the end of the last section. So, in this section we try to estimate these resonancefrequencies for different values of Ls by estimating the input frequencies at which the amplitudesof the oscillations of the output voltage are magnified. Thus, we try to justify our choice of thevalue of 500µH for Ls. Then, we study the signal of the input voltage and show that increasingthe capacitance C f decreases the amplitude of its ripples (i.e. suppresses these oscillations or inother words shift them to lower frequencies), and thus makes the output signal obtained fromthe simulation of the linearized Hamiltonian system look more similar to that obtained from thesimulation of the transfer function H1(s) presented in the previous section.

6.1 Resonance frequencies for different values of Ls

As we did in the last section we commenced by comparing the signal of vo(t) obtained by the sim-ulation of the linearized Hamiltonian system in equations (33) and (34) suggested in [1] with thatobtained from the simulation of the transfer function H1(s) in equation(31) suggested in [5] fordifferent values of the inductance of the feeding network Ls. Since Ls ∈ [100,500]µH accordingto [1] we carried out this comparison for two other values of Ls: 100×10−6H and 250×10−6H.Tables (3) and (4) show these comparisons.

Just like table (2), tables (3) and (4) show that the frequencies of the oscillations of vo(t) obtainedfrom the simulation of the linearized Hamiltonian system in equations (33) and (34) are equal tothe input frequencies used for the time-varying part of the duty-cycle unless the input frequencyis high (> 30KHz). We can notice also that the amplitudes of those ripples are very close to theamplitudes of the ripples of vo(t) obtained from the simulation of the transfer function H1(s) inequation(31) except the case when the input frequency is close to the resonance frequency, wherethe amplitudes are magnified. From tables (3) and (4) we can say that we have resonance when:fin ∈ [4000,5000]Hz for Ls = 100µHfin ∈ [2500,3000]Hz for Ls = 250µHWhich seems realistic since the resonance frequency for Ls = 100µH can be calculated as follows:

fresonance =1

2π√

LsC f= 1

2π×√

100×10−6×12.7×10−6 ≈ 4500Hz

And when Ls = 250µH:

fresonance =1

2π√

LsC f= 1

2π×√

250×10−6×12.7×10−6 ≈ 2800Hz

As a matter of fact, we think that these comparisons confirm our conclusion of the last section thatthe Hamiltonian system describes the DC/DC buck converter identically to the transfer functionsmodel, because we have matching between the results of the two simulations outside the resonancefrequency ranges above, regardless of the value of Ls or C f .

33

simulation of transfer function H1(s) Simulation of Hamiltonian systemfin(KHz) Av,T (V ) fin,L(KHz) Av,L(V )

0.5 17.0 0.5 17.01.0 15.0 1.0 142.0 6.0 2.0 5.92.5 4.2 2.5 3.83.0 3.0 3.0 2.84.0 1.7 4.0 2.24.5 1.3 4.5 7.65.0 1.0 5.0 2.67.5 0.5 7.5 0.510.0 0.27 10.0 0.2312.5 0.175 12.5 0.1615.0 0.12 15.0 0.1320.0 0.07 20.0 ∼ 0.0725.0 0.045 25.0 ∼ 0.0430.0 0.032 24.0 ∼ 0.0240.0 0.02 27.0 ∼ 0.02

Table 2: Comparison between the results of the simulation of the transfer function H1(s) in equa-tion (31) suggested by B. Johansson [5] and the linearized Hamiltonian system in equations (33)and (34) when Ls = 100×10−6H.

simulation of transfer function H1(s) Simulation of Hamiltonian systemfin(KHz) Av,T (V ) fin,L(KHz) Av,L(V )

0.5 17.0 0.5 16.81.0 15.0 1.0 13.42.0 6.0 2.0 5.52.5 4.2 2.5 5.33.0 3.0 3.0 22.04.0 1.7 4.0 2.55.0 1.0 5.0 1.27.5 0.5 7.5 0.4510.0 0.27 10.0 0.2112.5 0.175 12.5 ∼ 0.1715.0 0.12 15.0 ∼ 0.0720.0 0.07 20.0 ∼ 0.0725.0 0.045 25.0 ∼ 0.04330.0 0.032 24.0 ∼ 0.02340.0 0.02 27.0 ∼ 0.018

Table 3: Comparison between the results of the simulation of the transfer function H1(s) in equa-tion (31) suggested by B. Johansson [5] and the linearized Hamiltonian system in equations (33)and (34) when Ls = 250×10−6H.

34

Furthermore, we have to mention another important result here about the choice of the value of Ls.We said earlier in section.3 that determining the value of Ls is a crucial task and we said that we setit to 500µH and here is the justification for this choice. The output capacitance of the rectifier C f

has a value of 12.7µF from the schematic diagrams and specification sheets of the charger used byMicroPower listed in [1]. The inductance Ls was used to model the inductance of the conductorsin the feeding network of the charger, so it was very hard to estimate it. In addition to that, we didnot have solid measurements of the resonance frequencies to depend on, but we understood thatthe unwanted ripples have a frequency around 2000Hz. So, assuming that the value of C f is fixedit looked reasonable to choose the value of Ls to be 500µH to get a resonance at a frequency of2KHz.Once again, this value was an estimation only and we did not intend to find good approximationsof these values in our report, we were just trying to simulate the Hamiltonian system and to showthat it is very close to the reality.

6.2 Increasing C f and shifting resonance

One of the solutions suggested to the problem of the unwanted ripples at the input voltage is toincrease the rectifier output capacitance C f to shift the resonance frequency down to a very lowfrequency. Despite the fact that this could be an expensive and impractical solution for the prob-lem, we used our simulation of the linearized Hamiltonian system to show that increasing the valueof C f eventually suppressed the ripples in the input voltage.In order to show that, we should extract the signal of the input voltage from our simulation. Thiscould be easily done using equation (1), from which we could see that the second statex2 =C2uC2

where, C2 =C f and uC2 is the voltage across that capacitor which is the input voltage for the buckDC/DC buck converter. Therefore, we can say that:vin(t) = uC2 =

x2C2

and thus, we could obtain the signal of the input voltage just by dividing the second state signal bythe capacitance C f =C2. In order to do that, we changed one line in the M-file RunConverter83_84presented in the previous section to:plot(t,x_tilde(:,2)/C_2)As an example, setting Ls, C f to 500µH, 12.7µF respectively, and d to 0.05sin(2π × 1000t)we obtained the graph shown in fig.13. From that graph we could determine the amplitude andfrequency of the oscillations. Actually these measurements were not as accurate as we wished be-cause the oscillations of the input voltage contain, in addition to the input frequency, the resonancefrequency which distort the signal. However, we claim that these measurements were obtained toa satisfactory accuracy. Of course we have to bear in mind that the second state signal from oursimulation of the linearized Hamiltonian system represents xl2 not x2, this means that the oscilla-tions that we obtained here were for the signal:xl2 = x2− xaD2 =C2vin =C2(vin− vinaD)Where, the subscript aD denotes the DC-solution of each signal as mentioned earlier. Ls andC f was kept at 500µH and 12.7µF respectively. The duty-cycle signal d(t) was also kept atAd sin(ωint) with Ad = 0.05 and the input frequency fin varying to cover a wide range as we didpreviously, then the amplitude and frequency of the oscillations of the input voltage were mea-sured. Table (5) shows these results against the old results of the output voltage, in which:

• fx2 : represents the measured frequency of the oscillation ofxl2C2

.

• Av,x2 : represents the measured amplitude of the oscillations ofxl2C2

.

These measurements were repeated for two more values of C f ; 12.7×10−5F and 12.7×10−5F ,The results are shown in table (6).

35

Figure 13: Signal vin(t) when C f = 12.7µF , Ls = 500µH and fin = 1000Hz zoomed in from 0.01sto 0.015s. The tilde sign was dropped for simplicity.

fin(KHz) Av,L(V ) fx2(KHz) Av,x2(V )

1.0 12 1.0 252.0 11.2 2.0 753.0 5.6 3.0 51.74.0 2.0 4.0 215.0 1.1 5.0 13.510.0 0.2 10.0 0.520.0 0.016 20.0 2.7

Table 4: Comparison between the oscillations of the input and output voltages as obtained fromthe simulation of the linearized Hamiltonian system when C f = 12.7×10−6F .

36

C f = 12.7×10−5F C f = 12.7×10−4Ffin(KHz) Av,L(V ) Av,x2(V ) fin(KHz) Av,L(V ) Av,x2(V )

0.65 17.8 71.2 0.2 17.3 68.31.0 18.5 20.1 1.0 15.2 12.0 6.8 4 2.0 6.0 0.313.0 3 2.1 3.0 2.9 0.174.0 1.6 1.5 4.0 1.7 0.155.0 1.1 1.2 5.0 1.1 0.110.0 0.022 0.5 10.0 0.22 0.0520.0 0.004 0.14 20.0 0.044 0.012

Table 5: Comparison between the oscillations of the input and output voltages as obtained fromthe simulation of the linearized Hamiltonian system in equations (33) and (34) when C f = 12.7×10−5F (Left) and C f = 12.7×10−4F (Right).

Comparing the results in tables (5) and (6) we can extract the following observations:

1. The dominant frequency of the oscillations of the input voltage was equal to the input fre-quency fin.

2. The amplitudes of these oscillations were maximum at the resonance frequencies. Theresonance frequencies for the three cases when C f = 12.7× 10−6F , 12.7× 10−5F and12.7×10−4F above are calculated here:fresonance,1 =

12π√

LsC f= 1

2π×√

500×10−6×12.7×10−6 ≈ 2000Hz

fresonance,2 =1

2π×√

500×10−6×12.7×10−5 ≈ 630Hz

fresonance,3 =1

2π×√

500×10−6×12.7×10−4 ≈ 200Hz

which agree exactly with the results shown in the tables above, since the amplitudes Av,x2(V )at the three frequencies for the three capacitances were 75V , 71.2V and 68.3V respectively.

3. As the input frequency got farther from the resonance frequency the amplitude of the oscil-lations of the input voltage decreased for each value of the capacitance used.

4. Expectedly, the higher the value of the capacitance C f was, the less the amplitude of theoscillations of the input voltage. This confirms the thought that increasing this capacitancewould suppress the input voltage oscillations. Unfortunately, we could not decide a certainvalue for such a capacitance since we did not have concrete measurements from the realconverter and we did not have a clear definition of the word ’suppress’, i.e. it was hard todetermine a threshold value of the amplitude of the input voltage oscillations Av,x2(V ) forwhich the oscillations could be considered suppressed.

5. The higher the value of the capacitance C f was, the closer the amplitudes of the oscillationsof the output voltage Av,L obtained from the simulation of the linearized Hamiltonian sys-tem to Av,T which represented also the amplitudes of the oscillations of the output voltageobtained from the simulation of the transfer function H1(s). This observation can be noticedclearly if we compare the values of Av,L in table (6) specially when C f = 12.7×10−4 withthose of Av,T in table (2). Actually, this result was very relieving, because it proved againthat the two simulations presented previously for the linearized Hamiltonian system and thetransfer function H1(s) are equivalent. This can be understood from the fact that increasingthe capacitance C f would smoothen the signal of the input voltage or suppress its oscilla-tions, and this would make the input voltage closer to a DC value, which was exactly the

37

case in the model suggested in [5] since the author did not consider Ls neither C f and heassumed a DC input voltage.

In conclusion, we showed that a possible remedy of the problem of the input voltage oscilla-tions would be increasing the capacitance C f . However, this solution is expensive and impracticalbecause we know that increasing the capacitance that much requires too much space and cost.Therefore, we try in the next section to investigate another solution for this problem.

7 Augmented System

An alternative way to suppress the fast oscillations in the input voltage was suggested in [1]. Anaugmented system was suggested, because it is believed that by finding a suitable control law thefast oscillations in the input voltage can be suppressed efficiently without affecting the stability ofthe output voltage. In this section we present this augmented system and show its simulation afterfinding that control law. In addition to that we try to find the suitable parameters which guaranteea suitable control law that suppresses the fast oscillations in the input voltage.

7.1 The Augmented System and Control Law

A new system was proposed in [1] by augmenting the linearized Hamiltonian system by adding atarget output function called yaux given in the Laplace transform by (see [1]):

Yaux(s) =Tauxs

1+Tauxsα fU f (s)+

11+Tauxs

αoUo(s) (44)

where, u f is the voltage across the capacitor C f in the circuit shown in fig.1 which was calleduC2 in equation(1), and uo is the output voltage which has been called vo through this report. Thetilde-sign, just as in section.5, denotes the difference between the signal and its DC-value. Finally,α f and αo are strictly positive constants with the limitation αo +α f = 1 to be determined later.

This target output function yaux represents a combination of the two main targets of this con-trol strategy: the stability of the output voltage and the ripples in the input voltage. In addition,this target output is proposed to bring these two components to zero so it has to be decaying withtime. Finally, because it is believed that in practice one is interested in suppressing the fast ripples(high frequency) in the input voltage, the input voltage u f should dominate at high frequencies.That is why the term with u f is multiplied by s in the above equation. Taking the inverse Laplacetransform we get(see [1]):

dyaux

dt=− 1

Tauxyaux +α fC f

du f

dt+

αo

Tauxuo (45)

Thus, without going through the mathematical details, the augmented system would be (see [1]:

˙xaug = Faugxaug +Baug,d d +Baug,uu (46)

where:

xaug =

(xl

yaux

)(47)

38

and

Faug =

−1C1(R4+R5)

0 R5L1(R4+R5)

0 0

0 0 −DL1

1L1

0

−R5C1(R4+R5)

DC2

−R4R5L1(R4+R5)

0 0

0 −1C2

0 0 0

αoR5C1(R4+R5)Taux

0 −α f DL1

+ R4R5L1(R4+R5)

α fL2

−1Taux

(48)

furthermore,

Baug,d =

0

−xaD3L1

xaD2C2

0

−α f xaD3L1

, Baug,u =

0

0

0

1

0

(49)

To find the control law LQR theory was used in which one tries to minimize a quadratic cost func-tion by the usual Riccati equation. The cost function for our model can be defined by (see [1]:

J(d) =∞∫

0

(xTl M−1

x xl +qyyy2aux +ρ d2)dt (50)

where, ρ and qyy are parameters to be found later. It was proved in [1] that when u = 0 (as in ourcase here) the solution which could minimize the cost function above is (see [1]:

d =−Laugxaug =−Laug

(xl

yaux

)(51)

and, Laug is the control law we are searching for, and it can be found by (see [1]:

Laug = ρ−1BT

aug,dP (52)

and P is given by (see [1]):

P = limT→∞

P(t,T ) (53)

furthermore, P(t,T ) is a symmetric matrix which satisfies (see [1]):−P = PFaug +FT

augP−PBaug,dR−1BTaug,dP+Q

P(T,T ) = 0(54)

R here is a positive definite matrix, while Q is a positive matrix given by (see [1]):

Q =

(M−1

x 00 q2

yy

)(55)

39

To find the control law in equation(52), we had to find P. First of all, we assumed that:˙P = 0because according to equation(53), P is the limit of P(t,T ) when T approaches ∞, and in infin-ity the function P(t,T ) reaches a constant value, this assumption was motivated by the argumentprovided by T. Glad and L. Ljung in their book [19]. By this assumption equation(54) could berewritten as:

0 = PFaug +FTaugP− PBaug,dR−1BT

aug,dP+Q (56)

The last equation represents the usual Riccati equation in matrix form, which could be solvednumerically using MATLAB for the matrix P. Then the matrix Q given by equation(55) was sim-plified using equation(7) to get:

Q =

1

C10 0 0 0

0 1C2

0 0 00 0 1

L10 0

0 0 0 1L2

00 0 0 0 q2

yy

(57)

Finally, we assumed that the positive definite matrix R = (1) the identity matrix. Now, with thematrices Faug and Baug,d as in equations (48) and (49) respectively, all the ingredients of the recipewere available and ready to find the control law Laug, all we needed to do was to write a simpleM-file as the following:

ControlLaw:%Control_Law

C1=47e-6;

C2=12.7e-6;

L1=344e-6;

L2=500e-6;

R4=50e-3;

R5=2;

D=0.5;

alpha_o=0.5;

alpha_f=1-alpha_o;

x_ad2=0.0044;

x_ad3=0.0301;

qyy=10;

T_aux=0.1;

rho=40;

F_aug=[-1/(C1*(R4+R5)) 0 R5/(L1*(R4+R5)) 0 0;

0 0 -D/L1 1/L2 0;

-R5/(C1*(R4+R5)) D/C2 -R4*R5/(L1*(R4+R5)) 0 0;

0 -1/C2 0 0 0;

alpha_o*R5/(C1*(R4+R5)*T_aux) 0 -alpha_f*D/L1+R4*R5/(L1*(R4+R5)) alpha_f/L2 -1/T_aux];

B_aug=[0; -x_ad3/L1; x_ad2/C2; 0; -alpha_f*x_ad3/L1];

Q=([1/C1 0 0 0 0; 0 1/C2 0 0 0; 0 0 1/L1 0 0; 0 0 0 1/L2 0; 0 0 0 0 qyy^2]);

([P_bar,E,K])=care(F_aug,B_aug,Q);

L_aug=(B_aug)’*P.*(1/rho);

V=eigs(F_aug-B_aug*L_aug);

40

Figure 14: The model of the augmented system built in SIMULINK.

The built-in function care in MATLAB was used here to solve the Riccati equation given by(56). This function returns three matrices denoted by P_bar, E and K in the code above. The firstis the desired solution of the Riccati equation. The third K represents the gain of the system givenby:K = R−1BT

augPObviously, if the matrix R was set to (ρ), then K = Laug. But because we restricted ourselves tothe denotation used in [1] we would rather keep R = (1) and calculate Laug from equation (52).Finally, the second is a vector represents the eigenvalues of the closed-loop system Faug−BaugKwhich was in this case not of great interest for us, instead we calculated the eigenvalues of theclosed-loop system Faug−BaugLaug in the vector V , which were all supposed to be in the left-halfplane (LHP). Of course, the values of C1, C2, L1, L2, R4, D and R5 were kept the same as in theprevious simulations to ensure fair comparison. Taux was set to 0.1s, while the other parameterswere set randomly just to test the code, in the next section we show how to obtain suitable valuesfor them. Executing the code above gave the following matrices, note that the eigenvalues shownin matrix V are all in the LHP as expected:

P =

4.9378 3.2651 1.0869 0.7001 0.40163.2651 10.6849 1.8841 0.9130 0.36811.0869 1.8841 0.6498 0.4541 0.12400.7001 0.9130 0.4541 0.7778 0.09840.4016 0.3681 0.1240 0.0984 0.0457

, V =

−0.0592−1.5444i−0.0592+1.5444i−0.4922−0.4354i−0.4922+0.4354i

−0.0634

×104

Laug =(

2.0961 −7.2157 1.4521 1.8926 0.2489)

7.2 Simulation Of The Augmented System

We made up our minds to stick to the S-function technique in MATLAB to simulate our augmentedsystem because we already made the simulation of the linearized Hamiltonian system using thattechnique, so we just had to amend it. AS we did in section.3 and section.5, we had firstly to buildthe model in SIMULINK, then we wrote two M-files to run it. The model we built in SIMULINKis shown in fig.14 below where we can see that the input u denoted in the block by (u_aug) wasset to zero.The first M-file, called RunAugmentedSytem here, contains the values of all the parameters

used in the simulation and it was used to tell MATLAB to run the model shown in fig.14above. It isvery similar to RunConverter65_1stM-file presented in (section.3) and RunConverter83_84presented in (section.5), but we had to add some commands to determine the control law Laug as

41

done in the previous subsection. This code is presented here:

RunAugmentedSystem:%RunAugmentedSystem

C1=47e-6;

C2=12.7e-6;

L1=344e-6;

L2=500e-6;

R4=50e-3;

R5=2;

D=0.5;

alpha_o=0.5;

alpha_f=1-alpha_o;

x_ad2=0.0044;

x_ad3=0.0301;

qyy=0.1;

T=0.1;

rho=40;

F_aug=[-1/(C1*(R4+R5)) 0 R5/(L1*(R4+R5)) 0 0;0 0 -D/L1 1/L2 0;

-R5/(C1*(R4+R5)) D/C2 -R4*R5/(L1*(R4+R5)) 0 0;0 -1/C2 0 0 0;

alpha_o*R5/(C1*(R4+R5)*T) 0 -alpha_f*D/L1+R4*R5/(L1*(R4+R5)) alpha_f/L2 -1/T];

B_aug=[0; -x_ad3/L1; x_ad2/C2; 0; -alpha_f*x_ad3/L1];

Q=[1/C1 0 0 0 0; 0 1/C2 0 0 0; 0 0 1/L1 0 0; 0 0 0 1/L2 0; 0 0 0 0 qyy^2];

([P,E,K])=care(F_aug,B_aug,Q);

L_aug=(B_aug)’*P.*(1/rho);

V=eigs(F_aug-B_aug*L_aug)

K1=L_aug(1,1);

K2=L_aug(1,2);

K3=L_aug(1,3);

K4=L_aug(1,4);

K5=L_aug(1,5);

tspan = [0 0.1];

optionvec=simset(’MaxStep’,0.01,’RelTol’,1e-6);

optionvec=simset(optionvec,’InitialState’,[0 0 0 0 0.1]);

([t,x_aug])=sim(’ModelAugmentedSystem’,tspan,optionvec);

figure(1) %Generatin the graph in fig.15(a)plot(t,x_aug(:,2)/C2)

title(’The signal of the input voltage’,’fontsize’,16)

xlabel(’Time (sec)’,’fontsize’,12)

ylabel(’v_in(t) (V)’,’fontsize’,12)

figure(2) %Generatin the graph in fig.15(b)plot(t,z_aug(:,2),t,z_aug(:,3),’:’)

Title(’Sgnals of the output voltage and target output’,’fontsize’,16)

xlabel(’Time (sec)’,’fontsize’,12)

ylabel(’Amplitude (V)’, ’fontsize’,12)

Also in this code we stored the elements of the control law vector Laug which represent the gainfactors in five variables K1 to K5, because programming using S-functions require separating theformulas to write the derivatives and outputs of the system as we mentioned earlier. Hence, beforewriting the second code which defines the derivatives of the states of our system, we had to sim-plify equation (46) using equations (48) and (49) to get:

42

˙xaug =

−xaug1C1(R4+R5)

+R5xaug3

L1(R4+R5)

−Dxaug3L1

+xaug4

L2− xaD3 d

L1

−R5xaug1C1(R4+R5)

+Dxaug2

C2− R4R5xaug3

L1(R4+R5)+

xaD2 dC2

−xaug2C2

+ u

αoR5xaug1TC1(R4+R5)

+ xaug3(−α f D

L1+ R4R5

L1(R4+R5))+

α f xaug4L2− xaug5

T +α f dL1

(58)

Furthermore, from equation (36) and using the gain factors in the code K1 to K2, d was replacedby:d =−(K1xaug1 +K2xaug2 +K3xaug3 +K4xaug4 +K5xaug5)Now we are ready to present the second M-file which was called msfn_AugmentedSystemhere:

msfn_AugmentedSystem:%msfn_AugmentedSystem

function msfn_AugmentedSystem(block)

setup(block)

function setup(block)

block.NumDialogPrms=15;

block.NumInputPorts=1;

block.NumOutputPorts=1;

block.SetPreCompInpPortInfoToDynamic;

block.SetPreCompOutPortInfoToDynamic;

block.InputPort(1).Dimensions=1;

block.InputPort(1).DirectFeedthrough=false;

block.OutputPort(1).Dimensions=3;

block.SampleTimes=[0 0];

block.NumContStates=5;

block.RegBlockMethod(’InitializeConditions’,@InitConditions);

block.RegBlockMethod(’Outputs’,@Output);

block.RegBlockMethod(’Derivatives’,@Derivative);

function InitConditions(block)

block.ContStates.Data(1)=0;

block.ContStates.Data(2)=0;

block.ContStates.Data(3)=0;

block.ContStates.Data(4)=0;

block.ContStates.Data(5)=0.1;

function Output(block)

C1 = block.DialogPrm(1).Data;

L1 = block.DialogPrm(3).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

x_aug1=block.ContStates.Data(1);

x_aug3=block.ContStates.Data(3);

43

x_aug5=block.ContStates.Data(5);

block.OutputPort(1).Data(1)=-x_aug1/(C1*(R4+R5))+R5*x_aug3/(L1*(R4+R5));

block.OutputPort(1).Data(2)=R5*x_aug1/(C1*(R4+R5))+ R4*R5*x_aug3/(L1*(R4+R5));

block.OutputPort(1).Data(3)=x_aug5;

function Derivative(block)

C1 = block.DialogPrm(1).Data;

C2 = block.DialogPrm(2).Data;

L1 = block.DialogPrm(3).Data;

L2 = block.DialogPrm(4).Data;

R4 = block.DialogPrm(5).Data;

R5 = block.DialogPrm(6).Data;

D = block.DialogPrm(7).Data;

alpha_o= block.DialogPrm(8).Data;

alpha_f= block.DialogPrm(9).Data;

T= block.DialogPrm(10).Data;

K1= block.DialogPrm(11).Data;

K2= block.DialogPrm(12).Data;

K3= block.DialogPrm(13).Data;

K4= block.DialogPrm(14).Data;

K5= block.DialogPrm(15).Data;

u_aug=block.InputPort(1).Data;

x_aug1=block.ContStates.Data(1);

x_aug2=block.ContStates.Data(2);

x_aug3=block.ContStates.Data(3);

x_aug4=block.ContStates.Data(4);

x_aug5=block.ContStates.Data(5);

block.Derivatives.Data(1)=-x_aug1/(C1*(R4+R5))+R5*x_aug3/(L1*(R4+R5));

block.Derivatives.Data(2)=-D*x_aug3/L1+x_aug4/L2+0.0301*(K1*x_aug1

+K2*x_aug2+K3*x_aug3+K4*x_aug4+K5*x_aug5)/L1;

block.Derivatives.Data(3)=-R5*x_aug1/(C1*(R4+R5))+D*x_aug2/C2-R4*R5*x_aug3/(L1*(R4+R5))

-0.0044*(K1*x_aug1+K2*x_aug2+ K3*x_aug3+K4*x_aug4+K5*x_aug5)/C2;

block.Derivatives.Data(4)=-x_aug2/C2+u_aug;

block.Derivatives.Data(5)=alpha_o*R5*x_aug1/(T*C1*(R4+R5))

+x_aug3*(-alpha_f*D/L1+R4*R5/(L1*(R4+R5)))+alpha_f*x_aug4/L2-x_aug5/T

+0.0301*alpha_f*(K1*x_aug1+K2*x_aug2+K3*x_aug3+K4*x_aug4+K5*x_aug5)/L1;

7.3 Results and Suitable Parameters

Our mission was to run this simulation and hence obtain good values for the parameters qyy, ρ andαo. This mission was hard because we had three parameters to adjust. As a beginning, we chosethe following values for the parameters above:qyy = 0.1, ρ = 40, αo = 0.5Then we had to set an initial value for yaux because if we set it to zero it would not decay, let thisinitial value be 0.1V . After running the above code with these parameters we got the results shownin fig.15, which shows the oscillations of the input voltage obtained from dividing xaug2 by C2 inpart (a) and the oscillations of the output voltage vo(t) with the auxiliary output voltage yaux in(b). From fig.15 we can see that the oscillations of the input voltage are suppressed to about 0.1V ,which is a very good result and at the same time the oscillations of the output voltagezaug2 = vo = vo(t)− vo,aD

are in the order of 0.01V while the signal itself is decaying to a value close to zero because theauxiliary output voltage yaux is decaying to zero as assigned. Thus, using this augmented systemthe ripples of the input voltage are suppressed significantly, so are the ripples of the output voltage.

44

(a) (b)

Figure 15: The graphs obtained from the simulation of the augmented system: (a) Oscillations ofthe input voltage vin = xaug2/C2 zoomed in from 0.01s to 0.02s. (b) Graph of yaux oscillations ofvo(t) = zaug,2.

The eigenvalues of the closed loop system Faug−BaugLaug and the control law vector Laug are dis-played here:

V =

−0.0682−1.5371i−0.0682+1.5371i−0.5095−0.4344i−0.5095+0.4344i

−0.0013

×104, Laug =(−0.1159 −9.5996 0.5640 0.9855 0.0018

)

These results are reasonable because the eigenvalues are all in the LHP and the gain factors are notso high. Of course, better results could be achieved by choosing better values for the parametersqyy, ρ and αo.

In conclusion of this section, we presented the augmented system and its simulation. Then weshowed how we could choose suitable parameters for the control law to make it suppress theoscillations of the input voltage in addition to the oscillation of the output voltage.

8 Conclusion

In this report we presented a model for the DC/DC buck converter as suggested in [1]. This modeldescribes the converter with its input filter by a Hamiltonian system taking the inductance of thefeeding network in consideration. Then we simulated that model when the duty-cycle is constantin section 3.Then, as suggested in [1], we linearized this model around the DC-solution and simulated it againwhen the duty-cycle is changing with time and we compared the results we had with the results ofthe simulation of the transfer functions suggested in [5] to prove that the two models match whenthe frequency of the duty-cycle signal (input frequency fin) is not close to the resonance frequencyin section 4 and 5.

In addition, in section 6 we studied the unwanted ripples at the input voltage to show that theyare caused mainly by the resonance between the output capacitor of the rectifier C f and the feed-ing network inductance Ls in fig.1, and we showed that increasing the capacitance of C f wouldeventually decrease these ripples but that would be an expensive solution.Finally, in section 7 we presented the proposal in [1] to control this model in which the systemwas augmented by adding a suitable target output function and the LQR theory was applied to find

45

a control law for this augmented system. Then we simulated the augmented system to prove thatthis control law did really achieve the two main targets which are suppressing the ripples in theinput voltage and keeping the output voltage regulated. All the simulations were made using theS-Function technique in MATLAB/SIMULINK and they were implemented by writing M-filesand not by using ready-made blocks.

For future work, as a continuation for this report we recommend doing the simulations of thethree-phase AC/DC Buck converter. We think that reducing the number of states for such a systemwould be necessary. It would be also a good idea to build an estimator (observer) for this modelbecause not all the signals can be measured.

AcknowledgmentWe would like to show our gratitude to Matz Lenells for his support. He never hesitated in givingus any kind of help. He showed us a lot of tolerance, understanding and encouragement. Withouthim this project has never been.We would like also to thank our teachers in the department of physics, mathematics and computersciences in Linnæus University specially Sven-Erik Sandström for his valuable comments andadvices on the language of this report.

46

References

[1] M. Lenells. A proposal of a controller for a AC-DC converter where oscillations of the in-put voltage are suppressed-a preliminary version. School of Computer Science, Physics andMathematics, Linnaeus University, 2010. To appear.

[2] H. Y. Kanaan and K. Al-Haddad. A Novel Averaged-Model-Based Control of a SEPIC PowerFactor Corrector Using the Input/Output Feedback Linearization Technique. IEEE 0-7803-9033-4/08, 2005.

[3] Y. Tang, H. Yu and Z. Zou. Hamiltonian Modeling and Energy-Shaping Control of Three-Phase AC/DC Voltage-Source Converters. Proceedings of the IEEE 978-1-4244-2503-7/08,2008.

[4] M. Usman Iftikhar, E. Godoy, P. Lefranc, D. Sadarnac and C. Karimi. A Control Strategyto Stabilize PWM DC-DC Converters with Input Filters Using State-Feedback and Pole-Placement. IEEE 978-1-4244-2056-8/08, 2008.

[5] B. Johansson. Improved Models for DC-DC Converters. PhD thesis, Department of Indus-trial Electrical Engineering and Automation, Lund University and Department of Technology,University College of Kalmar, 2003.

[6] C. Karimi, E. Godoy, M. U. Iftikhar, P. Lefranc and D. Sadarnac. High frequency Modeling ofPeak Current Mode Control of DC-DC Converters. IEEE 978-1-4244-2291-3/09, 2009.

[7] L. S. Yang, T. J. Liang, J. F. Chen and R. L. Lin. Analysis and design of a novel, single-stage,three-phase AC/DC step-down converter with electrical isolation. IET Power Electron. Vol. 1,No. 1, pp 154-163, 2008.

[8] Y. W. Li. Control and Resonance Damping of Voltage-Source and Current-Source ConvertersWith LC Filters. IEEE Transactions On Industrial Electronics, Vol. 56, No. 5, May 2009.

[9] G. Escobar, A. J. van der Schaft and R. Ortega. A Hamiltonian viewpoint in the modeling ofswitching power converters. Automatica 35, 445-452, 1999.

[10] D. Jeltsema, J. M.A. Scherpen. A dual relation between port-Hamiltonian systems and theBrayton-Moser equations for nonlinear switched RLC circuits. Automatica 39, pp 969-979,2003.

[11] W. Jiuhe, X. Peirong and Z. Jinlong. Control Strategy of Three-Phase AC/DC Voltage-SourceConverters Based on Storage function. IEEE 978-0-7695-3342-1/08, 2008.

[12] M. Karlsson, T. Holmberg, A. Hultgren and M. Lenells .A Structural Modeling Flow forSwitched Electrical Networks. Proceedings of Power Forum 2009, DPF’09, Santa Ana, CA,USA, 2009.

[13] A. Hultgren. Modeling General Electrical Diode Networks with Graph Theory. 43rd IEEEConference on Decision and Control, 0-7803-8683-3, pp 4806-4811, 2004.

[14] H. Cormerais, J. Buisson, P.Y. Richard, C. Morvan. Modeling and Passivity Based Control ofswitched systems from bond graph formalism: Application to multicellular converters. Journalof the Franklin Institute 345, pp 468-488, (2008).

[15] Y. Li and Z. Ji. An Approach on T-S Fuzzy Model and Control of Buck-boost Converter.IEEE, 978-1-4244-2114-5, 2008.

[16] M. B. Poodeh, S. Eshtehardiha, A. Kiyoumarsi and M. Ataei. Optimizing LQR and Poleplacement to Control Buck Converter by Genetic Algorithm. ICROS 978-89-950038-6-2-98560, 2007.

47

[17] F. H. Hsieh, N. Z. Yen and Y. T. Juang. Optimal Controller of a Buck DC/DC ConverterUsing the Uncertain Load as Stochastic Noise. IEEE Transactions On Circuits And SystemsII: Express Briefs, Vol. 52, No. 2, Feb 2005.

[18] C. Kang, Z. Su and Q. Li. Modeling and Simulation of Aircraft Movement Based onMatlab/S-Function. IEEE, 978-0-7695-3357-5/08, 2008.

[19] T. Glad and L. Ljung. Control Theory-Multi variable and Nonlinear Methods. Taylor &Francis, 2000.

48