
load('GenDCS1theta_')   %Baton DCS 1 theta tunings % results from SRC, resetting integrator

tgrid = 1:Ts:Tstop;
% set(0,'DefaultTextFontName','Times',...
% 'DefaultTextFontSize',18,...
% 'DefaultAxesFontName','Times',...
% 'DefaultAxesFontSize',18,...
% 'DefaultLineLineWidth',1,...
% % 'DefaultLineMarkerSize',7.75)
% 
set(0,'DefaultTextFontName','Times',...
'DefaultTextFontSize',24,...
'DefaultAxesFontName','Times',...
'DefaultAxesFontSize',20,...
'DefaultLineLineWidth',2.5,...
'DefaultLineMarkerSize',12)

%%
figure
subplot(3,1,1)
plot(GenDCS1theta_t,GenDCS1theta_Tamb,'Color',[0 0.5 0],'Linewidth',1.5)
hold on
%plot(tgrid, Tamb_MPC,'k--',  'Linewidth',1)
plot(GenDCS1theta_t,GenDCS1theta_Tsp,'k--')
title('Ambient temperature ($d = T^{amb}$)','Interpreter','latex')
ylabel('Temperature (°C)')
ylim([-5 35])
legend('$T^{amb}$','$T^{sp}$', 'Location','best','Orientation','vertical','Interpreter','latex','FontSize',18)
legend boxoff 

subplot(3,1,2)
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840],'Linewidth',1.5)
hold on
stairs(tgrid,T_MPC,'--', 'Color',[0    0.4470    0.7410],'Linewidth',1.5);
%plot(GenBackCalc_t,GenBackCalc_T,'--', 'Color',[0    0.4470    0.7410]);%[ 138/255,43/255,226/255])
plot(GenDCS1theta_t,GenDCS1theta_Tsp,'k--',  'Linewidth',1)
title('Room temperature ($y = T$)','Interpreter','latex')
ylabel('Temperature (°C)')
ylim([10 22])
legend('Generalized SRC','MPC', '$T^{sp}$', 'Location','Southeast','Orientation','vertical','Interpreter','latex','FontSize',18)
legend boxoff 

subplot(3,1,3)
plot(GenDCS1theta_t,GenDCS1theta_u1,'Color',[0.3010    0.7450    0.9330],'Linewidth',1.7)
hold on
plot(GenDCS1theta_t,GenDCS1theta_u2,'Color',[0    0.4470    0.7410],'Linewidth',1.7)
plot(GenDCS1theta_t,GenDCS1theta_u3,'Color', [0.9290    0.6940    0.1250],'Linewidth',1.7)
plot(GenDCS1theta_t,GenDCS1theta_u4,'r','Linewidth',1.7)

stairs(tgrid,u1_MPC,'--','Linewidth',1,'Color',[0.3010    0.7450    0.9330],'Linewidth',1.7)
stairs(tgrid,u2_MPC,'--','Linewidth',1,'Color',[0    0.4470    0.7410],'Linewidth',1.7)
stairs(tgrid,u3_MPC,'--','Linewidth',1,'Color', [0.9290    0.6940    0.1250],'Linewidth',1.7)
stairs(tgrid,u4_MPC,'r--','Linewidth',1,'Linewidth',1.7)
% plot(GenBackCalc_t,GenBackCalc_u1,'k--'); %,'Color',[0.3010    0.7450    0.9330])
% plot(GenBackCalc_t,GenBackCalc_u2,'k--'); %,'Color',[0    0.4470    0.7410])
% plot(GenBackCalc_t,GenBackCalc_u3,'k--'); %,'Color', [0.9290    0.6940    0.1250])
% plot(GenBackCalc_t,GenBackCalc_u4,'k--');

plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--', 'Linewidth',1)
plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--','Linewidth',1)
title('Manipulated variables','Interpreter','latex')
legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','south','Orientation','horizontal','Interpreter','latex')
legend boxoff 
ylabel('u_i (-)')
xlabel('Time (min)')
ylim([-0.5 1.2])
ytickformat('%.1f')
