close all
clear all
clc

%https://se.mathworks.com/help/matlab/graphics_transition/why-are-plot-lines-different-colors.html

set(0,'DefaultTextFontName','Times',...
'DefaultTextFontSize',24,...
'DefaultAxesFontName','Times',...
'DefaultAxesFontSize',20,...
'DefaultLineLineWidth',2.5,...
'DefaultLineMarkerSize',12)



load('GenDCS1theta_')   %Baton DCS 1 theta tunings
load('STDdel1theta_')  % Std delay 1 theta to compare
load('GenDCSimp_')   %Baton DCS tuning for EH changed
load('GenBackCalc_')  %Generalized, back calculation
%%
figure
subplot(3,1,1)
plot(GenDCS1theta_t,GenDCS1theta_Tamb,'Color',[0 0.5 0])
hold on
plot(GenDCS1theta_t,GenDCS1theta_Tsp,'k--')
title('Ambient temperature ($d = T^{amb}$)','Interpreter','latex')
ylabel('Temperature (°C)')
ylim([-5 35])
%legend('$T^{amb}$', 'Location','best','Orientation','horizontal','Interpreter','latex')
%legend boxoff 

subplot(3,1,2)
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
hold on
plot(STDdel_t,STDdel_Troom,'--', 'Color',[0.4660    0.6740    0.1880]);%[ 138/255,43/255,226/255])
%plot(GenBackCalc_t,GenBackCalc_T,'.-'); %, 'Color',[0.4660    0.6740    0.1880]);%[ 138/255,43/255,226/255])
plot(GenDCS1theta_t,GenDCS1theta_Tsp,'k--')
title('Room temperature ($y = T$)','Interpreter','latex')
ylabel('Temperature (°C)')
ylim([5 25])
legend('Generalized','Standard', '$T^{sp}$', 'Location','Southeast','Orientation','horizontal','Interpreter','latex','FontSize',18)
legend boxoff 

