# Model reduction

## Overview

LPVcore contains implementations of several model reduction methods for different system representation objects. All methods may be divided into three categories:

- State reduction: the state dimension is reduced while keeping the scheduling signal dimension the same.
- Scheduling reduction: the scheduling signal dimension is reduced while keeping the state dimension the same.
- $\Delta$-block reduction (for
`LPVcore.lpvlfr`

models only): the size of the $\Delta$-block is reduced while keeping the state and scheduling signal dimensions the same.

Note that methods for joint reduction of state and scheduling (and $\Delta$-block for `LPVcore.lpvlfr`

models) are not yet available in LPVcore.
However, by iterating the 3 reduction types, a joint reduction method could be implemented easily.
Joint reduction algorithms will also be included in LPVcore in a future release.

The model reduction approaches differ in several aspects, such as scalability, accuracy and the unerlying mathematical principles. In this section, we briefly introduce and compare the methods. Between brackets we indicate the LPV model structures that are compatible with each method. We also provide an overview of the relevant scientific literature for more details.

## State reduction

### Balanced reduction (`LPVcore.lpvlfr`

)

Recall from Core concepts that an LPV-LFR system involves the interconnection of a scheduling-dependent (but static) $\Delta$ block and an LTI system $G$.
Hence, any standard LTI model reduction method could be applied to $G$ to achieve reduction of the state order.
Balanced reduction of $G$ is available by invoking the `lpvmodred`

function and specifying the `'ltibalred'`

method.
In the following example, we create a simple `LPVcore.lpvlfr`

object with `nx=10`

states in $G$.
We then call `lpvmodred`

with the specified reduction order `rx=2`

and the method argument.
Note that the third argument of `lpvmodred`

, which indicates the desired scheduling signal size, should be left empty because this method does not perform reduction of the scheduling signal.

`nx = 10;`

rx = 2;

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

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

G = drss(nx, 4, 4);

sys = LPVcore.lpvlfr(Delta, G);

sysr = lpvmodred(sys, rx, [], 'ltibalred')

### Moment matching (`LPVcore.lpvss`

)

The moment matching technique available in LPVcore is applicable to discrete-time `LPVcore.lpvss`

models.
Reduction by moment matching leads to reduced-order models that are guaranteed to match the output of the original model (given the same input and scheduling sequence) up to a certain matching window size.
The window size is derived by a user-selected integer `N`

.
Then, depending on the exact options configured when invoking the function, the matching window size for which a match is guaranteed is either `N`

or `2N`

.

The bigger the window size, the less state reduction is possible. In general, it is not possible to know in advance how much state reduction is achieved for a given matching window size. However, sometimes you have a maximum state order and want to find the biggest matching window for which the reduced-order model does not exceed this state order. To accommodate this scenario too, LPVcore provides 2 interfaces to the moment matching functionality:

- Invocation of
`lpvmmred`

using the integer`N`

. You directly specify the matching window size but cannot control the state order. - Invocation of
`lpvmodred`

using the method`'momentmatching'`

. You directly specify the maximum state order and the function iteratively searches the maximum matching window size such that the state order respects the maximum.

## Scheduling reduction

Applying scheduling reduction techniques from LPVcore to an LPV system object reduced model complexity in 2 aspects

- The dimension of the scheduling signal is reduced.
- The scheduling-dependence becomes affine, even if the full-order model has non-affine dependence or unknown dependence (such as when passing an
`LPVcore.lpvgridss`

object).

The second aspect is possible because the scheduling signal of the reduced model can be a non-linear mapping of the scheduling signal of the full model.

The scheduling reduction techniques in LPVcore are data-driven approaches. Hence, the accuracy of the scheduling reduction will depend on how representative the dataset is that was used for the reduction.

### PCA-based reduction (`LPVcore.lpvlfr`

)

The function `lpvpcared`

discovers a suitable lower-dimensional scheduling signal using Principal Component Analysis (PCA).
You pass an `LPVcore.lpvlfr`

model `sys`

, the desired dimension of the reduced scheduling signal `nrho`

and the simulation data `data`

from which the principal components are determined:

`[sysr, mapping_fnc, info] = lpvpcared(sys, 1, data)`

The function returns the following 3 outputs:

`sysr`

: an`LPVcore.lpvlfr`

object with the reduced scheduling signal.`mapping_fnc`

: a mapping function that translates a given trajectory of the*original*scheduling signal to the corresponding trajectory of the*reduced*scheduling signal. Together with`sysr`

, this mapping is needed to simulate the reduced model.`info`

: additional information, such as the singular values related to the PCA. This can be used to check whether the desired scheduling signal dimension was appropriate.

