# LPV System

Simulate Linear Parameter-Varying (LPV) systems

## Description

Represent and simulate Linear Parameter-Varying (LPV) systems in Simulink^{®}. The block also supports code generation.

A *linear parameter-varying* (LPV) system
is a linear state-space model whose dynamics vary as a function of
certain time-varying parameters called *scheduling parameters*.
In MATLAB^{®}, an LPV model is represented in a state-space form
using coefficients that are parameter dependent.

Mathematically, an LPV system is represented as:

$\begin{array}{l}dx\left(t\right)=A\left(p\right)x\left(t\right)+B\left(p\right)u\left(t\right)\\ y\left(t\right)=C\left(p\right)x\left(t\right)+D\left(p\right)u\left(t\right)\\ x\left(0\right)={x}_{0}\end{array}$ | (1) |

where

`u(t)`

are the inputs`y(t)`

the outputs`x(t)`

are the model states with initial value`x0`

$dx\left(t\right)$ is the state derivative vector $\dot{x}$ for continuous-time systems and the state update vector $x\left(t+\Delta T\right)$ for discrete-time systems. Δ

*T*is the sample time.`A(p)`

,`B(p)`

,`C(p)`

and`D(p)`

are the state-space matrices parameterized by the scheduling parameter vector`p`

.The parameters

`p = p(t)`

are measurable functions of the inputs and the states of the model. They can be a scalar quantity or a vector of several parameters. The set of scheduling parameters define the*scheduling space*over which the LPV model is defined.

The block implements a grid-based representation of the LPV system. You pick a grid of
values for the scheduling parameters. At each value `p = p*`

, you specify
the corresponding linear system as a state-space (`ss`

or `idss`

(System Identification Toolbox)) model object. You use the generated
array of state-space models to configure the LPV System block.

The block accepts an array of state-space models with operating point information. The
information on the scheduling variables is extracted from the
`SamplingGrid`

property of the LTI array. The scheduling variables
define the grid of the LPV models. They are scalar-valued quantities that can be functions
of time, inputs and states, or constants. They are used to pick the local dynamics in the
operating space. The software interpolates the values of these variables. The block uses
this array with data interpolation and extrapolation techniques for simulation.

The LPV system representation can be extended to allow offsets
in `dx`

, `x`

, `u`

and `y`

variables.
This form is known as *affine form* of the LPV
model. Mathematically, the following represents an LPV system:

$\begin{array}{l}dx\left(t\right)=A\left(p\right)x\left(t\right)+B\left(p\right)u\left(t\right)+\left(\overline{dx}\left(p\right)-A\left(p\right)\overline{x}\left(p\right)-B(p)\overline{u}(p)\right)\\ y\left(t\right)=C\left(p\right)x\left(t\right)+D\left(p\right)u\left(t\right)+\left(\overline{y}\left(p\right)-C\left(p\right)\overline{x}\left(p\right)-D(p)\overline{u}(p)\right)\\ x\left(0\right)={x}_{0}\end{array}$ | (2) |

$\overline{dx}\left(p\right),\text{}\overline{x}\left(p\right),\text{}\overline{u}\left(p\right),\text{}\overline{y}\left(p\right)$ are
the offsets in the values of `dx(t)`

, `x(t)`

, `u(t)`

and `y(t)`

at
a given parameter value `p = p(t)`

.

To obtain such representations of the linear system array, linearize a Simulink model over a batch of operating points (see Batch Linearization (Simulink Control Design).) The offsets correspond to the operating points at which you linearized the model.

You can obtain the offsets by returning additional linearization
information when calling functions such as `linearize`

(Simulink Control Design) or `getIOTransfer`

(Simulink Control Design). You can then extract
the offsets using `getOffsetsForLPV`

(Simulink Control Design).
For an example, see LPV Approximation of Boost Converter Model (Simulink Control Design).

The following limitations apply to the LPV System block:

Internal delays cannot be extrapolated to be less than their minimum value in the state-space model array.

When using an irregular grid of linear models to define the LPV system, only the nearest neighbor interpolation scheme is used. This may reduce the accuracy of simulation results. It is recommended to work with regular grids. To learn more about regular and irregular grids, see Regular vs. Irregular Grids.

## Data Type Support

Single and double data. You must convert any other data type for input signals or model properties to these data types.

## Parameters

The LPV System Block Parameter dialog box contains five tabs for specifying the system data, scheduling algorithm and output ports. The following table summarizes the block parameters.

Task | Parameters |
---|---|

Specify an array of state-space models and initial states | In |

Specify operating point offsets | In |

