| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Model Predictive Control Toolbox |
| Contents | Index |
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.
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.
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.
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:
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.
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.
The default ECR weight is 105 times the largest weight specified in ManipulatedVariables, ManipulatedVariablesRate, and OutputVariables.
Note
All weights must be greater than or equal to zero. If all weights on manipulated variable increments are strictly positive, the resulting QP problem is always strictly convex. If some of those weights are zero, the Hessian matrix of the QP problem may become only positive semidefinite. In order to keep the QP problem always strictly convex, if the condition number of the Hessian matrix K U is larger than 1012, the quantity 10*sqrt(eps) is added on each diagonal term. This may only occur when all input rates are not weighted (W u=0) (see Cost Function).
|
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
MPCobj.Weights.OutputVariables={Q}; MPCobj.ManipulatedVariables={Ru}; MPCobj.ManipulatedVariablesRate={Rdu};
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.
| 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. |
| Note Direct feedthrough from manipulated variables to any output in Model.Plant is not allowed. See Prediction Model. |
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.
| 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.
| Note With this current release, the InputGroup and OutputGroup properties of LTI objects are defined as structures, rather than cell arrays (see the Control System Toolbox™ documentation for more details). |
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).
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.
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 |
![]() | Object Reference | MPC Simulation Options Object | ![]() |

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 |