Compute optimal control using explicit MPC
computes the optimal manipulated variable moves at the current time using an explicit model
predictive control law. This result depends on the properties contained in the explicit MPC
controller and the controller states. The result also depends on the measured output
variables, the output references (setpoints), and the measured disturbance inputs.
mv = mpcmoveExplicit(
mpcmoveExplicit updates the controller state,
when using default state estimation. Call
mpcmoveExplicit repeatedly to
simulate closed-loop model predictive control.
EMPCobj— Explicit MPC controller
Explicit MPC controller to simulate, specified as an Explicit
MPC controller object. Use
create an explicit MPC controller.
x— Current MPC controller state
Current MPC controller state, specified as an
Before you begin a simulation with
initialize the controller state using
x = mpcstate(EMPCobj).
Then, modify the default properties of
x as appropriate.
If you are using default state estimation,
updates the state values in the previous control interval with that
information. Therefore, you should not programmatically update
all. The default state estimator employs a linear time-varying Kalman
If you are using custom state estimation,
x[n|n]. Therefore, prior to each
you must set
x.Noise to the best estimates of these states
(using the latest measurements) at the current control interval.
ym— Current measured outputs
Current measured outputs, specified as a row vector of length
Nym is the number of measured outputs. If
you are using custom state estimation,
ym is ignored. If you set
mpcmoveExplicit uses the appropriate nominal value.
r— Plant output reference values
Plant output reference values, specified as a vector of length
uses a constant reference for the entire prediction horizon. In contrast to
mpcmoveExplicit does not support reference previewing.
If you set
the appropriate nominal value.
v— Current and anticipated measured disturbances
Current and anticipated measured disturbances, specified as a vector of length
Nmd is the number of measured
disturbances. In contrast to
mpcmoveExplicit does not
support disturbance previewing. If your plant model does not include measured
MVused— Manipulated variable values from previous interval
Manipulated variable values applied to the plant during the previous control interval,
specified as a vector of length Nmv, where
Nmv is the number of manipulated
variables. If this is the first
mpcmoveExplicit command in a
simulation sequence, omit this argument. Otherwise, if the MVs calculated by
mpcmoveExplicit in the previous interval were overridden, set
MVused to the correct values in order to improve the controller
state estimation accuracy. If you omit
info— Explicit MPC solution status
Explicit MPC solution status, returned as a structure having the following fields.
ExitCode— Solution status code
Solution status code, returned as one of the following values:
1 — Successful solution.
0 — Failure. One or more controller input parameters is out of range.
–1 — Undefined. Parameters are in range but an extrapolation must be used.
Region— Region to which current controller input parameters belong
Region to which current controller input parameters belong,
returned as either a positive integer or 0. The integer value is the
index of the polyhedron (region) to which the current controller input
parameters belong. If the solution failed,
Use the Explicit MPC Controller Simulink block for simulation and code generation.