Day-Ahead Scheduling of Electric Vehicles and Electrical Storage Systems in Smart Homes Using a Novel Decision Vector and AHP Method

The two-way communication of electricity and information in smart homes facilitates the optimal management of devices with the ability to charge and discharge, such as electric vehicles and electrical storage systems. These devices can be scheduled considering domestic renewable energy units, the energy consumption of householders, the electricity tariff of the grid, and other predetermined parameters in order to improve their efficiency and also the technical and economic indices of the smart home. In this paper, a novel framework based on decision vectors and the analytical hierarchy process method is investigated to find the optimal operation schedule of these devices for the day-ahead performance of smart homes. The initial data of the electric vehicle and the electrical storage system are modeled stochastically. The aim of this work is to minimize the electricity cost and the peak demand of the smart home by optimal operation of the electric vehicle and the electrical storage system. Firstly, the different decision vectors for charging and discharging these devices are introduced based on the market price, the produce power of the domestic photovoltaic panel, and the electricity demand of the smart home. Secondly, the analytical hierarchy process method is utilized to implement the various priorities of decision criteria and calculate the ultimate decision vectors. Finally, the operation schedule of the electric vehicle and the electrical storage system is selected based on the ultimate decision vectors considering the operational constraints of these devices and the constraints of charging and discharging priorities. The proposed method is applied to a sample smart home considering different priorities of decision criteria. Numerical results present that although the combination of decision criteria with a high rank of electricity demand has the highest improvement of technical and economic indices of the smart home by about 12 and 26%, the proposed method has appropriate performance in all scenarios for selecting the optimal operation schedule of the electric vehicles and the electrical storage system.


Introduction
Developing new technologies, increasing environmental pollution, and the tendency of utilizing green energies cause growth in the penetration rate of electric vehicles (EVs) in the transportation network [1]. The concept of the smart home (SH) with two-way electricity communication and a smart controllable system facilitates the usage of EVs with vehicleto-home technology. In a SH, the operation schedule of an EV can be optimized properly for improving its performance [2]. In addition to EVs, the electrical storage system (ESS) is technical and economic objective functions. Different types of batteries have been studied and evaluated based on techno-economic indices. The authors of ref. [20] proposed a frequency-based energy management method for optimizing the operational schedule of distributed generation units and ESS in a residential microgrid. The reduction in the total energy consumption of the microgrid and the control of the frequency and the peal load of the microgrid are the main purposes of this study that are improved considerably after applying the proposed method. In ref. [21], a review of smart home energy management systems has been presented. The effect of demand response programs on home energy units has been evaluated in this study. A comprehensive scheduling for the day-ahead operation of EVs has been proposed in order to maximize the cost-benefit objective function in ref. [22]. In another study, the management of a residential system in the presence of PVs and ESS has been investigated [23]. In ref. [24], the authors proposed an energy management method for optimal operation of EVs in an SH. The reduction in the effect of the stochastic behavior of renewable energy units on SHs' energy is the main goal of this study. An optimal home energy management method has been proposed in ref. [25] considering home energy sources, ESSs, and EVs. The minimization of the electricity cost and the peak-to-average rate is the purposes of the optimization. In another study, the home energy management system has been investigated in the presence of PVs, ESSs, and EVs in order to minimize the electricity cost, customer dissatisfaction, and the peak-to-average rate [26]. The authors of ref. [27] have proposed a home energy management system based on intelligent algorithms in order to optimize the techno-economic objective functions. The optimal energy management of a residential microgrid has been investigated in ref. [28] in order to increase the efficiency of EVs. The energy management of EVs and ESSs in addition to renewable energy units in the residential microgrids has been studied in refs. [29,30]. In these papers, the authors proposed optimal operational programs in order to increase the performance of the microgrid. In ref. [31], the energy management of multi-microgrids in the presence of SHs has been investigated. The management of EVs and ESSs in the energy hub platform has been studied in refs. [32][33][34]. The performance of these devices in the presence of demand response programs and local renewable resources has been improved in these papers.
In the mentioned papers, the operational schedule of EVs and ESSs has been achieved separately or simultaneously. In the common scheduling of an EV and an ESS, they are modeled mathematically, and then their charging and discharging times are optimized in order to minimize or maximize technical and economic goals. In this study, we propose a novel approach based on innovative decision vectors and the AHP method to simultaneously optimize the operational schedule of an EV and ESS. In the proposed approach, their charging and discharging times are selected optimally considering the situation of the SH, domestic energy unit, and the economic parameters which are modeled in the new decision vectors. Indeed, in the proposed approach, their operational schedule is selected considering the predetermined vectors without the direct minimization or maximization of economic and technical objective functions. Although the techno-economic indices are only considered for evaluating the approach, their value is reduced after applying the proposed energy management strategy. Moreover, the operational schedule of EVs and ESSs can be achieved using the proposed approach faster than the common methods. So, the current paper presents a novel framework for scheduling the charge and discharge times of EVs and the ESS in an SH. The main highlights of this manuscript are as follows: • A new approach for the energy management of an EV and an ESS is proposed by considering the PVs, the variable load of the SH, and the electricity tariff. • A novel decision vector is defined for the charging and discharging of EVs and ESSs based on the market price, the produced power of the PVs, and energy consumption of the householder.

