| Model Predictive Control Toolbox |
|
MPC Controller
| | Provide feedback about this page |
Compute MPC control law
Library
MPC Simulink Library
Description

The MPC Controller block receives the current measured output, reference signal, and measured disturbance signal, and outputs the optimal manipulated variables by solving a quadratic program. The block is based on an MPC object, which provides performance and constraint specifications, as well as the sampling time of the block.
Dialog Box

- MPC controller
- You must supply an MPC object that defines your controller. There are two ways to do this. One is to enter the name of the MPC object in your base workspace. The other is to enter a name in the edit box and then click the Design button. This opens the MPC design tool, where you can specify your controller.
- If you are designing a controller in the design tool, you can see how well it works by running a closed-loop Simulink® simulation without existing the tool. This makes it easier to tune controller parameters.
- When the MPC controller edit box is empty, clicking the Design button constructs a default MPC controller by obtaining a linearized model from the Simulink diagram.
- When you close the design tool, it prompts you to export the controller as an MPC object so you can use it in subsequent simulations.
- Initial controller state
- Initial state of the MPC controller. This must be a valid
mpcstate object.
- Reference signal
- If you select the check box, the edit box to the right must contain the name of a variable in your workspace that defines the reference signal. This also enables the Look Ahead check box. Selecting the Look Ahead check box anticipates reference variations and usually improves reference tracking (see Look Ahead and Signals from the Workspace). If you do not select the Reference signal check box, the signal connected to the block
ref inport supplies the reference values.
- Measured disturbance
- Provides options for the measured disturbances (for feedforward compensation) in the same way as for the reference signals, above.
- Enable input port for measured disturbance
- This option adds an inport (labeled
md) to which you can connect measured disturbances and for which the controller will provide feedforward compensation.
- Enable input port for externally supplied manipulated variables to plant
- This check box lets you switch between MPC control and another type of control (e.g., manual control) during a simulation. It adds an inport (labeled
ext.mv) to which you can connect the actual manipulated variables the plant is receiving. The block uses these in its internal state estimates. The following example shows possible connections. See also the mpcbumpless demo.
- If the inport is disabled, or it is enabled with no connected signal, then the MPC controller updates the internal state estimate by using the MPC action evaluated at the current time instant.

Bumpless Switching Between MPC and Another Controller
- Enable input port for input and output limits
- This check box adds inports to which you can connect time-varying constraint specifications. Otherwise, the block uses the constant constraint values stored within its MPC object. Example connections appear below. See also the
mpcvarbounds demo.
- When you enable this option, the block interprets an unconnected limit inport, such as
ymin in the example below, as an unconstrained variable. Also, to prevent numerical difficulties the block enforces a minimum separation of 1e-5 between lower and upper bounds. Further, if a signal connected to a lower-bound port exceeds that connected to the corresponding upper-bound port, the block automatically uses the smaller signal as the lower bound and vice versa.

| Note
The MPC Controller block is a discrete-time block with sampling time inherited from the MPC object. The MPC block has direct feedthrough from measured outputs (mo), output references (ref), and measured disturbances (md) to MPC-manipulated variables (mv), and no direct feedthrough from externally supplied manipulated variables (ext.mv) to MPC-manipulated variables (mv).
|
See Also
mpc, mpcstate
| | Provide feedback about this page |
 | Block Reference | | Object Reference |  |