mpcmove
Compute optimal control action and update controller states
Syntax
Description
Use this command to simulate an MPC controller in closed-loop with a plant model.
Call mpcmove
repeatedly in a for loop to calculate the manipulated
variable and update the controller states at each time step.
returns the optimal move mv
= mpcmove(mpcobj
,xc
,ym
,r
,v
)mv
and updates the states
xc of the controller mpcobj
.
The manipulated variable mv
at the current time is calculated given:
the controller object,
mpcobj
,a pointer to the current estimated extended state,
xc
,the measured plant outputs,
ym
,the output references,
r
,and the measured disturbance input,
v
.
If ym
, r
or v
is
specified as []
, or if it is missing as a last input argument,
mpcmove
uses the appropriate mpcobj.Model.Nominal
value instead.
When using default state estimation, mpcmove
also updates the
controller state referenced by the handle object xc
. Therefore, when
using default state estimation, xc
always points to the updated
controller state. When using custom state estimation, you should update
xc
prior to each mpcmove
call.
[___] = mpcmove(___,
overrides default constraints and weights in options
)mpcobj
with the values
specified in Options
, an mpcmoveopt
object. Use Options
to provide run-time
adjustment of constraints and weights during the closed-loop simulation.
Examples
Input Arguments
Output Arguments
Tips
mpcmove
updatesxc
, even though it is an input argument.If
ym
,r
orv
is specified as[]
, or if it is missing as a last input argument,mpcmove
uses the appropriatempcobj.Model.Nominal
value instead.To view the predicted optimal behavior for the entire prediction horizon, plot the appropriate sequences provided in
Info
.To determine the optimization status, check
Info.Iterations
andInfo.QPCode
.
Alternatives
Use
sim
for plant mismatch and noise simulation when not using run-time constraints or weight changes.Use the MPC Designer app to interactively design and simulate model predictive controllers.
Use the MPC Controller block in Simulink and for code generation.
Use
mpcmoveCodeGeneration
to simulate an MPC controller prior to code generation.
Version History
Introduced before R2006a
See Also
Functions
review
|cloffset
|buildMEX
|mpcmoveCodeGeneration
|mpcmoveAdaptive
|mpcmoveMultiple
|mpcmoveExplicit
|sim
Objects
mpc
|mpcstate
|mpcmoveopt
|mpcsimopt
|explicitMPC