%Statistics EV information table in home charging mode
function [] = printHomeEV(EV)
init;%Get global variables
f = figure;%Generate graph window
% sgtitle('Home Charging Mode EV Information');%Illustration Title
set(gcf,'position',[250 100 1000 600]);%Set the figure window size
%Plot the histogram of frequency distribution of EV arrival time counted at 15 minutes intervals
subplot(2,3,1);
N = zeros(96,1);
C = tabulate(EV.J_c(:));%Stat for each element
N(C(:,1))=N(C(:,1))+C(:,2);
bar(1-0.5:1:96-0.5,N,1);%Drawing
title('EV access time slot frequency histogram');%Image Title
xlabel('Arrival time slots');%x-axis unit
ylabel('frequency '); %y axis unit
set(gca,'xtick',0:12:96); %x axis scale
%Draw the frequency distribution histogram of the EV arrival time counted at 1 hour intervals, and superimpose the probability density function of the home charging mode
subplot(2,3,2);
N = histcounts(EV.t_c,0:1:24);% is counted in one hour interval and assigned to N
bar(0.5:1:23.5,N/sum(N),1);%Display histogram
hold on;
%Draw the probability density function of the home charging mode
x = [0.001:0.001:24];%Sampling Density
y = normpdf(x,mu_1tc,sigma_1tc).*( mu_1tc-12<x & x<=24 )+...
normpdf(x+24,mu_1tc,sigma_1tc).*( 0<x & x<=mu_1tc-12 );%Probability density function described in the paper
plot(x,y,'LineWidth',2,'Color','red');%Draw thick red lines
title('EV access time frequency histogram');%Image Title
xlabel('Arrival time (h)');%x-axis unit
ylabel('probability'); %y axis unit
%set(gca,'xtick',0:1:24); %x-axis scale
legend('Collected Data','PDF');%Add legend
legend('Location','northwest');% legend is placed in the upper left corner
%Plot the histogram of frequency distribution of EV exit time counted at 15 minutes intervals
subplot(2,3,4);
N = zeros(96,1);
C = tabulate(EV.J_dis(:));%Stat for each element
N(C(:,1))=N(C(:,1))+C(:,2);
bar(1-0.5:1:96-0.5,N,1);%Drawing
title('EV leaving time slot frequency histogram');%Image Title
xlabel('Departure time slots');%x-axis unit
ylabel('frequency '); %y axis unit
set(gca,'xtick',0:12:96); %x axis scale
%set(gca,'position',[0.05,0.08,0.30,0.37]);
%Draw the frequency distribution histogram of the EV departure time counted at 1 hour intervals, and superimpose the probability density function of the home charging mode
subplot(2,3,5);
N = histcounts(EV.t_dis,0:1:24);% is counted in one hour interval and assigned to N
bar(0.5:1:23.5,N/sum(N),1);%Display histogram
hold on;
%Draw the probability density function of the home charging mode
x = [0.01:0.01:24];
y = normpdf(x,mu_1tdis,sigma_1tdis).*( 0<x & x<=mu_1tdis+12 )+...
normpdf(x-24,mu_1tdis,sigma_1tdis).*( mu_1tdis+12<x & x<=24 );
plot(x,y,'LineWidth',2,'Color','red');
title('EV access time frequency histogram');%Image Title
xlabel('Departure time (h)');%x-axis unit
ylabel('probability'); %y axis unit
%set(gca,'xtick',0:1:24); %x-axis scale
legend('Collected Data','PDF');%Add legend
legend('Location','northeast');% legend is placed in the upper right corner
%Draw the frequency distribution histogram of the battery state and overlay the corresponding probability density function
subplot(2,3,[3 6]);
scatter(1:size(EV),EV.SOC_con,'filled');
hold on;
scatter(1:size(EV),EV.SOC_min,'filled');
hold on;
scatter(1:size(EV),EV.SOC_max,'filled');
hold on;
title('EV battery SOC frequency histogram');%Image Title
ylabel('SOC (%)'); %x-axis unit
xlabel('i-th EV'); %y axis unit
%xlim([-10,size(EV)+10]);% Set the display range for the X-axis
legend('con','min','max');%Add legend
legend('Location','northwest');% legend is placed in the upper left corner
%Draw now
hold off;
end