•
The analytical hierarchy process (AHP) method is utilized to implement various priorities of decision criteria and to calculate the ultimate decision vectors. • The optimal operation schedule of an EV and ESS is selected based on the ultimate decision vectors considering the operational constraints of these devices and the constraints of charging and discharging priorities.

•
The main aim of the management problem is to minimize the electricity cost and peak demand of SHs during the day.
So, in this paper, the AHP method is utilized to combine the decision vectors of charging and discharging of EVs and ESSs, which are calculated based on the values of market price, the power of the PVs, and the demand of the SH at different times, to select the optimal operation schedule of the EV and ESS. It is worth mentioning that the electricity demand of the SH is variable, and the home buys its required energy from the distribution system with a variable market price. The technical and economic indices are considered for evaluating different priorities and evaluating the performance of the proposed method in selecting the best charging and discharging time for private vehicles and batteries.

Proposed Management Method
In this section, firstly, the energy structure of an SH, which consists of the load, PVs, EV, and ESS, is explained. Then, the proposed method for optimally scheduling an EV and ESS is introduced.

Energy Structure of the SH
The energy of the considered SH can be divided into five parts, including the electricity demand of home appliances, the energy of the PVs, the energy of the EV, the energy of the ESS, and the energy of the distribution system. The overall energy structure of the SH is shown in Figure 1.


A novel decision vector is defined for the charging and discharging of EVs and ESSs based on the market price, the produced power of the PVs, and energy consumption of the householder.  The analytical hierarchy process (AHP) method is utilized to implement various priorities of decision criteria and to calculate the ultimate decision vectors.  The optimal operation schedule of an EV and ESS is selected based on the ultimate decision vectors considering the operational constraints of these devices and the constraints of charging and discharging priorities.  The main aim of the management problem is to minimize the electricity cost and peak demand of SHs during the day.
So, in this paper, the AHP method is utilized to combine the decision vectors of charging and discharging of EVs and ESSs, which are calculated based on the values of market price, the power of the PVs, and the demand of the SH at different times, to select the optimal operation schedule of the EV and ESS. It is worth mentioning that the electricity demand of the SH is variable, and the home buys its required energy from the distribution system with a variable market price. The technical and economic indices are considered for evaluating different priorities and evaluating the performance of the proposed method in selecting the best charging and discharging time for private vehicles and batteries.

Proposed Management Method
In this section, firstly, the energy structure of an SH, which consists of the load, PVs, EV, and ESS, is explained. Then, the proposed method for optimally scheduling an EV and ESS is introduced.