Specify offsets in state derivative or update variable | In the |

Specify which model matrices are fixed and their nominal values to override
entries in model data. In some situations, you may want to replace a parameter-dependent matrix such as `A(p)` with a
fixed value `A*` for simulation. For example,
`A*` may represent an average value over the scheduling
range. | In the |

Specify options for interpolation and extrapolation | In the |

Specify additional outputs for the block | In the |

Specify code generation settings | In the |

### State-space array

An array of state-space (`ss`

or `idss`

(System Identification Toolbox)) models. All the models in the array must use the same definition of
states. Use the `SamplingGrid`

property of the state-space object to
specify scheduling parameters for the model. See the `ss`

or
`idss`

model reference page for more information on the
`SamplingGrid`

property.

When the block is in a model with synchronous state control (see the State Control (HDL Coder) block), you must specify an array of discrete-time models.

### Initial state

Initial conditions to use with the local model to start the simulation, specified one of the following:

0 (

**Default**)Double vector of length equal to the number of model states

### Input offset

Offsets in input `u(t)`

, specified as one of the following:

0 (

**Default**) — Use when there are no input offsets ($\overline{u}\left(p\right)=0\forall p$).Double vector of length equal to the number of inputs — Use when input offset is the same across the scheduling space.

Double array of size [

`nu`

1`sysArraySize`

] — Use when offsets are present and they vary across the scheduling space. Here,`nu`

= number of inputs,`sysArraySize`

= array size of state-space array. Use`size`

to determine the array size.

You can obtain offsets during linearization and convert them to the format supported
by the LPV System block. For more information, see Approximate Nonlinear Behavior Using Array of LTI Systems (Simulink Control Design) and `getOffsetsForLPV`

(Simulink Control Design).

### Output offset

Offsets in output `y(t)`

, specified as one of the following:

0 (

**Default**) — Use when there are no output offsets $\overline{y}\left(p\right)=0\forall p$.Double vector of length equal to the number of outputs. Use when output offsets are the same across the scheduling space.

Double array of size [

`ny`

1`sysArraySize`

]. Use when offsets are present and they vary across the scheduling space. Here,`ny`

= number of outputs,`sysArraySize`

= array size of state-space array. Use`size`

to determine the array size.

You can obtain offsets during linearization and convert them to the format supported
by the LPV System block. For more information, see Approximate Nonlinear Behavior Using Array of LTI Systems (Simulink Control Design) and `getOffsetsForLPV`

(Simulink Control Design).

### State offset

Offsets in states `x(t)`

, specified as one of the following:

0 (

**Default**) — Use when there are no state offsets $\overline{x}\left(p\right)=0\forall p$.Double vector of length equal to the number of states. Use when the state offsets are the same across the scheduling space.

Double array of size

`[nx 1 sysArraySize]`

, where`nx`

= number of states,`sysArraySize`

= array size of state-space array. Use when offsets are present and they vary across the scheduling space. Here,`nx`

= number of states,`sysArraySize`

= array size of state-space array. Use`size`

to determine the array size.

You can obtain offsets during linearization and convert them to the format supported
by the LPV System block. For more information, see Approximate Nonlinear Behavior Using Array of LTI Systems (Simulink Control Design) and `getOffsetsForLPV`

(Simulink Control Design).

### State derivative/update offset

Offsets in state derivative or update variable `dx(t)`

, specified as
one of the following:

If you obtained the linear system array by linearization under equilibrium conditions, select the

**Assume equilibrium operating conditions**option. This option corresponds to an offset of $\overline{dx}\left(p\right)=0$ for a continuous-time system and $\overline{dx}\left(p\right)=\overline{x}\left(p\right)$ for a discrete-time system. This option is selected by default.If the linear system contains at least one system that you obtained under non-equilibrium conditions, clear the

**Assume equilibrium operating conditions**option. Specify one of the following in the**Offset value**field:If the

`dx`

offset values are the same across the scheduling space, specify as a double vector of length equal to the number of states.If the

`dx`

offsets are present and they vary across the scheduling space, specify as a double array of size [`nx`

1`sysArraySize`

], where`nx`

= number of states, and`sysArraySize`

= array size of state-space array.

`getOffsetsForLPV`

(Simulink Control Design).

### Nominal Model

State-space model that provides the values of the fixed coefficients, specified as one of the following:

`Use the first model in state-space array`

(**Default:**) — The first model in the state-space array is used to represent the LPV model. In the following example, the state-space array is specified by object`sys`

and the fixed coefficients are taken from model`sys(:,:,1)`

