Contents

Designing a Model Predictive Controller in Simulink®

This example shows how to design a model predictive controller starting from linearizing a nonlinear plant in Simulink® .

Open Simulink Model

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 the simulink model where MPC controller block is connected to the plant model block.

mdl = 'mpc_linearization';
open_system(mdl);

No MPC controller is defined in the MPC block yet.

open_system([mdl '/MPC Controller']);

Linearize Plant and Launch MPC Design Tool

Click the "Design..." button in the MPC block dialog to launch the MPC design tool. In the "MPC Question" dialog, specify 1 as the number of manipulated variable and 1 as the number of measured output. Sample time of the controller must be a positive real number.

During the launching process, the MPC design tool linearizes the Simulink plant at the default operating point and uses the linearized model as the internal predictive model in the MPC controller.

At the end of launching process, a "Control and Estimation Tools Manager" window shows up with an MPC Design Task, where you can continue your MPC design.

bdclose(mdl)
Was this topic helpful?