В этом примере показано, как спроектировать прогнозирующий контроллер модели для установки с двумя входами и одним выходом с целевой уставкой для управляемой переменной.
Линейная модель установки имеет два входа и два выхода.
N1 = [3 1];
D1 = [1 2*.3 1];
N2 = [2 1];
D2 = [1 2*.5 1];
plant = ss(tf({N1,N2},{D1,D2}));
A = plant.A;
B = plant.B;
C = plant.C;
D = plant.D;
x0 = [0 0 0 0]';
Создание контроллера MPC.
Ts = 0.4; % Sample time
mpcobj = mpc(plant,Ts,20,5);
-->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.
Укажите веса.
mpcobj.weights.manipulated = [0.3 0]; % weight difference MV#1 - Target#1
mpcobj.weights.manipulatedrate = [0 0];
mpcobj.weights.output = 1;
Определение входных спецификаций.
mpcobj.MV = struct('RateMin',{-0.5;-0.5},'RateMax',{0.5;0.5});
Указать целевую уставку u = 2 для первой управляемой переменной.
mpcobj.MV(1).Target=2;
Для выполнения этого примера необходимо приложение Simulink ®.
if ~mpcchecktoolboxinstalled('simulink') disp('Simulink(R) is required to run this example.') return end
Смоделировать.
mdl = 'mpc_utarget'; open_system(mdl) % Open Simulink(R) Model sim(mdl); % Start Simulation
-->Converting model to discrete time. -->Assuming output disturbance added to measured output channel #1 is integrated white noise. -->The "Model.Noise" property of the "mpc" object is empty. Assuming white noise on each measured output channel.



bdclose(mdl)