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.
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:
For stable, continuous-time internal plant models, the toolbox proposes controller sample time automatically. 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 tools to advise you how to specify controller constraints and weights. The toolbox also lets you use a custom QP solver and the models and gains used in state estimation.
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 QP solver supplied with the toolbox is optimized for performance and robustness. It achieves convergence even when the optimization problem is ill-conditioned. You can also use it to create a custom model predictive controller formulation.
The toolbox also provides you with the flexibility to use a custom QP solver of your choice for simulation and code generation.
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 weights and constraints.
Model predictive controllers formulate and solve a QP optimization problem at each computation step. The toolbox lets you monitor optimization status at run time. You can access the optimization status signal to detect rare occasions when an optimization may fail 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 and constraints 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:
To adjust constraints at run time, you would configure the MPC Controller block to accept the appropriate signals. The block provides you with the ability to change the following constraints at run time:
Model Predictive Control Toolbox provides two options for controlling plants with changing dynamics. You can design an adaptive model predictive controller or implement a gain-scheduled model predictive controller.
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 (LTV) 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 the 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.
If you can predict how the plant and nominal conditions vary in the future, you can specify an internal plant model that changes over the prediction horizon. Such an LTV model is useful when controlling periodic systems or nonlinear systems that are linearized around a time-varying nominal trajectory.
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.
To reduce online computational effort, you can also implement gain-scheduled explicit MPC in Simulink using the Multiple Explicit MPC Controllers block.
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.
Model Predictive Control Toolbox enables you to design, simulate, and deploy model predictive controllers with guaranteed worst-case execution time. You can use this capability to deploy model predictive controllers in applications with limited computational throughput budget.
To accomplish this, the toolbox provides an option to limit the number of iterations for solving a QP optimization problem and two choices for specifying what the algorithm will do once that maximum number of iterations is reached:
The approximate solution often will provide acceptable performance, but there is no guarantee this will always be the case. Therefore, it is recommended that you simulate your controller performance with both options and choose the one with the best simulation results.
For some applications, the convergence of QP optimization can be accelerated by using a custom QP solver. The toolbox enables you to use such custom QP solvers instead of the built-in KWIK solver for both simulation and code generation.
Model Predictive Control Toolbox supports economic MPC; that is, the ability to optimize the controller for an arbitrary cost function under arbitrary nonlinear constraints, as can be the case with electricity prices fluctuating throughout the day. This requires Optimization Toolbox™.
Model Predictive Control Toolbox lets you provide your custom nonlinear cost function and custom nonlinear constraints. When you simulate economic MPC using the specified arbitrary cost function and arbitrary constraints, the MPC controller:
Model Predictive Control Toolbox does not support deployment of economic MPC.
Model Predictive Control Toolbox provides several ways to deploy a controller in an application. You can:
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.