# Core concepts

To facilitate the modeling of LPV systems, LPVcore introduces a set of fundamental classes:

- A
`timemap`

object to represent the*extended scheduling signal*. - A
`pbasis`

parent object to represent scalar*scheduling dependent basis functions*. - A
`pmatrix`

object to represent*scheduling dependent matrix functions*. - A
`lpvrep`

parent object to represent different types of*linear parameter-varying system representations*.

On this page, each class is treated in more detail.

`timemap`

: extended scheduling signal

LPV systems exhibit input-output dynamics that are linear, but whose relation is perturbed by an auxiliary time signal called the scheduling signal. The scheduling signal, denoted here by $p(t) \in \mathbb{P} \subset \mathbb{R}^{n_p}$, often represents a physical quantity $p$, such as position or temperature, as a function of time $t$. LPV systems can be formulated both in continuous-time (CT) and discrete-time (DT), in which case $t$ assumes values in $\mathbb{R}$ or $\mathbb{Z}$, respectively.

Sometimes, the LPV system also depends on derivatives (CT) or time-shifted (DT) versions of the scheduling signal, for example when both the position and velocity of a certain point are considered. Since the velocity is related to the position by differentation, the position can be seen as the scheduling signal, while the velocity can be seen as an *extension* of this scheduling signal. The position and velocity are together collected in the *extended scheduling signal*, denoted by $\rho$. The extended scheduling signal consists of the scheduling signal itself and all derivatives (CT) and time-shifted (DT) versions that are part of the parameter-varying dynamics.

For example, consider a DT extended scheduling signal that consists of the first $N$ forward- and backward-shifted version of $p$:

$\rho(t) := [ p(t)^{\mathrm{T}}, p(t-1)^{\mathrm{T}}, p(t+1)^{\mathrm{T}}, ..., p(t-N)^{\mathrm{T}}, p(t+N)^{\mathrm{T}} ]^{\mathrm{T}}$

As a CT example, consider an extended scheduling signal that consists of the derivatives of $p$ up to the $N^{\mathrm{th}}$ order:

$\rho(t) := [ p(t)^{\mathrm{T}}, \frac{\mathrm{d} p}{\mathrm{d} t}(t)^{\mathrm{T}}, ..., \frac{\mathrm{d}^N p}{\mathrm{d} t^N}(t)^{\mathrm{T}} ]^{\mathrm{T}}$

In LPVcore, an extended scheduling signal is represented using the `timemap`

object. It allows the user to specify the desired time domain and the derivatives (CT) and time shifts (DT) that make up the extended scheduling signal. Properties on the scalar components of the scheduling signal, such as names, bounds and rate bounds, are supported as well. The following code snippet creates a `timemap`

object representing the extended scheduling signal $\rho = [ a; b; \frac{\mathrm{d} a}{\mathrm{d} t}, \frac{\mathrm{d} b}{\mathrm{d} t}]$ (explicit time-dependence is dropped for notational convenience):

`rho = timemap([0, 1], 'ct', 'Name', {'a', 'b'})`

For more information on the `timemap`

object, type `doc timemap`

or consult the suggested examples:

`pbasis`

: basis functions

The parent class `pbasis`

represents the family of scheduling dependent basis functions available in LPVcore. A scheduling dependent basis function $\phi$ maps the value of the extended scheduling signal at a point in time to a real scalar, i.e.:

$\phi: \mathbb{R}^{N_{\rho}} \rightarrow \mathbb{R}$

Some examples of parameter-varying basis functions:

- $\phi(\rho(t)) = 1$
- $\phi(\rho(t)) = \rho_i(t)$, for $i = 1, ..., N_{\rho}$
- $\phi(\rho(t)) = \prod_{i=1}^{N_{\rho}} \rho_i(t)^{d_i}$, for some $\{ d_i \in \mathbb{Z} | i = 1, ..., N_{\rho} \}$.
- $\phi(\rho(t)) = \sin(2 \pi \rho_i(t))$, for $i = 1, ..., N_{\rho}$

The above examples are all supported by classes in LPVcore inheriting from `pbasis`

. The first example, the constant $1$, can be constructed from the `pbconst`

object. It takes no arguments:

`phi = pbconst % phi = 1`

The second example, the function $\rho_i(t)$, is constructed from the `pbaffine`

object.It takes one argument: the index of the extended scheduling signal that is selected, or the value $0$ for a constant. For example, the following code snippet constructs $\phi = \rho_1$:

`phi = pbaffine(1) % phi = rho_1`

`pbaffine`

is a parent class of `pbconst`

since it can be seen as a generalization. A further generalization is implemented in the `pbpoly`

class, which represents polynomial functions of the extended scheduling signal (the third example in the list above). It is parametrized using two inputs: a matrix, `degrees`

, representing the degrees of the polynomial, and a vector `coeff`

, representing the coefficient of each monomial. Each row in `degrees`

corresponds to a monomial. For example, the following code snippet constructs $\phi = \rho_1^2 + 2 \rho_2^2$:

`phi = pbpoly([2, 0; 0, 2], [1, 2]) % phi = rho_1^2 + 2 rho_2^2`

Lastly, custom scheduling dependent basis functions that cannot be expressed in polynomial form are supported with the `pbcustom`

object. To use it, create a function handle that has a single input argument named `rho`

. It is important that the argument is named `rho`

since `pbcustom`

relies on this naming convention. The expected format for `rho`