Energy Structure of the SH
The energy of the considered SH can be divided into five parts, including the electricity demand of home appliances, the energy of the PVs, the energy of the EV, the energy of the ESS, and the energy of the distribution system. The overall energy structure of the SH is shown in Figure 1.
The total load of the SH is considered in the proposed method. The load is variable during the day. If the power of the PVs is unavailable, the SH buys all required energy from the distribution system with a variable market price. On the other hand, when solar irradiance is available and the PVs generate electricity, the SH buys the extra demand from the distribution system or sells the extra produced power to the distribution system. The produced power of the PVs at each hour ( ) can be calculated by Equation (1) [4].  The total load of the SH is considered in the proposed method. The load is variable during the day. If the power of the PVs is unavailable, the SH buys all required energy from the distribution system with a variable market price. On the other hand, when solar irradiance is available and the PVs generate electricity, the SH buys the extra demand from the distribution system or sells the extra produced power to the distribution system. The produced power of the PVs at each hour (P PV ) can be calculated by Equation (1) [4].
where η PV and A PV show the efficiency and area of the PVs. r si is the value of solar irradiance. Moreover, it is considered that the PVs is operated with a battery in order to increase the stability and inject the predicted power at each hour. Another energy part of the SH is related to the hourly power of the EV and ESS. Although the details of the optimal operation schedule of them are explained completely in the next sections, the initial data of the EV and ESS and the method of their calculation are presented here. The initial state of energy (SOE) of the ESS, the initial state of charge (SOC), the departure time of the EV from the parking, and the arrival time to the SH are the parameters of the EV that are stochastic and variable daily. For this reason, the stochastic model of these parameters is defined using the truncated Gaussian function. Equation (2) is the probability distribution function of the SOE of the ESS, and Equation (3) shows the probability distribution function of the stochastic parameters of the EV [35].
According to these equations, the probability of each parameter (x) is calculated using its average (µ X ), variance (σ 2 X ), minimum (x X min ), and maximum (x X max ). The combination of the Latin hypercube sampling algorithm and the K-means method is utilized to calculate the stochastic amount of initial SOE of the ESS, the initial SOC, departure time, and arrival time of the EV.

Method of Scheduling
In the proposed method, the optimal operation schedule of the EV and ESS is calculated using the decision vector of charging and discharging based on various criteria, including the market price, the produced power of the PVs, and the electricity demand of the SH. The AHP method is used to implement the priority of criteria in selecting the best operation schedule of the EV and ESS. Their constraints are also considered during the management in order to notice the operation conditions of them. Finally, the technical and economical indices are utilized to evaluate the performance of the proposed method and also the different priorities of criteria in the AHP method. The flowchart of the proposed management method of the EV and ESS is demonstrated in Figure 2.

Decision Vectors
In the proposed method, the decision vectors are defined for charging and discharging of the EV and ESS based on the market price, the produced power of the PVs, and the load of the SH.
The daily decision vectors of the charging and discharging of the EV and ESS based on various parameters are defined as follows: The method of calculating the decision vectors of the charging and discharging of the EV and ESS based on the various criteria is explained in Section 3. Section 4 is related to the way of implementation of the AHP method. The constraints of the management problem are formulated in Section 5, and the evaluation indices are explained in Section 6.

Decision Vectors
In the proposed method, the decision vectors are defined for charging and discharging of the EV and ESS based on the market price, the produced power of the PVs, and the load of the SH.
The daily decision vectors of the charging and discharging of the EV and ESS based on various parameters are defined as follows: In these equations, DV C and DV D are the decision vectors of charging and discharging, respectively. c i shows the desirability rate of charging at hour i, which is a number between 0 and 1. On the other hand, d i , which has a number between 0 and 1, is the desirability rate of discharging at hour i.
The method of calculating these decision vectors at each hour based on the different parameters is presented in the following.

Based on the Market Price
In the last years, the variable market price is implemented in the distribution systems in order to encourage end-users to reduce their consumption during peak hours. Based on the market price, it is proper that the EV or ESS charges when the market price is low. On the other hand, the hours with high market prices are the appropriate times for discharging.
Therefore, the desirability of charging has an inverse relation with the market price. In other words, the desirability of charging is increased when the market price decreases. On the other hand, the desirability of discharging, which has a direct relation with the market price, is increased when the market price increases.
Mathematically, the desirability of charging (c i_MP ) and discharging (d i_MP ) based on the market price is presented in Equations (6) and (7). where Here, MP i is the market price at hour i and MP max shows the daily maximum market price.
In Figure 3, the hourly desirability of charging and discharging based on the sample market price is demonstrated.

