# LPV Approximation of a Boost Converter Model

This example shows how you can obtain a Linear Parameter Varying (LPV) approximation of a Simscape Power Systems™ model of a Boost Converter. The LPV representation allows quick analysis of average behavior at various operating conditions.

## Contents

## Boost Converter Model

A Boost Converter circuit converts a DC voltage to another DC voltage by controlled chopping or switching of the source voltage. The request for a certain load voltage is translated into a corresponding requirement for the transistor duty cycle. The duty cycle modulation is typically several orders of magnitude slower than the switching frequency. The net effect is attainment of an average voltage with relatively small ripples. See Figure 1 for a zoomed-in view of this dynamics.

**Figure 1:** Converter output (load) voltage generation

In practice there are also disturbances in the source voltage and the resistive load affecting the actual load voltage .

Open the Simulink model.

```
mdl = 'BoostConverterExampleModel';
open_system(mdl);
```

**Figure 2:** Simscape Power Systems based Boost Converter model

The circuit in the model is characterized by high frequency switching. The model uses a sample time of 25 ns. The "Boost Converter" block used in the model is a variant subsystem that implements 3 different versions of the converter dynamics. Double click on the block to view these variants and their implementations. The model takes the duty cycle value as its only input and produces three outputs - the inductor current, the load current and the load voltage.

The model simulates slowly (when looking for changes in say 0 - 10 ms) owing to the high frequency switching elements and small sample time.

## Batch Trimming and Linearization

In many applications, the average voltage delivered in response to a certain duty cycle profile is of interest. Such behavior is studied at time scales several decades larger than the fundamental sample time of the circuit. These "average models" for the circuit are derived by analytical considerations based on averaging of power dynamics over certain time periods. The model `BoostConverterExampleModel` implements such an average model of the circuit as its first variant, called "AVG Voltage Model". This variant typically executes faster than the "Low Level Model" variant.

The average model is not a linear system. It shows nonlinear dependence on the duty cycle and the load variations. To aid faster simulation and voltage stabilizing controller design, we can linearize the model at various duty cycle and load values. The inputs and outputs of the linear system would be the same as those of the original model.

We use the snapshot time based trimming and linearization approach. The scheduling parameters are the duty cycle value (d) and the resistive load value (R). The model is trimmed at various values of the scheduling parameters resulting in a grid of linear models. For this example, we chose a span of 10%-60% for the duty cycle variation and of 4-15 Ohms for the load variation. 5 values in these ranges are picked for each scheduling variable and linearization obtained at all possible combinations of their values.

Scheduling parameters: d: duty cycle R: resistive load

nD = 5; nR = 5; dspace = linspace(0.1,0.6,nD); % nD values of "d" in 10%-60% range Rspace = linspace(4,15,nR); % nR values of "R" in 4-15 Ohms range [dgrid,Rgrid] = ndgrid(dspace,Rspace); % all possible combinations of "d" and "R" values

Create a parameter structure array.

params(1).Name = 'd'; params(1).Value = dgrid; params(2).Name = 'R'; params(2).Value = Rgrid;

A simulation of the model under various conditions shows that the model's outputs settle down to their steady state values before 0.01 s. Hence we use t = 0.01s as the snapshot time.

Declare number of model inputs, outputs and states.

ny = 3; nu = 1; nx = 7; ArraySize = size(dgrid);

Compute equilibrium operating points using `findop`. The code takes several minutes to finish.

op = findop(mdl, 0.01, params);

Get linearization input-output specified in the model.

io = getlinio(mdl);

Linearize the model at the operating point array `op` and store the offsets.

[linsys, ~, info] = linearize(mdl, op, io, params, ... linearizeOptions('StoreOffsets', true));

Extract offsets from the linearization results.

offsets = getOffsetsForLPV(info); yoff = offsets.y; xoff = offsets.x; uoff = offsets.u;

Plot the linear system array.

```
bodemag(linsys)
grid on
```

**Figure 3:** Bode plot of linear system array obtained over the scheduling parameter grid.

## LPV Simulation: Preliminary Analysis

`linsys` is an array of 25 linear state-space models, each containing 1 input, 3 outputs and 7 states. The models are discrete-time with sample time of 25 ns. The bode plot shows significant variation in dynamics over the grid of scheduling parameters. The linear system array and the accompanying offset data (`uoff`, `yoff` and `xoff`) can be used to configure the LPV system block. The "LPV model" thus obtained serves as a linear system array approximation of the average dynamics. The LPV block configuration is available in the `BoostConverterLPVModel_Prelim` model.

```
lpvmdl = 'BoostConverterLPVModel_Prelim';
open_system(lpvmdl);
```

**Figure 4:** LPV model configured using linsys.

For simulating the model, we use an input profile for duty cycle that roughly covers its scheduling range. We also vary the resistive load to simulate the case of load disturbances.

Generate simulation data.