is that is a $N$-by-$N_{\rho}$ matrix, where $N$ is an arbitrary non-negative integer. Thus, the function handle should support vectorization. To ensure that the format is accepted, LPVcore verifies that each appearance of `rho`

in the function handle is in vectorized format, i.e., `rho(:, x)`

with `x`

the index of the extended scheduling signal. For example, the following code snippet constructs $\phi = \sin(2 \pi \rho_1) + \cos(2 \pi \rho_2)$:

`f = @(rho) sin(2 * pi * rho(:, 1)) + cos(2 * pi * rho(:, 2))`

phi = pbcustom(f)

`pmatrix`

: matrix function

Using the extended scheduling signal represented by the `timemap`

object, and a set of scheduling dependent basis functions represented by `pbasis`

objects, the next step is to assemble a scheduling dependent matrix function of the following form:

$A(\rho(t)) = \sum_{i=1}^{N} A_i \phi_i(\rho(t))$

where $A_i$ are standard MATLAB matrices, $\phi_i$ are the scheduling dependent basis functions, and $\rho$ is the extended scheduling signal.

There are several ways to construct such matrix functions. First, using the `pmatrix`

class. When instantiating an object of this class, 3 input arguments are required:

- The coefficients
`A_i`

. - The basis functions
`phi_i`

. - The extended scheduling signal
`rho`

.

For example, the following code snippet constructs the scheduling dependent matrix function $A(\rho(t)) = \rho_1(t) + 2 \rho_2(t)$, with $\rho = [a; b]$:

`Ai = cat(3, 1, 2)`

phii = { pbaffine(1), pbaffine(2) } % rho_1, rho_2

rho = timemap(0, 'ct', 'Name', {'a', 'b'}) % rho_1 --> a, rho_2 --> b

A = pmatrix(Ai, phii, 'SchedulingTimeMap', rho) % a + 2b

As a simpler alternative to `pmatrix`

, the `preal`

function is available. This function constructs a `pmatrix`

object representing a scalar extended scheduling signal with a specified name, time domain, derivative (CT) or time shift (DT), and other properties. For example, the following code snippet constructs a scheduling dependent matrix function $A(t) = q(t-1)$, with scheduling signal $q$ and extended scheduling signal $\rho(t) = q(t-1)$:

`A = preal('q', 'dt', 'Dynamic', -1)`

The resulting `pmatrix`

object can then be combined with other `pmatrix`

objects to form more complicated expressions. Many MATLAB operations on regular matrices have been extended to the `pmatrix`

class. For example, addition, matrix multiplication, element-wise multiplication, and more. For a complete overview, see the Reference section, type `doc pmatrix`

, or consult the suggested examples:

`lpvrep`

: LPV system representations

LPVcore supports the following system representations:

`lpvio`

: input-output representation

In this section, an LPV system representation relating an input signal $u$ and an output signal $y$ is presented. The dependence between these two signals is given as follows:

where $A, B$ are polynomials in $\xi$ with coefficients that depend on the extended scheduling signal $\rho$. $\xi$ is the backward time-shift operator $q^{-1}$ (DT) or the differentiation operator $\frac{\mathrm{d}}{\mathrm{d}t}$ (CT). $A$ is a monic polynomial, i.e., the constant term is the non-scheduling dependent identity matrix $I$. The following example denotes a DT SISO system where $A$ and $B$ both have 2 terms:

To construct such a representation in LPVcore, the `lpvio`

class is used. The polynomials $A$ and $B$ are formatted as cell arrays, with each element of the cell array containing a `pmatrix`

object corresponding to a term of the polynomial. For example, the following code snippet constructs the LPV-IO system representation of the example above, with a sampling time of 1 second:

`Ts = 1; % seconds`

rho = preal('rho', 'dt');

A = {1, rho};

B = {rho^2, 1 - rho};

sys = lpvio(A, B, Ts)

`lpvss`

: state-space representation

In this section, the LPV-SS representation is introduced, where the state-space matrices are scheduling dependent, i.e.:

with $A, B, C, D$ scheduling dependent matrix functions and $\xi$ the backward time-shift operator $q^{-1}$ (DT) or the differentiation operator $\frac{\mathrm{d}}{\mathrm{d}t}$ (CT). In LPVcore, the `lpvss`

class is used to create such a representation. For example, the following code snippet constructs a CT LPV-SS system representation:

`rho = preal('rho', 'ct');`

A = -1 + rho;

B = 1;

C = 1 + rho + rho^2;

D = 0;

sys = lpvss(A, B, C, D);

As can be seen, each state-space matrix can have a different dependence on the scheduling signal.

Control synthesis algorithms typically require a state-space model (`lpvss`

object). To convert an input-output model (`lpvio`

object) to state-space form, use the `lpvioreal`

function.

`lpvlfr`

: linear-fractional representation

Another LPV system representation involves the linear-fractional representatin (LFR). Such an LPV-LFR system can be seen as the interconnection between an LTI system, $G$, and a scheduling dependent matrix function, $\Delta(\rho)$, in the following manner:

The LPVcore class `lpvlfr`

is used to construct a representation of an LPV-LFR system. The following code snippet gives an example with 1 input $u$, 1 output $y$, and 3 components in both interconnection signals $w$ and $z$.

`rho = preal('rho', 'dt');`

Delta = blkdiag(rho, eye(2) * rho^2);

G = drss(10, 4, 4);

sys = lpvlfr(Delta, G);