Based on the Power of the PVs
Domestic PVs are one of the eco-friendly methods for decreasing the dependence of the SH on the energy of the distribution system. Based on the produced power of the PVs, it is reasonable that the EV or ESS charges when the produced power of the PVs is high. On the other hand, the hours that the power of the PVs is low or its power is unavailable are the appropriate times for discharging.
Thus, the desirability of charging has a direct relationship with the produced power of the PVs. In other words, the desirability of charging is increased when the power of the PVs increases. On the other hand, the desirability of discharging, which has an inverse relationship with the power of the PVs, is increased when the market price declines.
Here, is the market price at hour i and shows the daily maximum market price.
In Figure 3, the hourly desirability of charging and discharging based on the sample market price is demonstrated.

Based on the Power of the PVs
Domestic PVs are one of the eco-friendly methods for decreasing the dependence of the SH on the energy of the distribution system. Based on the produced power of the PVs, it is reasonable that the EV or ESS charges when the produced power of the PVs is high. On the other hand, the hours that the power of the PVs is low or its power is unavailable are the appropriate times for discharging.
Thus, the desirability of charging has a direct relationship with the produced power of the PVs. In other words, the desirability of charging is increased when the power of the PVs increases. On the other hand, the desirability of discharging, which has an inverse relationship with the power of the PVs, is increased when the market price declines.
Mathematically, the desirability of charging ( _ ) and discharging ( _ ) based on the produced power of the PVs is presented in Equations (9) and (10).  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Market price ($) Desirability of charging Desirability of discharging Mathematically, the desirability of charging (c i_PV ) and discharging (d i_PV ) based on the produced power of the PVs is presented in Equations (9) and (10). where Here, P_PV i is the produced power of the PVs at hour i and P_PV max shows the daily maximum power of the PVs.
The hourly desirability of charging and discharging based on the sample produced power of the PVs is shown in Figure 4. where Here, _ is the produced power of the PVs at hour i and _ shows the daily maximum power of the PVs.
The hourly desirability of charging and discharging based on the sample produced power of the PVs is shown in Figure 4.

Based on the Load of the Home
Another important subject in the scheduling of the EV is the load of the home. According to the hourly variation of the demand of the SH and considering the hours with low, average, and peak demand, it is reasonable that the EV or ESS are charged during the off-peak times. So, based on the home's electricity demand, it is proper that they charge when the demand is low. On the other hand, the hours with high electricity demand are the appropriate times for discharging.
Therefore, the desirability of charging has an inverse relation with the load of the home. In other words, the desirability of charging is increased when the demand decreases. On the other hand, the desirability of discharging, which has a direct relationship with the load of the home, is raised when the value of the demand increases.

Based on the Load of the Home
Another important subject in the scheduling of the EV is the load of the home. According to the hourly variation of the demand of the SH and considering the hours with low, average, and peak demand, it is reasonable that the EV or ESS are charged during the off-peak times. So, based on the home's electricity demand, it is proper that they charge when the demand is low. On the other hand, the hours with high electricity demand are the appropriate times for discharging.
Therefore, the desirability of charging has an inverse relation with the load of the home. In other words, the desirability of charging is increased when the demand decreases. On the other hand, the desirability of discharging, which has a direct relationship with the load of the home, is raised when the value of the demand increases. Mathematically, the desirability of charging (c i_Demand ) and discharging (d i_Demand ) based on the demand of the SH is presented in Equations (12) and (13). where Here, P_Demand i is the electricity demand of the SH at hour i, and P_Demand max shows the daily maximum demand.
In Figure 5, the hourly desirability of charging and discharging based on the sample demand of the SH is demonstrated.

