%Calibration Parameters.m
%Developed by Dr G.B.Murphy
%Generate Monthly Values for Environmental Temperature and Energy
%Consumption, plot figure to represent these values

% time ranges
jan = 1:(31*24*3600-ts)/ts;
feb = (31*24*3600)/ts:(59*24*3600-ts)/ts;
mar = (59*24*3600)/ts:(90*24*3600-ts)/ts;
apr = (90*24*3600)/ts:(120*24*3600-ts)/ts;
may = (120*24*3600)/ts:(151*24*3600-ts)/ts;
jun = (151*24*3600)/ts:(181*24*3600-ts)/ts;
jul = (181*24*3600)/ts:(212*24*3600-ts)/ts;
aug = (212*24*3600)/ts:(243*24*3600-ts)/ts;
sep = (243*24*3600)/ts:(273*24*3600-ts)/ts;
oct = (273*24*3600)/ts:(304*24*3600-ts)/ts;
nov = (304*24*3600)/ts:(334*24*3600-ts)/ts;
dec = (334*24*3600)/ts:(365*24*3600-ts)/ts;

% average monthly environmental temperature
Tjan = mean(y(jan))-273
Tfeb = mean(y(feb))-273
Tmar = mean(y(mar))-273
Tapr = mean(y(apr))-273
Tmay = mean(y(may))-273
Tjun = mean(y(jun))-273
Tjul = mean(y(jul))-273
Taug = mean(y(aug))-273
Tsep = mean(y(sep))-273
Toct = mean(y(oct))-273
Tnov = mean(y(nov))-273
Tdec = mean(y(dec))-273

%GBM - 03/09/2012; generate plot for monthly Temperatures
close all
x1 = 1:12;
y1 = [Tjan Tfeb Tmar Tapr Tmay Tjun Tjul Taug Tsep Toct Tnov Tdec];
%plot(x,y,'r*')
fullscreen = get(0,'ScreenSize');
fig = figure('Position',[50 (fullscreen(4)/2)-100 (fullscreen(3)-100) fullscreen(4)/2]);
%bottom left / height
subplot(1, 2, 1)
bar(x1,y1)
axis([0 13 15 23])
xlabel('Month')
ylabel('Temperature C')
title('Monthly IDEAS Temperature')



Tmonthly = [Tjan;Tfeb;Tmar;Tapr;Tmay;Tjun;Tjul;Taug;Tsep;Toct;Tnov;Tdec];

% average year temperature
Teia = mean(y);

% energy use per month (kWh)
Ejan = sum(u(jan))*(ts/3.6e+6)
Efeb = sum(u(feb))*(ts/3.6e+6)
Emar = sum(u(mar))*(ts/3.6e+6)
Eapr = sum(u(apr))*(ts/3.6e+6)
Emay = sum(u(may))*(ts/3.6e+6)
Ejun = sum(u(jun))*(ts/3.6e+6)
Ejul = sum(u(jul))*(ts/3.6e+6)
Eaug = sum(u(aug))*(ts/3.6e+6)
Esep = sum(u(sep))*(ts/3.6e+6)
Eoct = sum(u(oct))*(ts/3.6e+6)
Enov = sum(u(nov))*(ts/3.6e+6)
Edec = sum(u(dec))*(ts/3.6e+6)

%GBM - 03/09/2012; generate plot for monthly Energy
x2 = 1:12;
y2 = [Ejan Efeb Emar Eapr Emay Ejun Ejul Eaug Esep Eoct Enov Edec];
%plot(x,y,'r*')
%plot(x2,y2)
subplot(1, 2, 2) %rows colums plot number
bar(x2,y2)
axis([0 13 0 3500]) %x then y
xlabel('Month')
ylabel('Energy kWh')
title('Monthly IDEAS Energy Consumption')

Emonthly = [Ejan;Efeb;Emar;Eapr;Emay;Ejun;Ejul;Eaug;Esep;Eoct;Enov;Edec];