This example shows how to design a model predictive controller by first from linearizing a nonlinear plant in Simulink® .
To run this example, Simulink® and Simulink Control Design® are required.
if ~mpcchecktoolboxinstalled('simulink') disp('Simulink(R) is required to run this example.') return end if ~mpcchecktoolboxinstalled('slcontrol') disp('Simulink Control Design(R) is required to run this example.') return end
Open a Simulink model with an MPC Controller block connected to a plant model block.
mdl = 'mpc_linearization'; open_system(mdl);
Open MPC Controller block dialog. No MPC controller is defined in the MPC Controller block yet.
open_system([mdl '/MPC Controller']);
Click the "Design" button in the MPC block dialog to launch the MPC Designer app.
Click the "MPC Structure" button to launch the "Define MPC Structure By Linearization" dialog, where you can specify the MPC structure information for your design. Validate that the I/O signal sizes, controller sample time, operating point and Simulink signals are the desired values.
Click the "Define and Linearize" button. The app will linearize the Simulink plant at the specified operating point and use the linearized model as the internal predictive model in the MPC controller. Default plant, controller and simulation scenario are created and initial closed-loop reference tracking responses are plotted. You can continue your controller design in the "Tuning" tab.