Main Content

Code Generation

Generate code and deploy controllers on real-time targets

Once you have validated a model predictive controller in Simulink®or MATLAB®, you can generate code and deploy it for real-time control applications. For more information, seeGenerate Code and Deploy Controller to Real-Time Targets.

Functions

expand all

Linear MPC

getCodeGenerationData Create data structures formpcmoveCodeGeneration
mpcmoveCodeGeneration Compute optimal control moves with code generation support

Nonlinear MPC

getCodeGenerationData Create data structures fornlmpcmoveCodeGeneration
nlmpcmoveCodeGeneration Compute nonlinear MPC control moves with code generation support

Generate MEX File

buildMEX Build MEX file that solves an MPC control problem
mpcActiveSetSolver Solve quadratic programming problem using active-set algorithm
mpcActiveSetOptions Create default option set formpcActiveSetSolver
mpcInteriorPointSolver Solve a quadratic programming problem using an interior-point algorithm
mpcInteriorPointOptions Create default option set formpcInteriorPointSolver
setCustomSolver Configures an MPC object to use the QP solver fromOptimization Toolboxas a custom solver

Blocks

expand all

MPC Controller 装病者e model predictive controller
Adaptive MPC Controller 装病者e adaptive and time-varying model predictive controllers
Explicit MPC Controller Explicit model predictive controller
Multiple MPC Controllers 装病者e switching between multiple implicit MPC controllers
Multiple Explicit MPC Controllers Multiple explicit MPC controllers
Nonlinear MPC Controller 装病者e nonlinear model predictive controllers
Adaptive Cruise Control System 装病者e adaptive cruise control using model predictive controller
Lane Keeping Assist System 装病者e lane-keeping assistance using adaptive model predictive controller
Path Following Control System 装病者e path-following control using adaptive model predictive controller

Topics

Code Generation Basics

万博1manbetxCode Generation

MATLABCode Generation

CUDA Code Generation

Using Custom Solvers

OPC Simulation