.% Specify a 4-by-5 array of state-space models. sys = rss(4,2,3,4,5); a = 1:4; b = 10:10:50; [av,bv] = ndgrid(a,b); % Use "alpha" and "beta" variables as scheduling parameters. sys.SamplingGrid = struct('alpha',av,'beta',bv);

Fixed coefficients are taken from the model

`sysFixed = sys(:,:,1)`

, which corresponds to`[alpha=1, beta=10]`

. If the (2,1) entry of`A`

matrix is forced to be fixed, its value used during the simulation is`sysFixed.A(2,1)`

.`Custom value`

— Specify a different state-space model for fixed entries. Specify a variable for the fixed model in the**State space model**field. The fixed model must use the same state basis as the state-space array in the LPV model.

### Fixed Coefficient Indices

Specify which coefficients of the state-space matrices and delay vectors are fixed.

Specify one of the following:

Scalar Boolean (

`true`

or`false`

), if all entries of a matrix are to be treated the same way.The default value is

`false`

for the state-space matrices and delay vectors, which means that they are treated as free.Logical matrix of a size compatible with the size of the corresponding matrix:

State-space matrix

Size of fixed entry matrix

**A matrix**`nx`

-by-`nx`

**B matrix**`nx`

-by-`nu`

**C matrix**`ny`

-by-`nx`

**D matrix**`ny`

-by-`nu`

**Input delay**`nu`

-by-1**Output delay**`ny`

-by-1**Internal delay**`ni`

-by-1where,

`nu`

= number of inputs,`ny`

= number of outputs,`nx`

= number of states,`ni`

= length of internal delay vector.Numerical indices to specify the location of fixed entries. See

`sub2ind`

reference page for more information on how to generate numerical indices corresponding to a given subscript`(i,j)`

for an element of a matrix.

### Interpolation method

Interpolation method. Defines how the state-space data must be computed for scheduling parameter values that are located away from their grid locations.

Specify one of the following options:

`Flat`

— Choose the state-space data at the grid point closest, but not larger than, the current point. The*current point*is the value of the scheduling parameters at current time.`Nearest`

— Choose the state-space data at the closest grid point in the scheduling space.`Linear`

— Obtain state-space data by linear interpolation of the nearest 2d neighbors in the scheduling space, where d = number of scheduling parameters.

The default interpolation scheme is `Linear`

for regular
grids of scheduling parameter values. For irregular grids, the
`Nearest`

interpolation scheme is always used regardless of
the choice made. to learn more about regular and irregular grids, see Regular vs. Irregular Grids.

The `Linear`

method provides the highest accuracy but takes
longer to compute. The `Flat`

and
`Nearest`

methods are good for models that have
mode-switching dynamics.

### Extrapolation method

Extrapolation method. Defines how to compute the state-space data for scheduling
parameter values that fall outside the range over which the state-space array has been
provided (as specified in the `SamplingGrid`

property).

Specify one of the following options:

`Clip`

(**Default:**) — Disables extrapolation and returns the data corresponding to the last available scheduling grid point that is closest to the current point.`Linear`

— Fits a line between the first or last pair of values for each scheduling parameter, depending upon whether the current value is less than the first or greater than the last grid point value, respectively. This method returns the point on that line corresponding to the current value. Linear extrapolation requires that the interpolation scheme be linear too.

### Index search method

The location of the current scheduling parameter values in the scheduling space is
determined by a prelookup algorithm. Select ```
Linear
search
```

or `Binary search`

. Each search
method has speed advantages in different situations. For more information on this
parameter, see the Prelookup (Simulink) block reference page.

### Begin index search using previous index result

Select this check box when you want the block to start its search using the index found at the previous time step. For more information on this parameter, see the Prelookup (Simulink) block reference page.

### Output states

Add `x`

port to the block to output state values. This option is
selected by default.

### Output state derivatives (continuous-time) or updates (discrete-time)

Add `dx`

port to the block to output state derivative values or
update the values. This option is selected by default.

### Output interpolated state-space data

Add `ss`

port to the block to output state-space data as a
structure. This option is selected by default.

The fields of the generated structure are:

State-space matrices

`A`

,`B`

,`C`

,`D`

.Delays

`InputDelay`

,`OutputDelay`

, and`InternalDelay`

. The`InternalDelay`

field is available only when the model has internal delay.

### Output interpolated offsets

Add `offset`

port to the block to output LPV model offsets $$\left(\overline{u}\left(p\right),\overline{y}\left(p\right),\overline{x}\left(p\right),\overline{dx}\left(p\right)\right)$$.