The following code snippet shows how the output can be used to perform simulations using the reduced model.
First, the original scheduling signal trajectory `alpha`

is mapped to the reduced scheduling signal trajectory `beta`

using the `mapping_fnc`

output.
Then, the simulation of the original and reduced models is performed using `lsim`

and the scheduling signal trajectory.

`alpha = randn(N, 10)`

beta = mapping_fnc(alpha)

lsim(sys, alpha, ...)

lsim(sysr, beta, ...)

### DNN-based reduction (`LPVcore.lpvlfr`

and `LPVcore.lpvgridss`

)

The function `lpvdnnred`

is similar to `lpvpcared`

:

- Both functions reduce the dimension of the scheduling signal ánd return an
`LPVcore.lpvss`

object with affine dependence on the reduced scheduling signal. - Both functions return the reduced model
`sysr`

and the corresponding mapping function`mapping_fnc`

which is needed to convert original scheduling signal trajectories to reduced scheduling signal trajectories.

The main difference between the approaches it that, where `lpvpcared`

discovers the reduced scheduling signal using PCA, `lpvdnnred`

trains a Deep Neural Network (DNN) to serve as the mapping function.
Furthermore, the `lpvdnnred`

command has support for `LPVcore.lpvgridss`

objects.
Hence, it can also discover a global model from a set of local models.
The function is called similarly to `lpvpcared`

, with additional (optional) Name-Value pairs for controlling the architecture and training of the DNN:

`[sysr, mapping_fnc, info] = lpvdnnred(sys, nrho, data, ...)`

## $\Delta$-block reduction

LPVcore has 2 algorithms that reduce the size of the $\Delta$-block of an `LPVcore.lpvlfr`

representation.
Note that this automatically reduced the input-output dimensions of the corresponding LTI system $G$.
Both algorithms are available by calling the umbrella function `lpvmodred`

and passing the desired method.

### SVD-based reduction (`LPVcore.lpvss`

)

This algorithm, using the `deltasvdred`

as the method option of `lpvmodred`

, is only available for `LPVcore.lpvss`

models.
Internally, `LPVcore.lpvss`

models are special cases of `LPVcore.lpvlfr`

objects with `Dzw = 0`

.
For an `LPVcore.lpvss`

model, the state-space coefficients may be expressed as follows:

where $\phi_1, ..., \phi_N$ are the scheduling-dependent basis functions and $S_1, ..., S_N$ the matrix coefficients corresponding to the scheduling-dependent dynamics. $S_0$ is the matrix coefficient corresponding to the scheduling independent dynamics. As such, it does not contribute to the size of the $\Delta$-block. By default, the $\Delta$-block size corresponding to this form is $N(n_x + n_u)-by-N(n_x + n_y). However, this size can be reduced by embedding the LPV-SS dynamics into an approximate LPV-LFR form based on an SVD of each matrix coefficient:

with $S_{i,\mathrm{left}} \Sigma_i S_{i,\mathrm{right}}$ an SVD-decomposition of $S_i$. Truncation of the smallest singular values of the SVD form then leads to an approximation with a smaller $\Delta$-block size. When reducing the $\Delta$-block size from its original size to the requested size, the algorithm first calculates all singular values of each block $S_i$ and concatenates the results into a single vector of singular values. Based on this vector and the requested maximum $\Delta$-block size, a cut-off threshold is selected. Subsequently, another iteration over the blocks $S_1$, ..., $S_N$ is performed, truncating any singular values below the threshold.

A current limitation of the implementation is that it is possible that the size of the $\Delta$-block is smaller than
the requested size `rd`

if multiple $S_i$ blocks share the same singular values.

### Balancing reduction (`LPVcore.lpvlfr`

)

This algorithm, using the `deltabalred`

as the method option of `lpvmodred`

, is based on a heuristic method that interchanges the role of the state ($x$) and latent variables ($z$).
Balanced reduction is applied to this transformed system.
Disregarding the external inputs and outputs, the evolution of the state $x(t)$ can be described by the following system of algebraic-differential equations:

To reduce the size of the $\Delta$-block, we consider the alternate system obtained by disconnected the $\Delta$-block, disconnecting the state integrator, and connecting an integrator linking $w$ and $z$ as follows:

with $x_y$ and $x_u$ now exogeneous outputs and inputs, respectively, and the evolution of the latent variable $w$ considered the state. Note that this requires that the dimensions of $z$ and $w$ are equal. In other words: the $\Delta$-block must be square. Finally, balanced truncation is performed on the above alternate system to reduce the dimension of the new state $w$, i.e.:

with $T$ an $n_z$-by-$r_d$ matrix and the projection matrices $T_i$, $T$ such that $T_i T = I_{rd}$. The $\Delta$-block is projected according to this projection matrix: