Design and simulate model predictive controllers
The MPC Designer app lets you design and simulate model predictive controllers in MATLAB® and Simulink®.
Using this app, you can:
Interactively design model predictive controllers and validate their performance using simulation scenarios
Obtain linear plant models by linearizing Simulink models (requires Simulink Control Design™)
Review controller designs for potential run-time stability or numerical issues
Compare response plots for multiple model predictive controllers
Generate Simulink models with an MPC controller and plant model
Generate MATLAB scripts to automate MPC controller design and simulation tasks
The following advanced MPC features are not available in the MPC Designer app:
Explicit MPC design
Adaptive MPC design
Nonlinear MPC design
Mixed input/output constraints (
Terminal weight specification (
Custom state estimation (
Sensitivity analysis (
Alternative cost functions with off-diagonal weights
Specification of initial plant and controller states for simulation
Specification of nominal state values using
Updating weights, constraints, MV targets, and external MV online during simulations
If your application requires any of these features, design and simulate your controller at the command line. You can also run simulations in Simulink when using these features.
When using MPC Designer in MATLAB Online™, the following features are not available:
Designing controllers in Simulink
Generating Simulink models for your controller and plant
MATLAB Toolstrip: On the Apps tab, under Control System Design and Analysis, click the app icon.
MATLAB command prompt: Enter
Simulink model editor: In the MPC Controller Block Parameters dialog box, click Design.
mpcDesigner opens the MPC Designer app.
You can then import a plant or controller to start the design process,
or open a saved design session.
plant is a stable, continuous-time LTI
system, MPC Designer sets the controller sample time to 0.1 Tr,
where Tr is the average
rise time of the plant. If
plant is an unstable,
continuous-time system, MPC Designer sets the controller
sample time to
By default, plant input and output signals are treated as manipulated
variables and measured outputs respectively. To specify a different
input/output channel configuration, use
opening MPC Designer.
You can also specify plant as a linear System
Identification Toolbox™ model,
such as an
idtf system. The app converts the identified
model to a state-space system, discarding any noise channels. To convert
noise channels to unmeasured disturbances, convert the identified
model to a state-space model using the
For more information on identifying plant models, see Identify Plant from Data.
the app and imports the model predictive controller
the MATLAB workspace. To create an MPC controller, use
the app and imports multiple MPC controllers specified in the cell
MPCobjs. All of the controllers in
have the same input/output channel configuration.
specifies controller names when opening the app with multiple MPC
names as a cell array of
character vectors or string array with the same length as
Specify a unique name for each controller.
the app and loads a previously saved session. Specify
one of the following:
The name of a session data file in the current working directory or on the MATLAB path, specified as a character vector or string. To save session data to disk, in the MPC Designer app, on the MPC Designer tab, click Save Session. The saved session data includes all plants, controllers, and scenarios in the Data Browser, the current MPC structure, and the current plot configuration.
A previously loaded
in the MATLAB workspace. To load a
from a session data file, at the command line, enter: