Main Content

Compute optimal control action

`mv = mpcmove(MPCobj,x,ym,r,v)`

[mv,info] = mpcmove(MPCobj,x,ym,r,v)

[___] = mpcmove(___,options)

computes the optimal manipulated variable moves, `mv`

= mpcmove(`MPCobj`

,`x`

,`ym`

,`r`

,`v`

)*u*(*k*), at
the current time. *u*(*k*) is calculated given the current
estimated extended state, *x*(*k*), the measured plant outputs,
*y _{m}*(

`mpcmove`

repeatedly to simulate closed-loop model predictive control.`[`

returns additional information regarding the model predictive controller in the second output
argument `mv`

,`info`

] = mpcmove(`MPCobj`

,`x`

,`ym`

,`r`

,`v`

)`info`

.

`[___] = mpcmove(___,`

overrides default constraints and weights settings in `options`

)`MPCobj`

with the values
specified by `Options`

, an `mpcmoveopt`

object. Use `Options`

to provide run-time adjustment
of constraints and weights during the closed-loop simulation.

`mpcmove`

updates`x`

.If

`ym`

,`r`

or`v`

is specified as`[]`

,`mpcmove`

uses the appropriate`MPCobj.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`

and`Info.QPCode`

.

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`

for code generation.

`getEstimator`

| `mpc`

| `mpcmoveopt`

| `mpcstate`

| `review`

| `setEstimator`

| `sim`