close all

%% Plot
plot_settings

Line_thick = 1.1
Font = 14;
time = linspace(1,size(xSim,2),size(xSim,2));
figure()
subplot(5,1,1)
stairs(time,uSim(1,:),'LineWidth',Line_thick)
%legend('$Q_{WD}$')
axis([0 N 0 300])
%xlabel('Time period, $t$')
ylabel('$Q^{WD}$ [MWh]','FontSize',Font)
set(gca,'FontSize',Font)

subplot(5,1,2)
stairs(time,uSim(2,:),'LineWidth',Line_thick)
%legend('$Q_{GD}$')
axis([0 N 0 300])
%xlabel('Time period, $t$')
ylabel('$Q^{GD}$ [MWh]','FontSize',Font)
set(gca,'FontSize',Font)


subplot(5,1,3)
stairs(time,uSim(3,:),'LineWidth',Line_thick)
%legend('$Q_{GD}$')
axis([0 N 0 300])
%xlabel('Time period, $t$')
ylabel('$Q^{SD}$ [MWh]','FontSize',Font)
set(gca,'FontSize',Font)

subplot(5,1,4)
stairs(time,uSim(4,:),'LineWidth',Line_thick)
%legend('$Q_{WS}$')
axis([0 N 0 300])
%xlabel('Time period, $t$')
ylabel('$Q^{WS}$ [MWh]','FontSize',Font)
set(gca,'FontSize',Font)

subplot(5,1,5)
stairs(time,uSim(5,:),'LineWidth',Line_thick)
%legend('$Q_{GS}$')
axis([0 N 0 300])
xlabel('Time period, $t$','FontSize',Font)
ylabel('$Q^{GS}$ [MWh]','FontSize',Font)
set(gca,'FontSize',Font)

%% Level - screen wide
time = linspace(1,size(xSim,2),size(xSim,2));
Font = 30;
figure()
stairs(time,xSim(1,:),'LineWidth',1.5)
%legend('$Q_{GS}$')
axis([0 N 0 S0.R_max])
ylabel('Energy amount in Storage, $S_t$ [MWh]','FontSize',Font)
xlabel('Time period, $t$','FontSize',Font)
set(gca,'FontSize',Font)

%% Level compare - theta_D

load('P03_CFA_D07.mat')


time = linspace(1,size(xSim,2),size(xSim,2));
Font = 33;
figure()
stairs(time,xSim(1,:),'LineWidth',1.5)
hold on
load('P03_CFA_D10.mat')
stairs(time,xSim(1,:),'LineWidth',1.5)
hold on
load('P03_CFA_D13.mat')
stairs(time,xSim(1,:),'LineWidth',1.5)
%legend('$Q_{GS}$')
axis([0 300 0 500])
ylabel('Energy amount in Storage, $S_t$ [MWh]','FontSize',Font)
xlabel('Time period, $t$','FontSize',Font)
set(gca,'FontSize',Font)
legend('$\theta_D$ = 0.7','$\theta_D$ = 1.0','$\theta_D$ = 1.3')

%% Presentation

Total_3 = uSim(1,:) + uSim(2,:) + uSim(3,:);
Total_2 = uSim(2,:) + uSim(3,:);
Total_1 = uSim(2,:);

figure()
bar(time, Total_3)
hold on
bar(time, Total_2)
hold on
bar(time, Total_1)
legend('$Q^{WD}$','$Q^{SD}$','$Q^{GD}$')
axis([0 N 0 300])

xlabel('Time period, $t$')
ylabel('Energy supplied for Demand [MWh]')
toc