Model Predictive Control Toolbox
Model predictive controllers can be used to optimize closed-loop system performance of MIMO plants subject to input and output constraints. Because they base their actions on an internal plant model, model predictive controllers can forecast future process behavior and compute the optimal control actions accordingly. The ability to model process interactions often enables model predictive controllers to outperform multiple PID control loops, which require individual tuning and other techniques to reduce loop coupling.
You can iteratively improve your controller design by defining an internal plant model, adjusting controller parameters such as weights and constraints, and simulating closed-loop system response to evaluate controller performance.
Getting Started with Model Predictive Control Toolbox
Use Model Predictive Control Toolbox™ to design and simulate model predictive controllers.
When designing a model predictive controller in Simulink, you can use Simulink Control Design™ to extract a linearized form of the Simulink model and automatically import it into the controller as the internal plant model.
Alternatively, you can use linear time-invariant (LTI) systems from Control System Toolbox™, such as a transfer function or a state-space model, to specify the internal plant model. Model Predictive Control Toolbox also lets you directly import models created from measured input-output data using System Identification Toolbox™.
Once you have defined the internal plant model, you can complete the design of your model predictive controller by specifying the following controller parameters:
The toolbox supports time-varying constraints and weights, constraints on linear combinations of manipulated variables and output variables, terminal constraints and weights, and constraints in the form of linear off-diagonal weights. The toolbox also supports constraint softening.
You can use functions or the MPC Designer app to run closed-loop simulations of your model predictive controller against linear plant models. The app lets you set up multiple simulation scenarios. For each scenario, you can specify controller set points and disturbances by choosing from several common signal profiles. Examples are step, ramp, sine wave, and random signal.
To assess robustness under model mismatch, you can simulate a controller against a linear plant model that is different from the internal plant model used by the controller. You can also simulate multiple controller designs against the same plant model to see how different weight and constraint settings affect controller performance. With this toolbox, you also have the ability to disable constraints to evaluate characteristics of the closed-loop dynamics, such as stability and damping.
Using Simulink blocks provided with Model Predictive Control Toolbox, you can run closed-loop simulations of your model predictive controller against a nonlinear Simulink model. You can configure the blocks to accept run-time constraint and weight signals that are generated by other Simulink blocks.
Model Predictive Control Toolbox provides several tools to help you optimize controller performance by adjusting controller constraints and weights, as well as the models and gains used in state estimation.
The toolbox includes the Tuning Advisor, which guides you through setting weights to improve controller performance. You can use the Tuning Advisor to:
By repeating this interactive process, you can systematically adjust controller weights to optimize controller performance.
Weight Tuning for Model Predictive Controllers
Use Tuning Adviser to adjust model predictive controller weights to improve controller performance.
The toolbox provides a diagnostic function for detecting potential stability and robustness issues with your model predictive controller, such as:
You can use this diagnostic tool to adjust controller weights and constraints during controller design to avoid run-time failures.
The toolbox provides built-in state estimators for estimating controller states from measured outputs. If you have state measurements or prefer to use values estimated with a custom algorithm, the toolbox provides you with an option to do so.
Model Predictive Control Toolbox supports monitoring run-time controller performance and adjusting run-time tuning parameters.
Model predictive controllers formulate and solve a QP optimization problem at each computation step. The QP solver supplied with the toolbox is optimized for performance and robustness. It achieves convergence even when the optimization problem is ill-conditioned.
On rare occasions when the optimization may fail to converge due to process abnormalities, the MPC Controller block freezes the controller output at the previous value and lets you monitor optimization status at run time. You can access the optimization status signal to detect when an optimization fails to converge and then decide if a backup control strategy should be used.
The MPC Controller block also lets you access the optimal cost and control sequence at each computation step. You can use these signals to analyze controller performance and develop custom control strategies. For example, you can use optimal cost information for switching between two model predictive controllers whose outputs are restricted to discrete values.
The toolbox lets you adjust the run-time weights of your model predictive controller to optimize its performance at run time without redesigning or reimplementing it. To perform run-time controller tuning in Simulink, you would configure the MPC Controller block to accept the appropriate weights. You can also perform run-time controller tuning in MATLAB.
Model Predictive Control Toolbox provides access to the following run-time tuning parameters:
With Model Predictive Control Toolbox, you are able to design, simulate, and deploy adaptive MPC controllers for your plant. You can use an adaptive MPC controller to control a nonlinear plant across a wide operating range through run-time changes to an internal linear plant model. The toolbox provides a function and a Simulink block for simulating and implementing adaptive MPC controllers in MATLAB and Simulink, respectively. The toolbox also provides a built-in linear-time-varying Kalman filter with asymptotic stability guarantee for state estimation in adaptive model predictive controllers.
You can continuously estimate a linear plant model at run time with online parameter estimation capabilities of System Identification Toolbox. You can then use the estimated model for run-time updates to an internal plant model in an adaptive MPC controller. This approach lets you design controllers that can adapt to changes in plant dynamics as these changes happen.
Model Predictive Control Toolbox enables you to design, simulate and deploy explicit MPC controllers for your plant. By using optimal solutions precomputed offline, explicit MPC controllers require fewer computations than traditional (implicit) model predictive controllers and are, therefore, useful for applications with fast sample times. You are able to generate an explicit MPC controller from a traditional model predictive controller, as well as simplify a generated explicit MPC controller for a reduced memory footprint. The toolbox also provides a function and a Simulink block for simulating and implementing a generated explicit model predictive controller in MATLAB and Simulink, respectively.
You can use the Multiple MPC Controllers block for controlling a nonlinear Simulink plant model over a wide range of operating conditions. With this block you can design a model predictive controller for each operating point and switch between model predictive controllers at run time. The Multiple MPC Controllers block ensures bumpless control transfer from one model predictive controller to another. You can create linear plant models for controller design at each operating point either by linearizing a Simulink model with Simulink Control Design or by specifying the plant model directly. The toolbox also provides a function for switching multiple model predictive controllers in MATLAB.
Model Predictive Control Toolbox provides two ways to deploy a controller in an application. One way is to use Simulink Coder or Simulink PLC Coder to generate C code or IEC61131-3 Structured Text, respectively, from Simulink blocks provided with the toolbox, and deploy the code to a supported target system for implementation or rapid prototyping. The toolbox provides a diagnostic function for estimating data memory size used by deployed controller at run time.
Another way to deploy a controller in an application is to use OPC Toolbox™ to connect a controller operating in MATLAB directly to an OPC-compliant system.
System Identification and Control Using OPC Data
Improve process performance by designing and implementing a model predictive controller. Use OPC Toolbox™ and System Identification Toolbox™ to collect the input-output data and create a plant model.