The fields of the structure are:

`InputOffset`

,`OutputOffset`

,`StateOffset`

, and`StateDerivativeOffset`

in continuous-time.`InputOffset`

,`OutputOffset`

,`StateOffset`

, and`StateUpdateOffset`

in discrete-time.

### Block data type (discrete-time case only)

Supported data type. Use this option only for discrete-time state-space models.
Specify `double`

or `single`

.

### Initial buffer size for delays

Initial memory allocation for the number of input points to store for models that contain delays. If the number of input points exceeds the initial buffer size, the block allocates additional memory. The default size is 1024.

When you run the model in Accelerator mode or build the model, make sure the initial buffer size is large enough to handle maximum anticipated delay in the model.

### Use fixed buffer size

Specify whether to use a fixed buffer size to save delayed input and output data from previous time steps. Use this option for continuous-time LPV systems that contain input or output delays. If the buffer is full, new data replaces data already in the buffer. The software uses linear extrapolation to estimate output values that are not in the buffer.

## Examples

### Configure the Scheduling Parameter Input Port

Consider a 2-input, 3-output, 4-state LPV model. Use input `u(2)`

and state `x(1)`

as scheduling parameters. Configure the Simulink model as shown in the following figure.

### Simulate a Linear Parameter-Varying System

Consider a linear mass-spring-damper system whose mass changes as a function of an external load command. The governing equation is:

$m\left(u\right)\ddot{y}+c\dot{y}+k\left(y\right)y=F(t)$

where `m(u)`

is the mass dependent upon the external command
`u`

, `c`

is the damping ratio, `k`

is the stiffness of the spring and `F(t)`

is the forcing input.
`y(t)`

is position of the mass at a given time `t`

.
For a fixed value of `u`

, the system is linear and expressed as:

$\begin{array}{l}A=\left[\begin{array}{cc}0& 1\\ -\frac{k}{m}& -\frac{c}{m}\end{array}\right],B=\left[\begin{array}{c}0\\ \frac{1}{m}\end{array}\right],C=\left[\begin{array}{cc}1& 0\end{array}\right]\\ \dot{x}=Ax+Bu,y=Cx\end{array}$

where $x=\left[\begin{array}{c}y\\ \dot{y}\end{array}\right]$ is the state vector and `m`

is the value of the mass
for a given value of `u`

.

In this example, you want to study the model behavior over a range of input values
from 1 to 10 Volts. For each value of `u`

, measure the mass and compute
the linear representation of the system. Suppose, mass is related to the input by the
relationship: $$m(u)=10u+0.1{u}^{2}$$. For values of `u`

ranging from 1:10 results in the
following array of linear systems.

% Specify damping coefficient. c = 5; % Specify stiffness. k = 300; % Specify load command. u = 1:10; % Specify mass. m = 10*u + 0.1*u.^2; % Compute linear system at a given mass value. for i = 1:length(u) A = [0 1; -k/m(i), -c/m(i)]; B = [0; 1/m(i)]; C = [1 0]; sys(:,:,i) = ss(A,B,C,0); end

The variable `u`

is the scheduling input. Add this information to
the model.

`sys.SamplingGrid = struct('LoadCommand',u);`

Configure the LPV System block:

Type

`sys`

in the**State-space array**field.Connect the input port

`par`

to a one-dimensional source signal that generates the values of the load command. If the source provides values between 1 and 10, interpolation is used to compute the linear model at a given time instance. Otherwise, extrapolation is used.

## Ports

Port Name | Port Type (In/Out) | Description |
---|---|---|

u | In | Input signal u(t) in Equation 2 described previously. In multi-input case, this port accepts a signal of the dimension of the input. |

par | In | Provides the signals for variables defining the scheduling space
(“sampling grid” variables). The scheduling variables can be
functions of time, inputs and states, or constants. The required dependence
can be achieved by preparing a scheduling signal using clock input (for
time), input signal ( |

y | Out | Model output |

x | Out | Values of the model states |

xdot | Out | Values of the state derivatives. The state derivatives are sometimes used to define the scheduling parameters. |

ss | Out | Local state-space model at the major simulation time steps |

offset | Out | LPV model offsets |

## Extended Capabilities

## See Also

`getOffsetsForLPV`

(Simulink Control Design)

### Topics

- Linear Parameter-Varying Models
- Using LTI Arrays for Simulating Multi-Mode Dynamics
- Approximate Nonlinear Behavior Using Array of LTI Systems (Simulink Control Design)
- LPV Approximation of Boost Converter Model (Simulink Control Design)

**Introduced in R2014b**