## Documentation |

This example shows how to simulate a model predictive controller under a mismatch between the predictive plant model and the actual plant.

The predictive plant model has 2 manipulated variables, 2 unmeasured input disturbances, and 2 measured outputs. The actual plant has different dynamics.

On this page… |
---|

Define the parameters of the nominal plant which the MPC controller is based on. Systems from MV to MO and UD to MO are identical.

p1 = tf(1,[1 2 1])*[1 1; 0 1]; plant = ss([p1 p1],'min'); plant.InputName = {'mv1','mv2','ud3','ud4'};

Define inputs 1 and 2 as manipulated variables, 3 and 4 as unmeasured disturbances.

plant = setmpcsignals(plant,'MV',[1 2],'UD',[3 4]); % Create the controller object with sampling period, prediction and control % horizons: mpcobj = mpc(plant,1,40,2);

-->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.

For unmeasured input disturbances, the MPC controller will use the following unmeasured disturbance model.

distModel = eye(2,2)*ss(-.5,1,1,0); mpcobj.Model.Disturbance = distModel;

**Define the Real Plant Model Used in Simulation**

Define the parameters of the actual plant in closed loop with the MPC controller.

p2 = tf(1.5,[0.1 1 2 1])*[1 1; 0 1]; psim = ss([p2 p2],'min'); psim = setmpcsignals(psim,'MV',[1 2],'UD',[3 4]);

**Simulate Closed-Loop Response Using the SIM Command**

Define reference trajectories and unmeasured disturbances entering the actual plant.

dist = ones(1,2); % unmeasured disturbance signal refs = [1 2]; % output reference signal Tf = 20; % total number of simulation steps

Create an MPC simulation object.

options = mpcsimopt(mpcobj); options.unmeas = dist; % unmeasured disturbance signal options.model = psim; % real plant model

Run the closed-loop MPC simulation with model mismatch and unforeseen unmeasured disturbance inputs.

sim(mpcobj,Tf,refs,options);

-->Converting model to discrete time. -->Integrated white noise added on measured output channel #1. -->Integrated white noise added on measured output channel #2. -->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel. -->Converting model to discrete time.

The closed loop tracking performance is acceptable with the presence of unmeasured disturbances.

Was this topic helpful?