load('UncontrolledChargingHHincluded.mat')
UncontrolledChargingHHincluded = convertvars(UncontrolledChargingHHincluded, {'st_time', 'end_time'}, 'string');
st_time = UncontrolledChargingHHincluded.st_time;
end_time = UncontrolledChargingHHincluded.end_time;
value = UncontrolledChargingHHincluded.PevHH;
timediff = UncontrolledChargingHHincluded.tchmin;
singularvalue = value./timediff;
singularvalue(~isfinite(singularvalue)) = 0;
Tzeros_LSH = zeros(24*60+1,1);
traffic_DCH = zeros(24*60+1,1);
for i = 1:length(end_time)
[Y, M, D, H, MN, S] = datevec(st_time(i));
TrSt = H*60+MN+1;
[Y, M, D, H, MN, S] = datevec(end_time(i));
TrEn = H*60+MN+1;
if isnan(TrEn) || isnan(TrSt)
continue
else
Tzeros_DCH(TrSt:TrEn,1) = Tzeros_LSH(TrSt:TrEn,1) + 1;
traffic_DCH(TrSt:TrEn,1) = traffic_DCH(TrSt:TrEn,1) + singularvalue(i);
end
end
close all
TimeM = 1:length(Tzeros_LSH);
TimeH = TimeM/60;
figure
plot(TimeH,traffic_DCH)
xlim([1 24])
xlabel("Time (h)")
ylabel("Load (kW)")
grid on