Using LTV and LPV Models in MATLAB and Simulink
The following table illustrates the types of varying models that you can represent:
|Model Type||Mathematical Representation||Model Object|
|Continuous-time LPV model||
|Discrete-time LPV model||
|Continuous-time LTV model||
|Discrete-time LTV model||
lpvss objects require you to
specify a user-defined MATLAB® function for calculating matrices and offsets. This is called the
data function and must be of the following form.
|Model Type||Data Function|
To understand the anatomy of a data function, consider
dataFcnMaglev.m which is provided with the LPV Model of Magnetic Levitation System
function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = dataFcnMaglev(~,p) % MAGLEV example: % x = [h ; dh/dt] % p=hbar (equilibrium height) mb = 0.02; % kg g = 9.81; alpha = 2.4832e-5; A = [0 1;2*g/p 0]; B = [0 ; -2*sqrt(g*alpha/mb)/p]; C = [1 0]; % h D = 0; E = ; dx0 = ; x0 = [p;0]; u0 = sqrt(mb*g/alpha)*p; % ibar y0 = p; % y = h = hbar + (h-hbar) Delays = ;
This data function performs the following tasks:
Specifies the inputs of the data function.
A data function must have time and parameter values as inputs. If your parameters do not explicitly depend on time, you can omit the time input as shown in
dataFcnMaglev.m. In discrete time, the time input k is the integer index that counts the number of sampling periods Ts , where the absolute time is given by t = kTs. And, p is the parameter value at the time t or sample k, that is, p(t) or p[k].
You can specify additional inputs to the data function by using anonymous functions. For more information , see Anonymous Functions. This helps reduce code redundancy and computation cost. For example, if you wrote a function that also requires parameters
optionsstructure, you can write the data function as follows.
DF = @(t,p) myFunction(t,p(1),..,p(n),m,n,options)
Defines the matrices and offsets.
The time or parameter matrices and offsets of the LTV or LPV models. You typically obtain these from linearizing nonlinear models around operating conditions.
Specifies the values of matrices and offsets as outputs of the data function.
The data function must return valid values for the outputs
Delays. You can set all output arguments except
when absent for (
Set Delays to
. In future releases, this argument will allow you to specify model delays.
Gridded LPV Models
A common way of representing LPV models is as an interpolated array of linear state-space models. A certain number of points in the scheduling space are selected. An LTI system is assigned to each point, representing the dynamics in the local vicinity of that point. You obtain the dynamics at scheduling locations in between the grid points by interpolating LTI systems at neighboring points. For meaningful interpolations of system matrices, all the local models must use the same state basis.
This form is called the grid-based LPV representation. For more information, see Gridded Models and Choice of Sampling Grid.
Sampling and Interpolation
sample to sample the LTV or LPV dynamics over a grid of
t or (t,p) values
(k or (k,p) in discrete
time). This gives the local linear (affine) dynamics for a given time or parameter
value. The result consists of an array of
ss objects and a
struct array of offsets.
ssInterpolant takes an
ss array and a
struct array of offsets and creates an LTV or LPV model that
interpolates these values between grid points (the grid is defined by the
SamplingGrid property of the
ss array). The
resulting model is called a gridded LTV or LPV model.
All standard signal-based connections listed under Model Interconnection are supported for LTV and LPV models. These operations automatically manage offsets and do not involve any approximation. Interconnecting models using signals allow you to construct models for control systems. You can conceptualize your control system as a block diagram containing multiple interconnected components, such as a plant and a controller connected in a feedback configuration. For instance, you can build and LPV model of a plant, design a gain-scheduled controller on a t or (t,p) grid, and simulate the closed-loop control system. See Analysis of Gain-Scheduled PI Controller and Control Design for Spinning Disks for examples.
ltvssmodels yields an
lpvssmodels yields an
lpvssmodel, depending on the union of parameters.
ltvssmodel and an
lpvssmodel yields an
Combining an LTI model with an
lpvssmodel yields an
Before you combine models with shared parameters that each use a different test
p0 for validation, you must first reconcile these values
p0 = 0, the interconnection
functions ignore the test values.
If each model has different parameters, the combined model depends on the union of the parameters.
Continuous and Discrete Conversions
lpvssmodels, the software only supports conversion using the
For gridded LTV and LPV models (see
ssInterpolant), the functions convert or resample the LTI model at each grid point and interpolate the resulting data. The software only supports conversion for gridded models using
Time Response Simulation
The time-response functions such as
initial support LTV and LPV model
simulation along with LTI models for easy comparison. You must specify an
equisampled time vector to set the integration step size of the fixed-step LTV and
LPV solvers. There are two key differences with LTI simulation:
For LPV models, you must specify an additional input/output
pdepending on the syntax. As input, you can specify the parameter trajectory p(t) as a vector or matrix or implicitly as a function p = h(t,x,u). As output, p is the actual parameter trajectory.
Input offsets and initial conditions matter for LTV and LPV model. You can use the
RespConfigobject to manage these settings. The software now supports the input offsets and initial states for LTI models for uniformity. This allows for side-by-side comparisons with LTV and LPV models. You must specify correct model offsets along with proper initial conditions for accurate time-response simulation.
Gain-Scheduled Controller Design
You can use functions such as
systune to tune gain-scheduled
controllers. A gain-scheduled controller is an LPV model parameterized by the
scheduling variables. For examples that implement a gain-scheduled controller as an
analytic LPV model, see Gain-Scheduled LQG Controller and Analysis of Gain-Scheduled PI Controller. For examples
that implement a gain-scheduled controller as a gridded LPV model, see LPV Model of Magnetic Levitation Model from Batch Linearization Results, Control Design for Wind Turbine, and Design and Validate Gain-Scheduled Controller for Nonlinear Aircraft Pitch Dynamics.
LPV System Block
You can use the LPV System block to represent and simulate gridded LPV models in Simulink®. You can use this block to represent an array of state-space models and its associated offsets as an LPV model. For an example, see Using LTI Arrays for Simulating Multi-Mode Dynamics.
You can also use this block to implement a controller designed on a grid of trim points, and then test the closed-loop response of the controller with the nonlinear Simulink model. For examples, see LPV Model of Magnetic Levitation Model from Batch Linearization Results and Design and Validate Gain-Scheduled Controller for Nonlinear Aircraft Pitch Dynamics.
Other Supported Functionality
Additionally, the following functionality is currently supported.
sminrealto eliminate structurally nonminimal states. This is only possible in gridded models and when it is done in a uniform way across models in the grid.
xpermto reorder the states.
orderto find the number of states.
Applications of Linear Parameter-Varying Models
Modeling Multimode Dynamics
You can use LPV models to represent systems that exhibit multiple modes (regimes) of operation. Examples of such systems include colliding bodies, systems controlled by operator switches, and approximations of systems affected by dry friction and hysteresis effects. For an example, see LPV Model of Bouncing Ball.
Proxy Modeling for Faster Simulations
This approach is useful for generating surrogate models that you can use in place of the original system, which enable faster simulations as well as hardware-in-loop (HIL) simulations and reduce the memory footprint of target hardware code. You can also use surrogate models of this type for designing gain-scheduled controllers and for initializing parameter estimation tasks in Simulink. For an example of approximating a general nonlinear system behavior by an LPV model, see Design and Validate Gain-Scheduled Controller for Nonlinear Aircraft Pitch Dynamics.
LPV models can help speed up the simulation of physical component based systems, such as those built using Simscape™ Multibody™ and Simscape Electrical™ Power Systems software. For an example of this approach, see LPV Approximation of Boost Converter Model.