Contents

Control of a Single-Input-Single-Output Plant

This example shows how to control a double integrator plant under input saturation in Simulink®.

Define Plant Model

The linear open-loop dynamic model is a double integrator:

plant = tf(1,[1 0 0]);

Design MPC Controller

Create the controller object with sampling period, prediction and control horizons:

Ts = 0.1;
p = 10;
m = 3;
mpcobj = mpc(plant, Ts, p, m);
-->The "Weights.ManipulatedVariables" property of "mpc" object is empty. Assuming default 0.00000.
-->The "Weights.ManipulatedVariablesRate" property of "mpc" object is empty. Assuming default 0.10000.
-->The "Weights.OutputVariables" property of "mpc" object is empty. Assuming default 1.00000.

Specify actuator saturation limits as MV constraints.

mpcobj.MV = struct('Min',-1,'Max',1);

Simulate Using Simulink®

To run this example, Simulink® is required.

if ~mpcchecktoolboxinstalled('simulink')
    disp('Simulink(R) is required to run this example.')
    return
end

Simulate closed-loop control of the linear plant model in Simulink. Controller "mpcobj" is specified in the block dialog.

mdl = 'mpc_doubleint';
open_system(mdl);
sim(mdl);
-->Converting the "Model.Plant" property of "mpc" object to state-space.
-->Converting model to discrete time.
-->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.

The closed-loop response shows good setpoint tracking performance.

bdclose(mdl)
Was this topic helpful?