Products & Services Industries Academia Support User Community Company

MPC Controller Object

All the parameters defining the MPC control law (prediction horizon, weights, constraints, etc.) are stored in an MPC object, whose properties are listed in Table 9-1.

Table 9-1: MPC Controller Object 
Property
Description
ManipulatedVariables (or MV or Manipulated or Input)
Input and input-rate upper and lower bounds, ECR values, names, units, and input target
OutputVariables (or OV or Controlled or Output)
Output upper and lower bounds, ECR values, names, units
DisturbanceVariables (or DV or Disturbance)
Disturbance names and units
Weights
Weights defining the performance function
Model
Plant, input disturbance, and output noise models, and nominal conditions.
Ts
Controller's sampling time
Optimizer
Parameters for the QP solver
PredictionHorizon
Prediction horizon
ControlHorizon
Number of free control moves or vector of blocking moves
History
Creation time
Notes
User notes (text)
UserData
Any additional data
MPCData (private)
Matrices for the QP problem and other accessorial data
Version (private)
Model Predictive Control Toolbox™ version number

ManipulatedVariables

ManipulatedVariables (or MV or Manipulated or Input) is an nu-dimensional array of structures (nu = number of manipulated variables), one per manipulated variable. Each structure has the fields described in Table 9-2, where p denotes the prediction horizon.

Table 9-2: Structure ManipulatedVariables 
Field Name
Content
Default
Min
1 to p dimensional vector of lower constraints on a manipulated variable u
-Inf
Max
1 to p dimensional vector of upper constraints on a manipulated variable u
Inf
MinECR
1 to p dimensional vector describing the equal concern for the relaxation of the lower constraints on u
0
MaxECR
1 to p dimensional vector describing the equal concern for the relaxation of the upper constraints on u
0
Target
1 to p dimensional vector of target values for the input variable u
0
RateMin
1 to p dimensional vector of lower constraints on the rate of a manipulated variable u
-Inf if problem is unconstrained, otherwise -10
RateMax
1 to p dimensional vector of upper constraints on the rate of a manipulated variable u
Inf
RateMinECR
1 to p dimensional vector describing the equal concern for the relaxation of the lower constraints on the rate of u
0
RateMaxECR
1 to p dimensional vector describing the equal concern for the relaxation of the upper constraints on the rate of u
0
Name
Name of input signal. This is inherited from InputName of the LTI plant model.
InputName of LTI plant model
Units
String specifying the measurement units for the manipulated variable
' '

OutputVariables

OutputVariables (or OV or Controlled or Output) is an ny-dimensional array of structures (ny = number of outputs), one per output signal. Each structure has the fields described in Table 9-3, where p denotes the prediction horizon.

Table 9-3: Structure OutputVariables 
Field Name
Content
Default
Min
1 to p dimensional vector of lower constraints on an output y
-Inf
Max
1 to p dimensional vector of upper constraints on an output y
Inf
MinECR
1 to p dimensional vector describing the equal concern for the relaxation of the lower constraints on an output y
1
MaxECR
1 to p dimensional vector describing the equal concern for the relaxation of the upper constraints on an output y
1
Name
Name of output signal. This is inherited from OutputName of the LTI plant model.
OutputName of LTI plant model
Units
String specifying the measurement units for the measured output
' '
Integrator
Magnitude of integrated white noise on the output channel (0=no integrator)
[]

In order to reject constant disturbances due for instance to gain nonlinearities, the default output disturbance model used in Model Predictive Control Toolbox software is a collection of integrators driven by white noise on measured outputs (see Output Disturbance Model). Output integrators are added according to the following rule:

  1. Measured outputs are ordered by decreasing output weight (in case of time-varying weights, the sum of the absolute values over time is considered for each output channel, and in case of equal output weight, the order within the output vector is followed).
  2. By following such order, an output integrator is added per measured outputs, unless there is a violation of observability, or the user forces it by zeroing the corresponding value in OutputVariables.Integrators).