Analytical Hierarchy Process Method
The AHP method is the practical method for selecting the best compromise solution when there are some decision criteria [36]. Although in the proposed managemen method the best charge and discharge schedule of the EV and ESS can be selected inde pendently based on the mentioned criteria, including the market price, the produced power of the PVs, and the demand of the SH, the AHP method is utilized to select thei best operation schedule considering all decision criteria.
The ultimate decision vectors of charging and discharging are calculated using th AHP method after defining initial vectors based on the market price, the produced powe of the PVs, and the demand of the SH. In the AHP method, firstly, the judgment matrix i created based on the priority of decision criteria. Then, the arithmetic mean method i used to calculate the final weight of each index ( ). Finally, the desirability of charging ( _ ) and discharging ( _ ) at hour i is calculated by Eqns. (15) and (16) [36].
For selecting the best combination or priorities of the mentioned criteria in the AHP method, 13 cases are considered. The priority of the criteria in these cases is presented in Table 1. These cases, which are all possible priorities, are defined in order to select th best case based on the numerical results. In the first three cases, only one decision index i considered; zero (0) means that the criterion is not considered. In other cases, 1 and have the highest and lowest priorities, respectively. The judgment matrix is defined based on the priorities, and then the final weights are calculated using the arithmeti mean method. In Table 2, the judgment matrix and final weight of criteria in variou cases are presented.  5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Demand (kW) Desirability of charging Desirability of discharging

Analytical Hierarchy Process Method
The AHP method is the practical method for selecting the best compromise solution when there are some decision criteria [36]. Although in the proposed management method the best charge and discharge schedule of the EV and ESS can be selected independently based on the mentioned criteria, including the market price, the produced power of the PVs, and the demand of the SH, the AHP method is utilized to select their best operation schedule considering all decision criteria.
The ultimate decision vectors of charging and discharging are calculated using the AHP method after defining initial vectors based on the market price, the produced power of the PVs, and the demand of the SH. In the AHP method, firstly, the judgment matrix is created based on the priority of decision criteria. Then, the arithmetic mean method is used to calculate the final weight of each index ( w i ). Finally, the desirability of charging (c i_AHP ) and discharging (d i_AHP ) at hour i is calculated by Equations (15) and (16) [36].
For selecting the best combination or priorities of the mentioned criteria in the AHP method, 13 cases are considered. The priority of the criteria in these cases is presented in Table 1. These cases, which are all possible priorities, are defined in order to select the best case based on the numerical results. In the first three cases, only one decision index is considered; zero (0) means that the criterion is not considered. In other cases, 1 and 3 have the highest and lowest priorities, respectively. The judgment matrix is defined based on the priorities, and then the final weights are calculated using the arithmetic mean method. In Table 2, the judgment matrix and final weight of criteria in various cases are presented.

Constraints of EVs
EVs have some constraints that should be considered during the selection of their operating schedule. The constraints are presented in the following.

The SOC of the EV at Departure Time
It is considered that the EV should have been fully charged at the departure time. Equation (17) shows this constraint [36].
Here, SOC DT is the SOC of the EV at the departure time and SOC max is the maximum SOC.

The Limit of Hourly Charging and Discharging
The value of hourly charging and discharging of the EV should be in a range between their minimum and maximum rate. The ranges of hourly charging and discharging are presented in Equations (18) and (19) [36].
These equations present that the value of charge (EV c_i )/discharge (EV d_i ) of the EV should be in the range between zero and the maximum rate of charge (EV C_max )/discharge (EV d_max ).

The Limit of SOC
It should be considered that the SOC of the EV at hour i (SOC i ) does not violate its range between the minimum SOC (SOC min ) and the maximum SOC (SOC max ) of the EV according to Equation (20) [36].

Constraints of ESS
The considered constraints of the ESS during the proposed energy management method are explained in the following.

The Limit of Hourly Charging and Discharging
The value of hourly charging and discharging of the ESS should be in a range between its minimum and maximum rates. The ranges of hourly charging and discharging of the ESS are presented in Equations (21) and (22). In these equations, ESS c_i and ESS d_i are the charged and discharged energy of the ESS at hour i. The parameters ESS C_max and ESS d_max show the maximum rate of charge and discharge of the ESS at each hour [16].

The Limit of SOE
It should be considered that the SOE of the ESS at hour i (SOE i ) does not violate its range between the minimum SOE (SOE min ) and the maximum SOE (SOE max ) of the ESS according to Equation (23) [16].

Constraints of Charging and Discharging Priorities
Three following constraints are also considered in order to find the optimum operational schedule of the EV and ESS.

