MPC controller state
mpcstate object represents the state of an implicit or
explicit MPC controller. Use an
mpcstate object to initialize the
controller object before simulation.
The controller state includes the:
States of the plant, disturbance, and noise models of the controller.
Manipulated variables used in the previous control interval.
State covariance matrix for the controller.
mpcstate objects are updated during simulation using the internal
state observer based on the extended prediction model. The overall state is updated from the
measured output ym(k) by a linear
state observer. For mode information, see Controller State Estimation.
creates a controller state object for the implicit or explicit MPC controller
x = mpcstate(
mpcobj, setting the state object properties to their default
Plant — Plant model state estimates
Plant model state estimates, specified as a vector. The plant state estimate values
are in engineering units and are absolute; that is, they include state offsets. By
Plant property is equal to the
Model.Nominal.X property of the controller used to create the
If the controller plant model includes delays, the
property includes states that model the delays. Therefore the number of elements in
Plant is greater than the order of the nondelayed controller
Disturbance — Disturbance model state estimates
Disturbance model state estimates, specified as a vector. The disturbance state
estimates include the states of the input disturbance model followed by the states of
the output disturbance model. By default, the
is a zero vector if the controller has disturbance model states and empty
Noise — Output measurement noise model state estimates
Output measurement noise model state estimates, specified as a vector. By default,
Noise property is a zero vector if the controller has noise
model states and empty otherwise.
LastMove — Optimal manipulated variable control move from previous control interval
Optimal manipulated variable control move from previous control interval, specified
as a vector with length equal to the number of manipulated variables. By default, the
LastMove property is equal to the nominal values of the
During simulation, the
mpcmove function automatically sets the
When the actual control signals sent to the plant in the previous control interval
do not match the calculated optimal value, do not use
specify the actual control signals. Instead, do so using
Covariance — Covariance matrix for controller state estimates
Covariance matrix for controller state estimates, specified as an
symmetric matrix, where Ns is the sum of the
number states contained in the
Noise fields. T
If the controller is employing default state estimation the default covariance
matrix is the steady-state covariance computed according to the assumptions in Controller State Estimation. For more information, see the description of the
P output argument of the
If the controller uses custom state estimation, the
property is empty and not used.
During simulation, do not modify
mpcmove function automatically sets the value of
Covariance at each control interval.
Get Controller State Object
Create a model predictive controller for a single-input-single-output (SISO) plant. For this example, the plant includes an input delay of 0.4 time units, and the control interval to 0.2 time units.
H = tf(1,[10 1],'InputDelay',0.4); MPCobj = mpc(H,0.2);
-->The "PredictionHorizon" property of "mpc" object is empty. Trying PredictionHorizon = 10. -->The "ControlHorizon" property of the "mpc" object is empty. Assuming 2. -->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.
Create the corresponding controller state object in which all states are at their default values.
xMPC = mpcstate(MPCobj)
-->Converting the "Model.Plant" property of "mpc" object to state-space. -->Converting model to discrete time. -->Converting delays to states. -->Assuming output disturbance added to measured output channel #1 is integrated white noise. -->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel. MPCSTATE object with fields Plant: [0 0 0] Disturbance: 0 Noise: [1x0 double] LastMove: 0 Covariance: [4x4 double]
The plant model,
H, is a first-order, continuous-time transfer function. The
Plant property of the
mpcstate object contains two additional states to model the two intervals of delay. By default, the controller contains a first-order output disturbance model (
Disturbance property is a scalar) and a static gain noise model (
Noise property is empty).
You can access the properties of the controller state object using dot notation. For example, view the default covariance matrix.
ans = 4×4 0.0624 0.0000 0.0000 -0.0224 0.0000 1.0000 0.0000 0.0000 0.0000 0.0000 1.0000 -0.0000 -0.0224 0.0000 -0.0000 0.2301