This example shows how to control a double integrator plant under input saturation in Simulink®.
The linear open-loop dynamic model is a double integrator.
plant = tf(1,[1 0 0]);
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);
To run this example, Simulink is required.
if ~mpcchecktoolboxinstalled('simulink') disp('Simulink is required to run this example.') return end
Simulate closed-loop control of the linear plant model in Simulink. The MPC Controller block is configured to use the
mpcobj object as its controller.
mdl = 'mpc_doubleint'; open_system(mdl) sim(mdl)
-->Converting the "Model.Plant" property of "mpc" object to state-space. -->Converting model to discrete time. Assuming no disturbance added to measured output channel #1. -->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.