Inactivity of EV and ESS at the Same Time
It is considered that the performance of the EV and ESS (their charging and discharging actions) should not be at the same time in order to achieve more linear electricity variations of the SH. Mathematically, this constraint can be evaluated by Equation (24).
Here, I EV and I ESS show the operation mode of EV and ESS. Their value is −1, 0, and 1 when the EV or ESS is in discharge, idle, and charge mode.

Priority of EV in Charging
It is considered that the EV has the priority of charging when the calculated decision vector suggests charge mode for the EV and ESS. Equation (25) shows this constraint.

Priority of ESS in Discharging
It is considered that the ESS has the priority of discharging when the calculated decision vector suggests discharge mode for the EV and ESS. This constraint is considered by Equation (26) I

Evaluation Indices
The technical and economic indices are considered for evaluating the performance of the proposed management method in finding the best operation schedule of the EV and ESS. The electricity cost of the SH is the economic index, and the peak demand is the considered technical index.

Electricity Cost
For calculating this index, firstly, the hourly power situation of the SH should be calculated by Equation (27).
In this equation, SH Demand i , SH EV i , SH ESS i , and SH PV i are the demand of the SH, the power of the EV, the power of the ESS, and the produced power of the PVs at hour i, respectively. m EV i and m ESS i , which show the modes of the EV and ESS, are equal to +1 and −1 when the EV and ESS are in charge and discharge modes, respectively. SH P i shows the power situation of the SH at hour i.
If the value of the power situation is higher than zero, the SH has to buy electricity from the distribution system. The cost of the bought energy at hour i (Co i ) is calculated by Equation (28). Here, MP i is the market price at hour i.
On the other hand, if the value of the power situation is lower than zero, the SH can sell the extra energy to the distribution system. Equation (29) presents the profit of the sold energy at hour i (Pr i ). Here, tr i is the tariff of the electricity that the distribution company buys from the end-user at hour i.

of 19
Thus, the electricity cost of the SH (EC SH ) can be calculated by Equation (30). where

Peak Demand
Equation (32) is utilized for calculating the peak demand of the SH or the maximum dependence of the SH on the energy of the grid during a day.
Here, PD SH is the daily peak demand, and SH P i is the demand of the SH at hour i.

