% INIT_MPC2.M %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Initialize single layer MPC made by use of MPC Toolbox

init;

load('mat-files/predmod_mpc2');

Model.Plant = linearsysforMPC;
Model.Noise = linearsysforMPC_noise;

Weights.MV = zeros(1,4);
Weights.MVRate = ones(1,4);
Weights.OV = [ones(1,4), zeros(1,3)];
Weights.ECR = 1e5;

MV = [
    struct('Min',-0.2572,'Max',0.7428,'RateMin',-10,'RateMax',10)
    struct('Min',-2.8492,'Max',0.1508,'RateMin',-10,'RateMax',10)
    struct('Min',-0.2494,'Max',0.7506,'RateMin',-10,'RateMax',10)
    struct('Min',-0.2497,'Max',0.7503,'RateMin',-10,'RateMax',10)
    ];

MPCobj = mpc(Model,10,50,50,Weights,MV,[],[]);

clear Model Weights MV

mpc.on = 1;

if (mpc.on)
    disp('### MPC ON ###');
else
    disp('### MPC OFF ###');
end