t = linspace(0,.05,1e3)'; din = 0.25*sin(2*pi*t*100)+0.25; din(500:end) = din(500:end)+.1; % the duty cycle profile rin = linspace(4,12,length(t))'; rin(500:end) = rin(500:end)+3; rin(100:200) = 6.6; % the load profile yyaxis left plot(t,din) xlabel('Time (s)') ylabel('Duty Cycle') yyaxis right plot(t,rin) ylabel('Resistive Load (Ohm)') title('Scheduling Parameter Profiles for Simulation')

**Figure 5:** Scheduling parameter profiles chosen for simulation.

*Note: the code for generating the above signals has been added to the model's PreLoadFcn callback for independent loading and execution. If you want to override these settings and try your own, overwrite this data in base workspace.*

Simulate the LPV model.

sim(lpvmdl, 'StopTime', '0.004');

**Figure 6:** LPV simulation results.

Simulation shows that the LPV model is slow to simulate. So next we consider some simplifications of the LPV model. The simplifications commonly applied to linear systems involve reducing the number of states (see `balred`), modifying the sample time (see `d2d`) and removing unwanted input or output channels. In order to extend this type of analysis to LPV systems, we make the following approximation: if the scheduling parameters are assumed to be changing slowly and the system always stays close to equilibrium conditions, we can replace the model's state variables with "deviation states" . With this approximation, the state offset data and initial state value can be replaced by zero values. The resulting system of equations are linear in deviation states .

## Model Order Reduction

Let us evaluate the contribution of the linear system states to the system energy across the array.

HSV = zeros(nx,nD*nR); for ct = 1:nD*nR HSV(:,ct) = hsvd(linsys(:,:,ct)); end ax = gca; cla(ax,'reset'); bar3(ax, HSV) view(ax,[-69.5 16]); xlabel(ax, 'System Number') ylabel(ax, 'State Number') zlabel(ax, 'State Energy')

**Figure 7:** Bar chart of Hankel Singular Values of the linear system array linsys. The 5-by-5 array has been flattened into a 25 element system vector for plotting.

The plot shows that only 2 states are required to capture the most significant dynamics. We use this information to reduce the 7-state system array `linsys` to a 2-state array using `balred`. Here we assume that the same two transformed states contribute across the whole operating grid. Note that the LPV representation requires state-consistency across the linear system array.

opt = balredOptions('StateElimMethod','Truncate'); linsys2 = linsys; for ct = 1:nD*nR linsys2(:,:,ct) = balred(linsys(:,:,ct),2,opt); end

## Upsampling the Model Array to Desired Time Scale

Next we note that the model array `linsys` (or `linsys2`) has a sample time of 25ns. We need the model to study the changes in outputs in response to duty cycle and load variations. These variations are much slower than the system's fundamental sample time and occur in the microsecond scale (0 - 50 ms). Hence we increase the model sample time by a factor of 1e4.

linsys3 = d2d(linsys2, linsys2.Ts*1e4);

We are now ready to make another attempt at LPV model assembly using the linear system array `linsys3` and offsets `yoff`, and `uoff`.

## LPV Simulation: Final

The preconfigured model `BoostConverterLPVModel_Final` uses `linsys3` and the accompanying offset data to simulate the LPV model. It uses zero values for the state offset.

```
lpvmdl = 'BoostConverterLPVModel_Final';
open_system(lpvmdl);
sim(lpvmdl);
```

**Figure 8:** LPV model simulation using the reduced/scaled linear system array linsys3.

The LPV model simulates significantly faster than the original model `BoostConverterExampleModel`. But how do the results compare against those obtained from the original boost converter model? To check this, open model `BoostConverterResponseComparison`. This model has Boost Converter block configured to use the high-fidelity "Low Level Model" variant. It also contains the LPV block whose outputs are superimposed over the outputs of the boost converter in the three scopes.

mdl = 'BoostConverterResponseComparison'; open_system(mdl); % sim(mdl); % uncomment to run

**Figure 9:** Model used for comparing the response of high fidelity model with the LPV approximation of its average behavior.

The simulation command has been commented out; uncomment it to run. The results are shown in the scope snapshots inserted below.

**Figure 10:** Inductor current signals. Blue: original, Magenta: LPV system response

**Figure 11:** Load current signals. Blue: original, Magenta: LPV system response

**Figure 12:** Load voltage signal. Blue: original, Magenta: LPV system response

The simulation runs quite slowly due to the fast switching dynamics in the original boost converter circuit. The results show that the LPV model is able to capture the average behavior nicely.

## Conclusions

By using the duty cycle input and the resistive load as scheduling parameters, we were able to obtain linear approximations of average model behavior in the form of a state-space model array. This model array was further simplified by model reduction and sample rate conversion operations.

The resulting model array together with operating point related offset data was used to create an LPV approximation of the nonlinear average behavior. Simulation studies show that the LPV model is able to emulate the average behavior of a high-fidelity Simscape Power Systems model with good accuracy. The LPV model also consumes less memory and simulates significantly faster than the original system.