By default, OutputVariables.Integrators is empty on all outputs. This enforces the default action of Model Predictive Control Toolbox software, namely add integrators on measured outputs, do not add integrators on unmeasured outputs. By setting the entry of OutputVariables(i).Integrators to zero, no attempt will be made to add integrated white noise on the i-th output . On the contrary, by setting the entry of OutputVariables(i).Integrators to one, an attempt will be made to add integrated white noise on the i-th output (see getoutdist).

DisturbanceVariables

DisturbanceVariables (or DV or Disturbance) is an (nv+nd)-dimensional array of structures (nv = number of measured input disturbances, nd = number of unmeasured input disturbances), one per input disturbance. Each structure has the fields described in Table 9-4.

Table 9-4: Structure DisturbanceVariables
Field Name
Content
Default
Name
Name of input signal. This is inherited from InputName of the LTI plant model.
InputName of LTI plant model
Units
String specifying the measurement units for the manipulated variable
' '

The order of the disturbance signals within the array DisturbanceVariables is the following: the first nv entries relate to measured input disturbances, the last nd entries relate to unmeasured input disturbances.

Weights

Weights is the structure defining the QP weighting matrices. Unlike the InputSpecs and OutputSpecs, which are arrays of structures, weights is a single structure containing four fields. The values of these fields depend on whether you are using the standard quadratic cost function (Equation 2-3) or the alternative cost function (Equation 2-5).

Standard Cost Function.   Table 9-5 lists the content of the four fields where p denotes the prediction horizon, nu the number of manipulated variables, ny the number of output variables.

The fields ManipulatedVariables, ManipulatedVariablesRate, and OutputVariables are arrays with nu, nu, and ny columns, respectively. If weights are time invariant, then ManipulatedVariables, ManipulatedVariablesRate, and OutputVariables are row vectors. However, for time-varying weights, each field is a matrix with up to p rows. If the number of rows is less than the prediction horizon, p, the object constructor duplicates the last row to create a matrix with p rows.

Table 9-5: Weights for the Standard Cost Function (MATLAB® Structure) 
Field Name
Content
Default
ManipulatedVariables (or MV or Manipulated or Input)
(1 to p)-by-nu dimensional array of input weights
zeros(1,nu)
ManipulatedVariablesRate (or MVRate or ManipulatedRate or InputRate)
(1 to p)-by-nu dimensional array of input-rate weights
0.1*ones(1,nu)
OutputVariables (or OV or Controlled or Output)
(1 to p)-by-ny dimensional array of output weights
1 (The default for output weights is the following: if , all outputs are weighted with unit weight; if nu<ny, nu outputs are weighted with unit weight (with preference given to measured outputs), while the remaining outputs receive zero weight.)
ECR
Weight on the slack variable epsilon used for softening the constraints
1e5*(max weight)

The default ECR weight is 105 times the largest weight specified in ManipulatedVariables, ManipulatedVariablesRate, and OutputVariables.

Alternative Cost Function.   You can specify off-diagonal Q and R weight matrices in the cost function. To accomplish this, you must define the fields ManipulatedVariables, ManipulatedVariablesRate, and OutputVariables as cell arrays, each containing a single positive-semi-definite matrix of the appropriate size. Specifically, OutputVariables must be a cell array containing the ny-by-ny Q matrix, ManipulatedVariables must be a cell array containing the nu-by-nu Ru matrix, and ManipulatedVariablesRate must be a cell array containing the nu-by-nu matrix (see Equation 2-5 and the demo mpcweightsdemo). You can abbreviate the field names as shown in Table 9-5. You can also use diagonal weights (as defined in Table 9-5) for one or more of these fields. If you omit a field, the object constructor uses the defaults shown in Table 9-5.

For example, you can specify off-diagonal weights, as follows

where Q=Q. Ru=Ru, and Rdu= are positive semidefinite matrices.

Model

The property Model specifies plant, input disturbance, and output noise models, and nominal conditions, according to the model setup described in Figure 2-2. It is specified through a structure containing the fields reported in Table 9-6.

