%JoulesUsed.m

clear;

[p,bp,battv,batti,cpDateTimeNum,cpDate,cpTime]=parseEngData('raw\2016-3-24T2-7-3');

%integrate
joules(1)=0;
joules_no_hotel(1)=0;
for i=2:size(p,2)
    
    %seconds
    deltat=3600*(cpDateTimeNum(i)-cpDateTimeNum(i-1))*24;
    joules(i) = joules(i-1) + deltat*battv(i)*batti(i);
    joules_no_hotel(i) = joules_no_hotel(i-1) + deltat*battv(i)*(batti(i)-.2);
end

figure(5); hold on;

plot(cpDateTimeNum,joules,cpDateTimeNum,joules_no_hotel);