Numerical Analysis
In this section, the proposed management method of the EV and ESS is evaluated in a sample SH. It is worth mentioning that the time horizon of the analysis is the day-ahead. The electricity demand of the SH is shown in Figure 6 [37]. The owner of the SH buys its required electricity from the distribution system with a variable market price that is demonstrated in Figure 7. On the other hand, the tariff of the bought energy from the SH by the distribution company is the average of the daily market price [38]. = 0 < 0 = 0 > 0 (31

Peak Demand
Equation (32) is utilized for calculating the peak demand of the SH or the maximum dependence of the SH on the energy of the grid during a day.
Here, is the daily peak demand, and is the demand of the SH at hour i.

Numerical Analysis
In this section, the proposed management method of the EV and ESS is evaluated in a sample SH. It is worth mentioning that the time horizon of the analysis is the day-ahead. The electricity demand of the SH is shown in Figure 6 [37]. The owner of the SH buys its required electricity from the distribution system with a variable market price that is demonstrated in Figure 7. On the other hand, the tariff of the bought energy from the SH by the distribution company is the average of the daily market price [38].
It is considered that the SH has the capacity for allocating 10 PVs with the technol ogy of 335W SolarPower X21. Figure 8 shows the variation of the solar irradiance during the day [39].
The type of EV is a CHEVROLET VOLT. The capacity of its battery is 16 kWh. The maximum charge and discharge rate is 3.3 kWh with an efficiency of 95%. It is considered that the EV should be fully charged at the departure time. Moreover, it should not be discharged lower than 30% of its capacity because of the health and longevity of the bat tery and the welfare of the consumer. The mean values of the initial SOC, departure time and arrival time are 50%, 8 o'clock, and 19 o'clock, respectively [39].    It is considered that the SH has the capacity for allocating 10 PVs with the technology of 335 W SolarPower X21. Figure 8 shows the variation of the solar irradiance during the day [39].  The total capacity of the ESS is 10 kWh. The charging and discharging efficiency of the ESS is 0.95%. The mean value of the initial SOE of the ESS is 50 percent of the total SOE, while the lower limit of the SOE of the ESS is 20 percent of the total SOE to avoid deep discharging. The hourly charging and discharging limit of the battery of the ESS is 2.5 kW [40].
As mentioned above, firstly, the stochastic parameters of the EV and ESS are calculated by the combination of the Latin hypercube sampling algorithm and the K-means method. According to the results of the probabilistic program, the initial SOE of the ESS is 52.33%, the initial SOC of the EV is 44.73%, and the hours of departure and arrival of the EV are 7 and 19, respectively.
In this step, the decision vectors are calculated using the AHP method considering various preferences of different criteria. As mentioned above (Table 2), 13 cases are considered for evaluating the priorities and selecting the best operation schedule of the EV and ESS. Moreover, the results of the proposed method are also compared with the mentioned method in ref. [41].
The operation schedules of the EV and ESS in different cases are presented in Tables  3 and 4, respectively. In these tables, the positive and negative values show the charging and discharging modes, respectively, while the idle mode is represented by zero. As shown in these tables, the operation times are different based on preferences of market price, availability of PVs, and demand. In cases that the market price has the highest priority, the EV and ESS tend to charge when the market price is low and to discharge when the market price is high. In cases that the demand has the highest priority, they tend to charge when the electricity load of the SH is low and to discharge when the load is high. In cases that the availability of the PVs has the highest preference, the EV and ESS tend to charge when the rate of the produced power of the PVs is high. Of course, because of the EV being out of the home in the middle time of the day, the EV tends to charge at hours that the PVs are available or close to the available times of the PVs. To- The type of EV is a CHEVROLET VOLT. The capacity of its battery is 16 kWh. The maximum charge and discharge rate is 3.3 kWh with an efficiency of 95%. It is considered that the EV should be fully charged at the departure time. Moreover, it should not be discharged lower than 30% of its capacity because of the health and longevity of the battery and the welfare of the consumer. The mean values of the initial SOC, departure time, and arrival time are 50%, 8 o'clock, and 19 o'clock, respectively [39].
The total capacity of the ESS is 10 kWh. The charging and discharging efficiency of the ESS is 0.95%. The mean value of the initial SOE of the ESS is 50 percent of the total SOE, while the lower limit of the SOE of the ESS is 20 percent of the total SOE to avoid deep discharging. The hourly charging and discharging limit of the battery of the ESS is 2.5 kW [40].
As mentioned above, firstly, the stochastic parameters of the EV and ESS are calculated by the combination of the Latin hypercube sampling algorithm and the K-means method. According to the results of the probabilistic program, the initial SOE of the ESS is 52.33%, the initial SOC of the EV is 44.73%, and the hours of departure and arrival of the EV are 7 and 19, respectively.
In this step, the decision vectors are calculated using the AHP method considering various preferences of different criteria. As mentioned above (Table 2), 13 cases are considered for evaluating the priorities and selecting the best operation schedule of the EV and ESS. Moreover, the results of the proposed method are also compared with the mentioned method in ref. [41].
The operation schedules of the EV and ESS in different cases are presented in Tables 3 and 4, respectively. In these tables, the positive and negative values show the charging and discharging modes, respectively, while the idle mode is represented by zero. As shown in these tables, the operation times are different based on preferences of market price, availability of PVs, and demand. In cases that the market price has the highest priority, the EV and ESS tend to charge when the market price is low and to discharge when the market price is high. In cases that the demand has the highest priority, they tend to charge when the electricity load of the SH is low and to discharge when the load is high. In cases that the availability of the PVs has the highest preference, the EV and ESS tend to charge when the rate of the produced power of the PVs is high. Of course, because of the EV being out of the home in the middle time of the day, the EV tends to charge at hours that the PVs are available or close to the available times of the PVs. Totally, the charging time of the EV mostly happens during the night, when the market price and demand are low, while the charging time of the ESS mostly happens during midday, when the power of the PVs is available. On the other hand, the ESS can be discharged at the end of the day to reduce the dependence of the SH on the energy of the distribution system. In the following, the performance of different cases, and also the proposed method, are pondered using the results of the evaluation indices. The hourly power situation of the SH in different cases and based on the proposed method of ref. [41] is demonstrated in Figure 9. In this figure, the SH has to buy electricity from the distribution system with the market price when the value of the power is higher than zero. On the other hand, the owner of the SH sells energy to the distribution system with the predetermined tariff. Thus, the daily electricity cost is calculated using the hourly costs or profits. In Table 5, the amounts of the evaluation indices are presented. In cases where only one decision criterion is considered (Cases 1-3), case 1 has the lowest electricity cost, while case 3 has the lowest peak demand. This difference is because of the different decision vectors. Cases 5 and 6 have the lowest electricity cost, with USD 5.549, and cases 11 and 13 have the lowest peak demand, with 4.83 kW. For selecting the best case, the AHP method is utilized again. In this step, the weight of each evaluat-   In cases where only one decision criterion is considered (Cases 1-3), case 1 has the lowest electricity cost, while case 3 has the lowest peak demand. This difference is because of the different decision vectors. Cases 5 and 6 have the lowest electricity cost, with USD 5.549, and cases 11 and 13 have the lowest peak demand, with 4.83 kW. For selecting the best case, the AHP method is utilized again. In this step, the weight of each evaluating index (electricity cost and peak demand) is considered equal to 0.5. Therefore, cases 11 and 13 are selected as the best combination state of the decision criteria. In this case, the peak demand of the SH is 4.835 kW, while the daily electricity cost is USD 5.723. It is worth mentioning that, in these cases, the demand has the highest priority.
The considered cases are also pondered based on different points of view. The owner of the SH has a different view than the owner of the distribution system about the operational schedule of the EV and ESS. The lowest electricity cost is the most important subject for the owner of the SH. So, based on the consumer's point of view, the operational schedules of the EVs and ESSs in cases 5 and 6 with the lowest electricity cost are the best results. On the other hand, cases 11 and 13, with the lowest peak demand, are the proper results based on the producer's point of view.
The electricity cost and peak demand of the SH after utilizing the method of ref. [41] are USD 6.489 and 6.548 kW, respectively. So, according to the results of the case 13 (also case 11) as the best result, the proposed management method reduces the electricity cost by about 11.79% and improves the peak demand by about 26.16% more than ref. [41]. Although the proposed method is utilized for day-ahead management, and the running time of the program is not so important, the proposed method is much faster than the other method. The running time of the proposed method is 0.07802 s, while the running time of the method in ref. [27] is 29.686587 s. Thus, the proposed method finds the best operation schedule of the EV and ESS about 99.74% sooner than ref. [41]. Therefore, the proposed method has proper performance in selecting the optimal operation schedule of EVs and ESSs in SHs for improving the technical and economic indices of SHs.

Conclusions
In this paper, a novel method was investigated to properly schedule EVs and ESSs in SHs. The combination of decision vectors and the AHP method was utilized to select the best operation schedule based on the market price, the power of the PVs, and demand. The performance of the proposed method and different priorities of decision criteria were evaluated using economic and technical indices.
Numerical results, obtained from the implementation of the proposed method on a sample SH, show that the management method can properly choose the operation schedule of the EV and ESS in the SH. When the decision criteria, including market price, PVs, and demand, are considered separately (without the AHP method), the electricity cost of the SH is the lowest when the operation schedule is selected using the decision vectors of the market price, while the peak demand is the lowest when the demand of the SH is only considered. The SH has the best performance when the operational schedules of the EV and ESS are selected using the priorities of demand, PVs, and market prices equal to one, two, and three. According to the results, the charging time of the EV mostly happens during the night, when the market price and demand are low, while the charging time of the ESS mostly happens during midday, when the power of the PVs is available. On the other hand, the ESS can be discharged at the end of the day to reduce the dependence of the SH on the energy of the distribution system. The proposed method has a better performance than another method of energy management, so that the electricity cost and peak demand of the SH are reduced by about 12 and 26% using the proposed method. Moreover, it finds better and more correct results about 99% sooner than the other method. Hence, it can be said that the efficiency of the SH is improved significantly by implementing the proposed energy management in order to select the operation schedule of the EV and ESS in the SH.