x = importdata('ASFS_Test_ASFS_1min_1990_01_01_0000_2019_02_14_1807.dat');
dn = datenum(char(x.textdata(3:end,1)),'yyyy-mm-dd HH:MM:SS');
PTemp = x.data(:,2);
batt_volt = x.data(:,3);
counts_main = x.data(:,4);
call_time = x.data(:,8);
rh = x.data(:,27);
t = x.data(:,29);
efoy_fuel = x.data(:,end-1);
efoy_T = x.data(:,end-2);
efoy_load = x.data(:,end-3);
efoy_V = x.data(:,end-4);
efoy_ec = x.data(:,end);



%plot(dn,efoy_T,'linewidth',2); hold on;
plot(dn,PTemp,'linewidth',2); hold on;
plot(dn,t,'linewidth',2);
legend('PTemp','Vaisala (room)','location','northwest');
xlabel('Time [DDHH]');
ylabel('Temperature [C]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 14 18 0 0]):1/24:datenum([2019 2 15 9 0 0]));
xlim([datenum([2019 2 14 18 0 0]) datenum([2019 2 15 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng temps.png


yyaxis left
plot(dn,efoy_V,'linewidth',2); hold on;
ylabel('Battery Voltage [V]');
set(gca,'xtick',datenum([2019 2 13 18 0 0]):1/24:datenum([2019 2 14 9 0 0]));
set(gca,'fontname','times','fontsize',12);
ylim([20 30]);
yyaxis right
plot(dn,batt_volt,'linewidth',2);
xlabel('Time [DDHH]');
ylabel('Battery Voltage [V]');
title('ASFS CIRES Lab Test, Feb 13-14');
ylim([10 13]);
grid on;
set(gca,'xtick',datenum([2019 2 14 18 0 0]):1/24:datenum([2019 2 15 9 0 0]));
xlim([datenum([2019 2 14 18 0 0]) datenum([2019 2 15 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng volts.png



plot(efoy10_dn,efoy10_error_code,'linewidth',2); hold on;
plot(dn,efoy_ec,'linewidth',2);
legend('EFOY 10 min','EFOY 1 min','location','northwest');
xlabel('Time [DDHH]');
ylabel('Error Code');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 13 18 0 0]):1/24:datenum([2019 2 14 9 0 0]));
xlim([datenum([2019 2 13 18 0 0]) datenum([2019 2 14 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng efoy_error.png


plot(efoy10_dn,efoy10_fuel,'linewidth',2); hold on;
plot(dn,efoy_fuel,'linewidth',2);
legend('EFOY 10 min','EFOY 1 min','location','southwest');
xlabel('Time [DDHH]');
ylabel('Fuel Remaining [%]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on; ylim([0 100]);
set(gca,'ytick',0:5:100,'xtick',datenum([2019 2 13 18 0 0]):1/24:datenum([2019 2 14 9 0 0]));
xlim([datenum([2019 2 13 18 0 0]) datenum([2019 2 14 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng efoy_fuel.png



plot(dn,efoy_load,'linewidth',2);
xlabel('Time [DDHH]');
ylabel('EFOY Load [A]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 14 18 0 0]):1/24:datenum([2019 2 15 9 0 0]));
xlim([datenum([2019 2 14 18 0 0]) datenum([2019 2 15 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng efoy_load.png


plot(efoy10_dn,efoy10_load,'linewidth',2); hold on;
plot(dn,efoy_load,'linewidth',2);
legend('EFOY 10 min','EFOY 1 min','location','south');
xlabel('Time [HHMM]');
ylabel('EFOY Load [A]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 13 22 0 0]):5/1440:datenum([2019 2 13 23 0 0]));
xlim([datenum([2019 2 13 22 0 0]) datenum([2019 2 13 23 0 0])]);
datetick('x','hhMM','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng efoy_load_zoom.png



yyaxis left
plot(dn,rh,'linewidth',2); hold on; %ylim([0 100]);
ylabel('Room RH [%]');
set(gca,'ytick',0:1:100,'xtick',datenum([2019 2 13 18 0 0]):1/24:datenum([2019 2 14 9 0 0]));
set(gca,'fontname','times','fontsize',12);
yyaxis right
plot(dn,t,'linewidth',2); hold on;
ylabel('Room Temperature [%]');
xlabel('Time [DDHH]');
ylabel('Temperature [C]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 13 18 0 0]):1/24:datenum([2019 2 14 9 0 0]));
xlim([datenum([2019 2 13 18 0 0]) datenum([2019 2 14 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng room.png






%plot(dn,efoy_T,'linewidth',2); hold on;
plot(dn,call_time./1000,'.','linewidth',2); hold on;
xlabel('Time [DDHH]');
ylabel('Scan Time [s]');
title('ASFS CIRES Lab Test, Feb 13-14');
grid on;
set(gca,'xtick',datenum([2019 2 14 18 0 0]):1/24:datenum([2019 2 15 9 0 0]));
xlim([datenum([2019 2 14 18 0 0]) datenum([2019 2 15 9 0 0])]);
datetick('x','ddhh','keepticks','keeplimits');
set(gca,'fontname','times','fontsize',12);
set(gcf,'PaperPositionMode','manual');
set(gcf,'PaperUnits','centimeters');
set(gcf,'PaperPosition',[0 0 20 16]);      % 1 column, square
print -dpng scantime.png



x = importdata('ASFS_Test_ASFS_sumfile_1990_01_01_0000_2019_02_14_1810.dat');

efoy10_dn = datenum(char(x.textdata(5:end,1)),'yyyy-mm-dd HH:MM:SS');
efoy10_error_code = x.data(:,30);
efoy10_fuel = x.data(:,29)./10;
efoy10_T = x.data(:,28)./10;
efoy10_load = x.data(:,27)./10;
efoy10_V = x.data(:,26)./10;