Table 9-6: Structure Model Describing the Models Used by MPC 
Field Name
Content
Default
Plant
LTI model (or IDMODEL) of the plant
No default
Disturbance
LTI model describing color of input disturbances
An integrator on each Unmeasured input channel
Noise
LTI model describing color of plant output measurement noise
Unit white noise on each measured output = identity static gain
Nominal
Structure containing the state, input, and output values where Model.Plant is linearized
See Table 9-9.

The type of input and output signals is assigned either through the InputGroup and OutputGroup properties of Model.Plant, or, more conveniently, through function setmpcsignals, according to the nomenclature described in Table 9-7 and Table 9-8.

Table 9-7: Input Groups in Plant Model 
Name
Value
ManipulatedVariables (or MV or Manipulated or Input)
Indices of manipulated variables
MeasuredDisturbances (or MD or Measured)
Indices of measured disturbances
UnmeasuredDisturbances (or UD or Unmeasured)
Indices of unmeasured disturbances

Table 9-8: Output Groups in Plant Model
Name
Value
MeasuredOutputs (or MO or Measured)
Indices of measured outputs
UnmeasuredOutputs (or UO or Unmeasured)
Indices of unmeasured outputs

By default, all inputs are manipulated variables, and all outputs are measured.

The structure Nominal contains the nominal values for states, inputs, outputs and state derivatives/differences at the operating point where Model.Plant was linearized. The fields are reported in Table 9-9 (see Offsets).

Table 9-9: Nominal Values at Operating Point
Field
Description
Default
X
Plant state at operating point
0
U
Plant input at operating point, including manipulated variables, measured and unmeasured disturbances
0
Y
Plant output at operating point
0
DX
For continuous-time models, DX is the state derivative at operating point: DX=f(X,U). For discrete-time models, DX=x(k+1)-x(k)=f(X,U)-X.
0

Ts

Sampling time of the MPC controller. By default, if Model.Plant is a discrete-time model, Ts=Model.Plant.ts. For continuous-time plant models, you must specify a sampling time for the MPC controller.

Optimizer

Parameters for the QP optimization. Optimizer is a structure with the fields reported in Table 9-10.

Table 9-10: Optimizer Properties 
Field
Description
Default
MaxIter
Maximum number of iterations allowed in the QP solver
200
Trace
On/off
'off'
Solver
QP solver used (only 'ActiveSet')
'ActiveSet'
MinOutputECR
Minimum positive value allowed for OutputMinECR and OutputMaxECR
1e-10

MinOutputECR is a positive scalar used to specify the minimum allowed ECR for output constraints. If values smaller than MinOutputECR are provided in the OutputVariables property of the MPC objects a warning message is issued and the value is raised to MinOutputECR.

PredictionHorizon

PredictionHorizon is an integer value expressing the number p of sampling steps of prediction.

ControlHorizon

ControlHorizon is either a number of free control moves, or a vector of blocking moves (see Optimization Variables).

History

History stores the time the MPC controller was created.

Notes

Notes stores user's notes as a cell array of strings.

UserData

Any additional data stored within the MPC controller object.

MPCData

MPCData is a private property of the MPC object used for storing intermediate operations, QP matrices, internal flags, etc. See getmpcdata and setmpcdata.

Version

Version is a private property indicating the Model Predictive Control Toolbox version number.

Construction and Initialization

An MPC object is built in two steps. The first step happens at construction of the object when the object constructor mpc is invoked, or properties are changed by a set command. At this first stage, only basic consistency checks are performed, such as dimensions of signals, weights, constraints, etc. The second step happens at initialization of the object, namely when the object is used for the first time by methods such as mpcmove and sim, that require the full computation of the QP matrices and the estimator gain. At this second stage, further checks are performed, such as a test of observability of the overall extended model.

Informative messages are displayed in the command window in both phases, you can turn them on or off using the mpcverbosity command.


 Provide feedback about this page 

Previous page Object Reference MPC Simulation Options Object Next page

Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS