% Part 1.1: Header
% Part 1.2: Plant model
% Part 1.3: Create step response model

% Part 2.1 Design a MPC, samll weight on control penalty
% Part 1.1: Header
Header;
% Part 2.1 Design a MPC, samll weight on control penalty
% ***********
% constraints
umin = -inf;  
umax =  inf;
%weights
ywt=1;
uwt=1;

% horizon
hM=5;  % input
hP=10; % prediction

% calculation of controller gains
Kmpc=mpccon(mod,ywt,uwt,hM,hP);
% simulation end time
tend=200;
% simulation
[y,u]=mpcsim(mod,mod,Kmpc,tend,1,[umin,umax,Inf]);
% Plot results
Figure_Name = 'MPC Tuning';
plot_simulation;