subplot(3,1,3)
plot(GenDCS1theta_t,GenDCS1theta_u1,'Color',[0    0.4470    0.7410])
hold on
plot(GenDCS1theta_t,GenDCS1theta_u2,'Color',[0.3010    0.7450    0.9330])
plot(GenDCS1theta_t,GenDCS1theta_u3,'Color', [0.9290    0.6940    0.1250])
plot(GenDCS1theta_t,GenDCS1theta_u4,'r')
plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--')
plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--')
%Suggested
% plot(t,deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(t,deltav2,'--','Color',[0    0.4470    0.7410])
% plot(t,deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(t,deltav4,'r--')
title('Manipulated variables ($u_i$)','Interpreter','latex')
legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','Southeast','Orientation','horizontal','Interpreter','latex')
legend boxoff 
ylabel('u_i (-)')
xlabel('Time (min)')
ylim([-0.5 1.2])
ytickformat('%.2f')

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

subplot(3,1,2)
plot(STDdel_t,STDdel_Troom,'-.', 'Color',[0.4660    0.6740    0.1880]);%[ 138/255,43/255,226/255])
hold on
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
plot(GenDCSimp_t,GenDCSimp_T,'--', 'Color',[0.9290    0.6940    0.1250]);
%plot(GenBackCalc_t,GenBackCalc_T,'.-'); %, 'Color',[0.4660    0.6740    0.1880]);%[ 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([5 25])
legend('Standard','Generalized, $\tau_{c,i}=\theta_{i}$','Generalized, $\tau_{c,_{EH}}=3\theta_{EH}$',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 

subplot(3,1,3)
plot(GenDCS1theta_t,GenDCS1theta_u1,'Color',[0    0.4470    0.7410])
hold on
plot(GenDCS1theta_t,GenDCS1theta_u2,'Color',[0.3010    0.7450    0.9330])
plot(GenDCS1theta_t,GenDCS1theta_u3,'Color', [0.9290    0.6940    0.1250])
plot(GenDCS1theta_t,GenDCS1theta_u4,'r')
plot(GenDCSimp_t,GenDCSimp_u4,'--', 'Color', [233/255 150/255 122/255])
plot(GenDCSimp_t,GenDCSimp_u3,'--','Color', [204/255 204/255 0/255])
plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--','Linewidth',1)
plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--','Linewidth',1)
%Suggested
% plot(t,deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(t,deltav2,'--','Color',[0    0.4470    0.7410])
% plot(t,deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(t,deltav4,'r--')
title('Manipulated variables ($u_i$)','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('%.2f')

%% figure

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

subplot(2,1,2)
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
hold on
plot(GenDCSimp_t,GenDCSimp_T,'--', 'Color',[0.9290    0.6940    0.1250]);
plot(GenBackCalc_t,GenBackCalc_T,'-.', 'Color',[    0    0.7500    0.7500]);%[ 138/255,43/255,226/255])
%plot(STDdel_t,STDdel_Troom,'--', 'Color',[0.4660    0.6740    0.1880],'Linewidth',1);%[ 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([11 22])
%legend('Generalized, $\tau_{c,i}=\theta_{i}$','Generalized, $\tau_{c,_{EH}}=3\theta_{EH}$', 'Generalized w/tracking','Standard',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend('$\tau_{c,i}=\theta_{i}$','$\tau_{c,_{EH}}=3\theta_{EH}$', 'back-calculation',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 
xlabel('Time (min)')

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

subplot(3,1,2)
%plot(STDdel_t,STDdel_Troom,'-.', 'Color',[0.4660    0.6740    0.1880]);%[ 138/255,43/255,226/255])
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
hold on
%plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
plot(GenDCSimp_t,GenDCSimp_T,'-.', 'Color',[0.9290    0.6940    0.1250]);
%plot(GenBackCalc_t,GenBackCalc_T,'.-'); %, 'Color',[0.4660    0.6740    0.1880]);%[ 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([11 23])
legend('$\tau_{c,i}=\theta_{i}$','$\tau_{c,_{EH}}=3\theta_{EH}$',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 

subplot(3,1,3)
plot(GenDCS1theta_t,GenDCS1theta_u1,'Color',[0    0.4470    0.7410])
hold on
plot(GenDCS1theta_t,GenDCS1theta_u2,'Color',[0.3010    0.7450    0.9330])
plot(GenDCS1theta_t,GenDCS1theta_u3,'Color', [0.9290    0.6940    0.1250],'Linewidth',1.5)
plot(GenDCS1theta_t,GenDCS1theta_u4,'r','Linewidth',1.5)
plot(GenDCSimp_t,GenDCSimp_u3,'--','Color',[0.4660    0.6740    0.1880]);% [204/255 204/255 0/255])
plot(GenDCSimp_t,GenDCSimp_u4,'--', 'Color',[0.7500         0    0.7500]);% [233/255 150/255 122/255])
plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--','Linewidth',1)
plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--','Linewidth',1)
%Suggested
% plot(t,deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(t,deltav2,'--','Color',[0    0.4470    0.7410])
% plot(t,deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(t,deltav4,'r--')
title('Manipulated variables ($u_i$)','Interpreter','latex')
legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','South','Orientation','horizontal','Interpreter','latex','FontSize',15)
legend boxoff 
legend boxoff 
ylabel('u_i (-)')
xlabel('Time (min)')
ylim([-0.5 1.2])
ytickformat('%.2f')
%%
figure
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
hold on
plot(GenDCSimp_t,GenDCSimp_T,'--', 'Color',[0.9290    0.6940    0.1250]);
plot(GenBackCalc_t,GenBackCalc_T,'-.', 'Color',[    0    0.7500    0.7500]);%[ 138/255,43/255,226/255])
%plot(STDdel_t,STDdel_Troom,'--', 'Color',[0.4660    0.6740    0.1880],'Linewidth',1);%[ 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([11 22])
%legend('Generalized, $\tau_{c,i}=\theta_{i}$','Generalized, $\tau_{c,_{EH}}=3\theta_{EH}$', 'Generalized w/tracking','Standard',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend('$\tau_{c,i}=\theta_{i}$','$\tau_{c,_{EH}}=3\theta_{EH}$', 'back-calculation',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 
xlabel('Time (min)')

%%
figure
plot(GenDCS1theta_t,GenDCS1theta_T,'Color',[ 0.6350    0.0780    0.1840])
hold on
%plot(GenDCSimp_t,GenDCSimp_T,'--', 'Color',[0.9290    0.6940    0.1250]);
plot(GenBackCalc_t,GenBackCalc_T,'-.', 'Color',[    0    0.7500    0.7500]);%[ 138/255,43/255,226/255])
%plot(STDdel_t,STDdel_Troom,'--', 'Color',[0.4660    0.6740    0.1880],'Linewidth',1);%[ 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([11 22])
%legend('Generalized, $\tau_{c,i}=\theta_{i}$','Generalized, $\tau_{c,_{EH}}=3\theta_{EH}$', 'Generalized w/tracking','Standard',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend('$\tau_{c,i}=\theta_{i}$', 'back-calculation',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 
xlabel('Time (min)')

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

subplot(3,1,2)
plot(GenBackCalc_t,GenBackCalc_T); %,'-.', 'Color',[    0    0.7500    0.7500]);%[ 138/255,43/255,226/255])

hold on
%plot(GenDCSimp_t,GenDCSimp_T,'--', 'Color',[0.9290    0.6940    0.1250]);
plot(GenDCS1theta_t,GenDCS1theta_T,'--','Color',[0.4 0.4 0.4])%'Color',[ 0.6350    0.0780    0.1840])
%plot(STDdel_t,STDdel_Troom,'--', 'Color',[0.4660    0.6740    0.1880],'Linewidth',1);%[ 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([11 22])
%legend('Generalized, $\tau_{c,i}=\theta_{i}$','Generalized, $\tau_{c,_{EH}}=3\theta_{EH}$', 'Generalized w/tracking','Standard',  'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend('Back-calculation','Resetting integrator',   'Location','Southwest','Orientation','vertical','Interpreter','latex','FontSize',15)
legend boxoff 
%xlabel('Time (min)')

subplot(3,1,3)
plot(GenBackCalc_t,GenBackCalc_u1,'Color',[0    0.4470    0.7410])
hold on
plot(GenBackCalc_t,GenBackCalc_u2,'Color',[0.3010    0.7450    0.9330])
plot(GenBackCalc_t,GenBackCalc_u3,'Color', [0.9290    0.6940    0.1250])
plot(GenBackCalc_t,GenBackCalc_u4,'r')

plot(GenDCS1theta_t,GenDCS1theta_u1,'--','Color',[0.2 0.2 0.2]);% [204/255 204/255 0/255])
plot(GenDCS1theta_t,GenDCS1theta_u2,'--', 'Color',[0.4 0.4 0.4]);% [233/255 150/255 122/255])
plot(GenDCS1theta_t,GenDCS1theta_u3,'--','Color',[204/255 204/255 0/255]);% [204/255 204/255 0/255])
plot(GenDCS1theta_t,GenDCS1theta_u4,'--', 'Color',[255/255 69/255 0/255]);% [233/255 150/255 122/255])
plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--','Linewidth',1)
plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--','Linewidth',1)

title('Manipulated variables ($u_i$)','Interpreter','latex')
legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','South','Orientation','horizontal','Interpreter','latex','FontSize',15)
legend boxoff 
legend boxoff 
ylabel('u_i (-)')
xlabel('Time (min)')
ylim([-0.5 1.2])
ytickformat('%.2f')

% subplot(3,1,3)
% plot(GenDCS1theta_t,GenDCS1theta_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(GenDCS1theta_t,GenDCS1theta_u2,'Color',[0    0.4470    0.7410])
% plot(GenDCS1theta_t,GenDCS1theta_u3,'Color', [0.9290    0.6940    0.1250])
% plot(GenDCS1theta_t,GenDCS1theta_u4,'r')
% plot(GenDCS1theta_t,GenDCS1theta_maxsatplot,'k--')
% plot(GenDCS1theta_t,GenDCS1theta_errorplot,'k--')
% %Suggested
% plot(t,deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(t,deltav2,'--','Color',[0    0.4470    0.7410])
% plot(t,deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(t,deltav4,'r--')
% title('Manipulated variables ($u_i$)','Interpreter','latex')
% legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','Southeast','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% ylabel('u_i (-)')
% xlabel('Time (min)')
% ylim([-0.5 1.2])
% ytickformat('%.2f')

% %%
% uminn=-1;
% umaxx=1.2;
% figure
% subplot(4,1,1)
% plot(Gen_t,Gen_T,'Color', [0.4940    0.1840    0.5560]);
% hold on
% plot(STD_t,STD_Troom,'--','Color', [0.8500    0.3250    0.0980]);
% plot(Gen_t,Gen_Tsp,'k')
% %title('Changes in ambient temperature')
% plot(Gen_t,Gen_Tamb,'Color',[0.4660    0.6740    0.1880])
% ylabel('T (°C)')
% legend('Generalized','Standard','T^{sp}','T^{amb}'); %, 'Location','South','Orientation','horizontal')
% ylim([-10 40])
% legend boxoff 
% 
% subplot(4,1,2)
% plot(STD_t,STD_v1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(STD_t,STD_v2,'Color',[0    0.4470    0.7410])
% plot(STD_t,STD_v3,'Color', [0.9290    0.6940    0.1250])
% plot(STD_t,STD_v4,'r')
% title('Standard structure')
% ylabel('u_i (-)')
% ylim([uminn umaxx])
% legend('AC','CW','HW', 'EH','Location','best','Orientation','horizontal')
% legend boxoff 
% 
% subplot(4,1,3)
% plot(Gen_t,Gen_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(Gen_t,Gen_u2,'Color',[0    0.4470    0.7410])
% plot(Gen_t,Gen_u3,'Color', [0.9290    0.6940    0.1250])
% plot(Gen_t,Gen_u4,'r')
% title('Generalized structure')
% ylabel('u_i (-)')
% ylim([uminn umaxx])
% legend('AC','CW','HW', 'EH','Location','best','Orientation','horizontal')
% legend boxoff 
% 
% subplot(4,1,4)
% h1=plot(Gen_t,Gen_deltav1,'Color',[0.3010    0.7450    0.9330])
% hold on
% h2=plot(Gen_t,Gen_deltav2,'Color',[0    0.4470    0.7410])
% h3=plot(Gen_t,Gen_deltav3,'Color', [0.9290    0.6940    0.1250])
% h4=plot(Gen_t,Gen_deltav4,'r')
% plot(Gen_t,Gen_maxsatplot,'k--')
% plot(Gen_t,Gen_errorplot,'k--')
% legend([h1,h2,h3,h4],'AC','CW','HW', 'EH','','','Location','South','Orientation','horizontal')
% 
% legend boxoff 
% ylabel('u_i^{''} (-)')
% ylim([-2 2])
% xlabel('Time (s)')
% title ('Suggested values in generalized structure')
% 
% %%
% uminn=-1;
% umaxx=1.2;
% figure
% subplot(3,1,1)
% h1= plot(Gen_t,Gen_T,'Color', [0.7500         0    0.7500]);
% hold on
% h2= plot(STD_t,STD_Troom,'--','Color', [  0    0.7500    0.7500]);
% h3= plot(Gen_t,Gen_Tsp,'k--')
% %title('Changes in ambient temperature')
% h4= plot(Gen_t,Gen_Tamb,'Color',[0.4660    0.6740    0.1880])
% ylabel('T (°C)')
% legend([h1,h2],'Generalized','Standard','T^{sp}','T^{amb}'); %, 'Location','South','Orientation','horizontal')
% ylim([-8 30])
% title('Comparison with standard SRC ')
% legend boxoff 
% 
% 
% subplot(3,1,2)
% plot(Gen_t,Gen_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(Gen_t,Gen_u2,'Color',[0    0.4470    0.7410])
% plot(Gen_t,Gen_u3,'Color', [0.9290    0.6940    0.1250])
% plot(Gen_t,Gen_u4,'r')
% title('Actual u_i')
% ylabel('u_i (-)')
% ylim([uminn umaxx])
% legend('AC','CW','HW', 'EH','Location','best','Orientation','horizontal')
% legend boxoff 
% 
% subplot(3,1,3)
% h1=plot(Gen_t,Gen_deltav1,'Color',[0.3010    0.7450    0.9330])
% hold on
% h2=plot(Gen_t,Gen_deltav2,'Color',[0    0.4470    0.7410])
% h3=plot(Gen_t,Gen_deltav3,'Color', [0.9290    0.6940    0.1250])
% h4=plot(Gen_t,Gen_deltav4,'r')
% plot(Gen_t,Gen_maxsatplot,'k--')
% plot(Gen_t,Gen_errorplot,'k--')
% legend([h1,h2,h3,h4],'AC','CW','HW', 'EH','','','Location','South','Orientation','horizontal')
% 
% legend boxoff 
% ylabel('u_i^{''} (-)')
% ylim([-2 2])
% xlabel('Time (min)')
% title ('Suggested u_i^{''}')

% %%
% figure
% subplot(3,1,1)
% plot(GenOK_t,GenOK_Tamb,'Color',[0 0.5 0])
% hold on
% plot(GenOK_t,GenOK_Tsp,'k--')
% title('$d = T^{amb}$','Interpreter','latex')
% legend('$T^{amb}$', '$T_0^{amb}$','Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% ylabel('Temperature (°C)')
% 
% subplot(3,1,2)
% plot(GenOK_t,GenOK_T,'r');
% hold on
% plot(Genbat_t, Genbat_T)
% plot(STD_t,STD_Troom,'--','Color', [ 0.4660    0.6740    0.1880]);
% plot(GenOK_t,GenOK_Tsp,'k--')
% title('$y = T$','Interpreter','latex')
% legend('Previous','Baton','Standard','$T^{sp}$', 'Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% ylabel('Temperature (°C)')
% 
% subplot(3,1,3)
% plot(GenOK_t,GenOK_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(GenOK_t,GenOK_u2,'Color',[0    0.4470    0.7410])
% plot(GenOK_t,GenOK_u3,'Color', [0.9290    0.6940    0.1250])
% plot(GenOK_t,GenOK_u4,'r')
% plot(GenOK_t,GenOK_maxsatplot,'k--')
% plot(GenOK_t,GenOK_errorplot,'k--')
% %Suggested
% plot(GenOK_t,GenOK_deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(GenOK_t,GenOK_deltav2,'--','Color',[0    0.4470    0.7410])
% plot(GenOK_t,GenOK_deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(GenOK_t,GenOK_deltav4,'r--')
% title('$u_i$ and $u_i''$','Interpreter','latex')
% legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% xlabel('Time (s)')
% ylabel('u_i (-)')
% ytickformat('%.2f')
% ylim([-0.5 1.3])
% 
% %%
% figure
% subplot(2,1,1)
% plot(GenOK_t,GenOK_Tamb,'Color',[0 0.5 0])
% hold on
% plot(GenOK_t,GenOK_Tsp,'k--')
% title('$d = T^{amb}$','Interpreter','latex')
% legend('$T^{amb}$', '$T_0^{amb}$','Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% ylabel('Temperature (°C)')
% 
% subplot(2,1,2)
% plot(GenOK_t,GenOK_T,'r');
% hold on
% plot(Genbat_t, Genbat_T)
% plot(Genbatf_t, Genbatf_T)
% plot(STD_t,STD_Troom,'--','Color', [ 0.4660    0.6740    0.1880]);
% plot(GenOK_t,GenOK_Tsp,'k--')
% title('$y = T$','Interpreter','latex')
% legend('Previous','Baton','Baton fast', 'Standard','$T^{sp}$', 'Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% ylabel('Temperature (°C)')
% 
% figure
% subplot(3,1,1)
% plot(GenOK_t,GenOK_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(GenOK_t,GenOK_u2,'Color',[0    0.4470    0.7410])
% plot(GenOK_t,GenOK_u3,'Color', [0.9290    0.6940    0.1250])
% plot(GenOK_t,GenOK_u4,'r')
% plot(GenOK_t,GenOK_maxsatplot,'k--')
% plot(GenOK_t,GenOK_errorplot,'k--')
% %Suggested
% plot(GenOK_t,GenOK_deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(GenOK_t,GenOK_deltav2,'--','Color',[0    0.4470    0.7410])
% plot(GenOK_t,GenOK_deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(GenOK_t,GenOK_deltav4,'r--')
% title('$u_i$ and $u_i''$ previous strategy','Interpreter','latex')
% legend('$u_{AC}$','$u_{CW}$','$u_{HW}$', '$u_{EH}$','Location','best','Orientation','horizontal','Interpreter','latex')
% legend boxoff 
% xlabel('Time (s)')
% ylabel('u_i (-)')
% ytickformat('%.2f')
% ylim([-0.5 1.3])
% 
% subplot(3,1,2)
% plot(Genbat_t,Genbat_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(Genbat_t,Genbat_u2,'Color',[0    0.4470    0.7410])
% plot(Genbat_t,Genbat_u3,'Color', [0.9290    0.6940    0.1250])
% plot(Genbat_t,Genbat_u4,'r')
% plot(Genbat_t,Genbat_maxsatplot,'k--')
% plot(Genbat_t,Genbat_errorplot,'k--')
% %Suggested
% plot(Genbat_t,Genbat_deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(Genbat_t,Genbat_deltav2,'--','Color',[0    0.4470    0.7410])
% plot(Genbat_t,Genbat_deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(Genbat_t,Genbat_deltav4,'r--')
% title('$u_i$ and $u_i''$ baton strategy- same tuning','Interpreter','latex')
% legend('AC','CW','HW', 'EH','Location','best','Orientation','horizontal')
% legend boxoff 
% 
% subplot(3,1,3)
% plot(Genbatf_t,Genbatf_u1,'Color',[0.3010    0.7450    0.9330])
% hold on
% plot(Genbatf_t,Genbatf_u2,'Color',[0    0.4470    0.7410])
% plot(Genbatf_t,Genbatf_u3,'Color', [0.9290    0.6940    0.1250])
% plot(Genbatf_t,Genbatf_u4,'r')
% plot(Genbatf_t,Genbatf_maxsatplot,'k--')
% plot(Genbatf_t,Genbatf_errorplot,'k--')
% %Suggested
% plot(Genbatf_t,Genbatf_deltav1,'--','Color',[0.3010    0.7450    0.9330])
% plot(Genbatf_t,Genbatf_deltav2,'--','Color',[0    0.4470    0.7410])
% plot(Genbatf_t,Genbatf_deltav3,'--','Color', [0.9290    0.6940    0.1250])
% plot(Genbatf_t,Genbatf_deltav4,'r--')
% title('$u_i$ and $u_i''$ baton strategy- very fast tunings','Interpreter','latex')
% legend('AC','CW','HW', 'EH','Location','best','Orientation','horizontal')
% legend boxoff 