Model Predictive Control Toolbox
Design and simulate model predictive controllers
Model Predictive Control Toolbox™ provides functions, an app, and Simulink® blocks for designing and simulating controllers using linear and nonlinear model predictive control (MPC). The toolbox lets you specify plant and disturbance models, horizons, constraints, and weights. By running closed-loop simulations, you can evaluate controller performance.
You can adjust the behavior of the controller by varying its weights and constraints at run time. The toolbox provides deployable optimization solvers and also enables you to use a custom solver. To control a nonlinear plant, you can implement adaptive, gain-scheduled, and nonlinear MPC controllers. For applications with fast sample rates, the toolbox lets you generate an explicit model predictive controller from a regular controller or implement an approximate solution.
For rapid prototyping and embedded system implementation, including deployment of optimization solvers, the toolbox supports C code and IEC 61131-3 Structured Text generation.
MPC Designer App
Interactively design MPC controllers by defining an internal plant model and adjusting horizons, weights, and constraints. Validate controller performance using simulation scenarios. Compare responses for multiple MPC controllers.
MPC Design in Simulink
Model and simulate MPC controllers in Simulink using the MPC Controller block and other blocks provided by the toolbox. Trim and linearize a Simulink model to compute an internal linear time-invariant plant model for your MPC controller and obtain nominal values for plant inputs and outputs using Simulink Control Design™.
MPC Design in MATLAB
Use command-line functions to design MPC controllers. Define an internal plant model; adjust weights, constraints, and other controller parameters. Simulate closed-loop system response to evaluate controller performance.
Use the Adaptive Cruise Control System, Lane Keeping Assist System, and Path Following Control System blocks as a starting point for your ADAS application and customize the design as needed. Generate code from the prebuilt blocks for in-vehicle deployment.
Reference Application Examples
Use reference application examples to walk through a workflow for designing and deploying MPC controllers for automated driving systems. Reference application examples also show you how different parts of your system can be modeled at various levels of fidelity.
Design a linear MPC controller by specifying an internal plant model as a linear time-invariant (LTI) system created with Control System Toolbox™, or by linearizing a Simulink model with Simulink Control Design. Alternatively, import a model created from measured input-output data using System Identification Toolbox™.
Design and simulate adaptive MPC controllers by using command line functions and the Adaptive MPC Controller block. Update your plant model at run time and provide it as an input to the controller. Use a built-in linear time-varying (LTV) Kalman filter with guaranteed asymptotic stability for state estimation in adaptive model predictive controllers.
Control nonlinear plants over a wide range of operating conditions with the Multiple MPC Controllers block. Design an MPC controller for each operating point and switch between the controllers at run time.
Iteratively improve your controller design by defining an internal plant model, adjusting controller parameters, and simulating closed-loop system response to evaluate controller performance. Review your controller for potential design issues.
After defining the internal plant model, complete the design of your MPC controller by specifying the sample time, prediction and control horizons, scale factors, input and output constraints, and weights. The toolbox also supports constraint softening and time-varying constraints and weights.
Estimate controller states from measured outputs using the built-in state estimator. Alternatively, use a custom algorithm for state estimation.
Detect potential stability and robustness issues with your MPC controller using the built-in diagnostic function. Use the diagnostic results to adjust controller weights and constraints during controller design to avoid run-time failures.
Run-Time Parameter Tuning
Adjust the weights and constraints of your MPC controller to optimize its performance at run time without redesigning or reimplementing it. Perform run-time controller tuning in both MATLAB® and Simulink.
Run-Time Performance Monitoring
Access the optimization status signal to detect rare occasions when an optimization may fail to converge. Use this information to guide decisions on backup control strategies.
Generate an explicit MPC controller from an implicit MPC design for faster execution. Simplify a generated explicit MPC controller for a reduced memory footprint.
Approximate (Suboptimal) Solution
Design, simulate, and deploy an MPC controller with guaranteed worst-case execution time using an approximate (suboptimal) solution.
Use nonlinear MPC controllers for optimal planning applications that require a nonlinear model with nonlinear costs or constraints.
Simulate closed-loop control of nonlinear plants under nonlinear costs and constraints. By default, nonlinear MPC controllers use Optimization Toolbox™ to solve the nonlinear programming problem. You can also specify your own custom nonlinear solver.
Design economic MPC controllers to optimize the controller for an arbitrary cost function under arbitrary nonlinear constraints. You can use a linear or nonlinear prediction model, a custom nonlinear cost function, and custom nonlinear constraints.
Code Generation with MATLAB and Simulink
Design an MPC controller in Simulink and generate C code or IEC 61131-3 Structured Text using Simulink Coder™ or Simulink PLC Coder™, respectively. Use MATLAB Coder™ to generate C code in MATLAB and deploy it for real-time control. Alternatively, use MATLAB Compiler™ to package and share your MPC controller as a standalone application.
Generate code from provided active-set and interior-point quadratic programming (QP) solvers for efficient implementation on embedded processors. For nonlinear problems, use the sequential quadratic programming (SQP) solver from Optimization Toolbox for simulation and code generation. Deploy the generated code to any number of processors.
Use Embotech FORCES PRO QP and nonlinear programming (NLP) solvers to simulate and generate code for linear and nonlinear MPC controllers. Alternatively, use custom QP and NLP solvers for simulation and code generation.