Two-Stage Fuzzy Logic Inference Algorithm for Maximizing the Quality of Performance under the Operational Constraints of Power Grid in Electric Vehicle Parking Lots

The widespread adoption of electric vehicles (EVs) has entailed the need for the parking lot operators to satisfy the charging and discharging requirements of all the EV owners during their parking duration. Meanwhile, the operational constraints of the power grids limit the amount of simultaneous charging and discharging of all EVs. This affects the EV owner’s quality of experience (QoE) and thereby reducing the quality of performance (QoP) for the parking lot operators. The QoE represents a certain percentage of the EV battery required for its next trip distance; whereas, the QoP refers to the ratio of EVs with satisfied QoE to the total number of EVs during the operational hours of the parking lot. This paper proposes a two-stage fuzzy logic inference based algorithm (TSFLIA) to schedule the charging and discharging operations of EVs in such a way that maximizes the QoP for the parking lot operators under the operational constraints of the power grid. The first stage fuzzy inference system (FIS) of TSFLIA is modeled based on the real-time arrival and departure probability density functions in order to calculate the aggregated charging and discharging energies of EVs according to their next trip distances. The second stage FIS evaluates several dynamic and uncertain input parameters from the electric grid and from EVs to distribute the aggregated energy among the EVs by controlling their charging and discharging operations through preference variables. The feasibility and effectiveness of the proposed algorithm are demonstrated through the IEEE 34-node distribution system.


Introduction
The shortage of fossil fuel in the world and the concerns about the negative impact of conventional vehicles on the environment have raised attention towards exploring alternative energy sources for transportation. One of the possible solutions to tackle such problems is to replace conventional vehicles with electric vehicles (EVs). As a result, widespread adoption of EVs will be observed in the near future. For instance, the global stock of EVs has been estimated to be about 40-70 million by 2025, and more than one hundred million EVs by the year 2050 [1,2]. These EVs are moving across cities and have the potential to serve the power grid through charging and discharging with the availability of vehicle-to-grid (V2G) technology.
The integration of large-scale EVs into the electric grid requires a specific and costly infrastructure. On the other hand, parking lots (PLs) are alternative solutions that can help to efficiently utilize the potential of EVs within the existing power system [3]. PLs are regarded as a platform where the aggregated EVs represent the electric load as well as the power supply resources for the electric grid in grid-to-vehicle (G2V) and vehicle-to-grid (V2G) mode, respectively [4]. As the EVs are staying for a longer period of time, therefore; in G2V mode, their charging load may coincide with the baseload (residential load). In [5] the authors identified an overlap between vehicles on the street and the residential load profile from 2:00 p.m. to 6:00 p.m. An uncontrolled simultaneous charging of a fleet of EVs during such an overlap time may greatly stress the distribution power network in terms of power losses, voltage fluctuations, degraded power quality and efficiency which may increase the chances of a power blackout. The possible reasons for such a huge load are the simultaneous charging of a large-scale EVs and their use of fast charging stations (CSs).
Most of the global companies under the international coalition initiative (EV100) commitments are transitioning their internal combustion engine vehicle parks into EV parks with fast CSs. For instance, Tesla has already announced a plan to build supercharging stations, where 50 stations have been installed in Shanghai and others in Beijing and the USA [6]. In V2G mode, simultaneous discharging of such a large scale of EVs is not a desirable solution from both the power grid and from the EV owner's perspective. Therefore, the PL operators are required to limit the charging EVs during the peak-hours and the discharging EVs during the off-peak hours. However, on the other side, this can have a significant effect on the desired quality of experience (QoE) level for the EV owners during their parking duration. This implies that PL operators are expected to satisfy the QoE for a maximum number of EVs and thereby to improve the PL quality of performance (QoP). Considering 12 h as the parking operational hours, a higher value of QoP in a day corresponds to better performance and vice versa. Therefore, selection of the most appropriate EVs for charging and discharging services among all the EVs candidates such that to maximize the QoP while respecting all the operational limits of the power grid is a complex problem. The complexity of this problem is due to the dependency of the QoE satisfaction level on multiple and independent factors, including the arrival time, departure time, parking duration, state-of-charge (SoC), next trip travelling distance, required SoC (SoC req ), the current PL occupancy and the updated available power from the grid. These are temporal and spatial based varying parameters with a higher level of uncertainty and thereby resulting in a dynamic and complex system. In practice, the drivers and the PL operators perceptions on several of the above parameters are highly imprecise. For instance, the driver's description of SoC is likely to be non-specific and qualitative, for instance: enough, low or high. Similarly, the postulation of PL operators about the available power is simply as low, medium or high. In order to efficiently utilize the energy usage, the scheduling of charging and discharging of EVs can play an important role and should consider the aforementioned factors from both the power grid and EV domains. However, the uncertain behavior of EV owners and the requirements of both EVs and of the power grid present challenges for the PL operators to efficiently schedule EVs operation and thus affecting their QoP.
One of the possible solutions to deal with such types of temporal and spatial varying complex systems is to apply a fuzzy logic-based methodology. The fuzzy-logic based approach resolves the nonlinearity of any real-time complex system by breaking it down into a simple weighted sum of linear subsystems [7,8]. The growing trend of EVs, the owner's parking behavior, charging and discharging requirements, the electric power grid constraints, and the fuzzy approach towards solving such complex systems motivated us to develop a scheduling algorithm based on two-stage fuzzy logic inference system for EV PLs. The TSFLIA takes the flexibility of EV owner's behaviors into account and aims to schedule the charging and discharging operations for the most appropriate EVs such that it helps to maximize the QoP under the operational limits of the power grid. To do so, the TSFLIA utilizes Energies 2020, 13, 4634 3 of 31 the services of the developed first and second stages of the fuzzy inference mechanisms for computing the required SoC of EVs according to their next trip travelling distance and schedule their charging and discharging operations under the smart grid operational limits. The input parameters such as the departure time from home arrival time to PL departure time from PL, required SoC, parking duration and the available power for controlling the charging and discharging operation of EVs are believed to be adequately accurate for solving this complex problem. The proposed scheme is validated using the IEEE 34-node distribution system and simulated for three different PLs. The simulation results indicate that the QoP with the proposed TSFLIA prevails over the fuzzy logic inference based algorithm (FLIA) for electric vehicles in PLs. The contributions of this research work are as follows: • The energy requirements of the EV owners are identified using realistic traveling distance patterns from the US national household travel survey (NHTS) and their G2V and V2G operations are formulated and solved through a TSFLIA. • The first stage fuzzy inference system (FIS) is developed based on the real data obtained from the NHTS to compute the aggregated charging and discharging energies of EVs according to their next trip travelling distances. The second stage FIS utilizes the inputs from EVs and the power grid to determine an adequately accurate charging and discharging preferences for each of the connected EVs. The proposed TSFLIA is applied to three different PLs connected to the IEEE 34-node distribution system and the results are validated against the FLIA.
The paper is organized as follows: Section 2 explores the state-of-the-art techniques in this area. In Section 3, the proposed TSFLIA is presented. The simulation environment and results are discussed in Section 4. Finally, the paper is concluded in Section 5.

Related Work
In the literature, the problem of scheduling EVs for future smart PLs has been extensively studied with different perspectives and objectives. This includes power allocation to PLs, energy and cost management of PLs, PLs placement in the power distribution network and routing and PL selection for moving EVs. A scheduling algorithm for EVs based on fuzzy logic control with the aim to reduce the waiting time for charging and balance the charging load of EVs was proposed in Ref. [9]. The developed fuzzy logic control system was used to compute a weighted priority for each of the EVs and CSs and determine their optimal pairs. By this way, they evenly distributed the charging load of EVs among the available CSs for reducing the waiting time. The performance of the proposed scheme was analyzed through average waiting time and was compared with the conventional random and maximum weight-based scheduling schemes. However, the authors only focused on the waiting time requirements of the EV owners while they did not address the charging level satisfaction and optimization of energy consumption.
The authors in [10] proposed a multi-agent scheme for the rerouting of moving EVs towards the appropriate CSs with the aim to distribute the charging load among the dispersed CSs. The multi-agent Energies 2020, 13, 4634 4 of 31 scheme was built in a bottom-up hierarchical manner where each agent was modeled with different services. An EV agent was modeled based on a fuzzy logic expert system which was used to request the other high-level agents for charging and discharging services. A case study was conducted by considering 21 EVs with battery capacities of 100 kWh and 6 CSs dispersed within a virtual block to validate their proposed scheme. The results indicate that the proposed scheme was able to cognitively redistribute the EVs among the CSs. However, the work focused on the distribution of the preload of EVs (i.e., the load at the time of request) and did not consider the situation of already parked EVs. The authors in [11] considered the mobility of EVs and studied the problem of analyzing the impact of different sampling rates on the communication channel with the G2V and V2G operations of EVs. The authors concluded that a faster sampling data rate between the three communicating entities (i.e., aggregator, EVs and CSs) can help in reducing the error. However, the work mainly focused on the sampling rate of requests and the impact on the communication channel instead of any scheduling for EVs or optimization of the power grid load.
A G2V and V2G capabilities for voltage stability and mitigating peak demand in a typical power distribution were studied in [12]. Two controllers were designed: one for CS and another for the aggregator to control the V2G operation based on fuzzy logic. The CS controller was used to determine the output charging and discharging energy according to the SoC of EVs and voltage of the nodes. The output of the first fuzzy controller coupled to the node voltage was used as inputs to the second controller which results in power flow between the nodes with connected CSs. The simulation results demonstrated that the G2V and V2G operations were controlled efficiently while using a fuzzy logic controller. However, the authors did not consider the QoE requirements of the EV owners. An integrated G2V and V2G scheme based on fuzzy logic and genetic algorithm (GA) was developed to maximize the penetration of EVs in a workplace car park [13]. The developed fuzzy logic inference system used two inputs: the SoC and subsequent trip distance (STD) to compute a weighted value for decision. For each of the EVs, the fuzzy logic inference was returning two outputs: one for charging while the other for discharging. The two output values were compared to determine the charging and discharging status of each the EVs. After the status determination of each EV, the G2V and V2G operations were scheduled using GA. The results of the proposed scheme showed maximum penetration of EVs with reduced cost in industrial and commercial laterals of the 38-node distribution system. The authors in [14] proposed a probabilistic approach for determining optimal locations for EV PLs in the distribution network by considering driving patterns of EVs owners and scheduled the charging and discharging of EVs based on the electricity prices. The authors concluded that minimizing the difference between the initial and final SoC of EVs, or in other words, satisfying the charging and discharging requirements of a maximum number of EVs could increase the benefits for the PLs. However, the problem of minimizing the differences between initial and final SoCs still needs to be explored, because there are multiple factors such as arrival and departure time of EVs, initial SoCs, battery capacities, charging and discharging rate, and the available power which influences the operations of PLs.
A real-time charging scheme based on fuzzy logic inference was proposed in [15] with the aim to manage the aggregated charging load and satisfies the EVs in a fair manner. The developed fuzzy inference system was used to determine the charging or discharging priority value based on the associated inputs such as remaining charging time, the SoC and the electricity price. Given the priority value, an optimization model using linear programming (LP) was adopted to obtain an optimal charging or discharging rate for each EV. Two different cases with discharging only and charging and discharging were simulated to validate the proposed scheme. However, the proposed scheme assumed that the V2G operation was based on the willingness of EV owner's regardless of their requirements. Therefore, the rationality of their participation in V2G operation and their required amount of charge/discharge are yet to be exploited. An online decision-making scheme for managing the charging loads of plugged-in electric vehicles (PEVs) in public PLs was proposed for aggregators [16]. In their scheme, a fuzzy expert system was used to assign a charging priority value to each EV by evaluating the required SoC, maximum charging rate, and parking duration for making a decision. The optimization problem was Energies 2020, 13, 4634 5 of 31 then formulated using mixed-integer nonlinear programming and the proposed method was applied on a 38-node distribution network. The proposed scheme addressed both the requirements of the power grid and the EV owner's QoE. The results were validated against uncoordinated charging and first-come-first-serve (FCFS) schemes in terms of required energy, delivered energy and owner's QoE. However, this scheme was introduced only for the G2V application and the applicability of both the power grid and EV owner's QoE for V2G application is still required.
A multi-objective optimization technique for monitoring the status of CSs and their reservation based on the fuzzy logic controller was proposed in [17]. This work aimed to maximize the EV's battery SoC with a minimum cost at the time of plug-out. The updated status of the CSs was monitored and they were reserved through a mobile application. The fuzzy logic controller was used to compute the output power according to the difference between the time required to charge a full battery capacity and the users preferred charging time in conjunction with the real-time electricity prices. The scheme was simulated for a total number of 60 EVs and the results showed improved performance compared with conventional charging schemes. However, the scheme was validated for a small PL with only G2V application and yet both the G2V and V2G applications for a sizable PL need to be studied. Furthermore, in the case of a large fleet of EVs with different battery capacities and user preferences, several EVs would not be able to meet the charging requirement during their preferred charging duration, but this aspect was not considered. The authors in [18] proposed a real-time energy management algorithm (RTEMA) based on a fuzzy logic controller to reduce the charging cost of EVs and mitigate the impact of charging load on the main grid by shaving the peak power load in a commercial workplace car park. The fuzzy logic controller was used to determine a charging index based on the associated power flow between the utility grid & the PL and the energy tariff. The RTEMA utilized the charging index to adjust the charging rate for each of the PEV priority levels. The proposed RTEMA was applied to a car park connected to the IEEE 69-node system and simulated with different penetration levels distributed in a PEVs car park. The proposed RTEMA scheme showed improved results by reducing the overall charging cost, improving the voltage profile and reducing losses in the system. Although the RTEMA considered the power grid requirements and the cost of charging EVs; however, the EVs owner's QoE in terms of the desired amount of charge and discharge energy still needs to be explored.
In our previous work, we developed a fuzzy logic weight based charging scheme (FLWCS) aiming to schedule the charging of EVs according to the different inputs from power and EV domains [19,20]. In [19], the work focused on the G2V operation mode and therefore, was further extended by considering both the charging and discharging of EVs in [20]. The proposed fuzzy logic inference based algorithm (FLIA) aims to efficiently manage the available power for a PL, while maximizing the EV owner's QoE [20]. The developed fuzzy inference mechanism was used to evaluate several uncertain input parameters from the power grid and from EVs to determine a weighted decision value for controlling the charging and discharging operations of EVs. The proposed FLIA was applied to a PL and simulated with different parking capacities and penetration levels of EVs. The simulation results showed an improved performance against the conventional system. However, the work was based on two assumptions: (1) The EVs were categorized into G2V and V2G by utilizing the α-cut and β-cut properties of fuzzy set theory where these values were assumed to be as α = 0.8 and β = 0.3. Based on these fixed values the EVs for which the fuzzy decision was equal to or less than the β values were scheduled for G2V while those with the fuzzy decision values equal to or greater than α were scheduled for V2G operations. (2) The level of EV owner's QoE was assumed to be charged until full battery capacity. But, in a real system, the categorization of EVs for G2V and V2G operations and the amount of charging and discharging energies should be based on certain requirements of the EVs, such as the next traveling distance. Furthermore, charging EVs until full battery capacity is not a favorable option for both the EV owners and power grid perspectives. Therefore, the FLIA was unable to manage the power efficiently with the increasing number of requesting EVs and thus results in a degraded QoP with high parking occupancies. Several other research work related to EVs motilities and fair charging have been studied [21,22]. The main difference of this study from the abovementioned works is that it evaluates the energy requirements of EVs based on their trip distances obtained from the real data of US NHTS, and optimally control their charging and discharging operations according to the PL occupancies, and under the power grid operational limits of the power grid, EV owner's and PL operators point of views. In the existing approaches, the charging and discharging optimization of EVs in PLs was investigated from either the power grid such as minimizing the peak load or the EV owners and PL operator's profit point of view. However, none of the previous work focused on the concurrent requirements of both the power grid and EV owners. The proposed two-stage fuzzy logic inference based algorithm (TSFLIA) utilizes the first and second stages of the fuzzy logic inferences to compute the required energy of EVs according to their next trip distances, and schedule the G2V and V2G operations in such a way that maximizes the EV owner's QoE and thereby the PL QoP within the power grid operation constraints.

Proposed Two-Stage Fuzzy Logic Inference Algorithm
The TSFLIA computes the EV owner's energy requirements and schedule their charging and discharging operations by utilizing the two stages of the fuzzy inference mechanism. The first stage incorporates the arrival and departure probability distribution functions (PDFs) obtained from the NHTS data to model the travelled and next trip distances of EVs, compute the amount of their required energy and thereby categorize the EVs into G2V and V2G operations. Given the amount of charging and discharging energies of EVs, the algorithm determine the G2V and V2G operations for each of the connected EVs and utilizes the services of the second stage fuzzy logic inference mechanism to control their operations. A detailed description of the proposed TSFLIA is given as follows.

System Model of the Proposed TSFLIA
The different components of the proposed TSFLIA are presented in Figure 1. The model consists of a low-voltage (LV) power distribution network connecting residential buildings (baseload) and a PL (EV load). The baseload is the average electricity demand of the connected residential houses. The PL in this work is based on futuristic scenarios such that each parking spot has a connected CS. These CSs have the standard J1772 connectors which are used to plug in the inlet of EVs for charging or discharging operation. The CSs in the proposed model are considered to supply a 208-240 V Alternative Current (AC) level 2 (high) power which provides about 19.2 kWh charging and discharging energy [23]. This work considers the charging and discharging scheduling problem for a sizable PL which represents a considerable load due to a number of simultaneous charging of EVs. For instance, an urban PL supporting regular (routine EVs) commuting vehicles and irregular (Non-routine EVs) vehicles with long and short (vehicles coming for shopping, theaters, city visiting, social events, etc.) parking duration [24]. This type of PL accommodates the number of EVs in order of 100 during their parking time and represents a significant electric load. The arrival time, departure time, the parking duration and the required amount of charge/discharge energy of EVs are random and not known in advance. The PL controller is a central entity which collects the data from EVs and the power grid and runs the algorithm. The algorithm utilizes first stage fuzzy logic inference to compute the traveled distance and consequently the next travelling trip distance, the current SoCs and required SoCs. Once the required SoCs of EVs are computed, in each time slot their charging and discharging operations are scheduled according to the required SoC (SoC req ), remaining parking duration (RPD) and the updated available power (UAP) through the second stage of fuzzy logic inference. Furthermore, an advanced metering infrastructure (AMI) is used for updating the baseload to the distribution system operators and to the PL operators using wide-area-network (WAN) [25]. Similarly, the EV owners information is collected using a local area network (LAN) between the PL and the CSs [26]. Owners of EVs provide all the necessary information, plug-in the connectors to their EVs and leave the PL for their planned activities such as movie/restaurant/shopping mall, etc. This information includes the EVs departure time from home, arrival and departure times to and from PL. The charging and discharging process is controlled by the PL controller where at any scheduling period an appropriate preference value for decision is Energies 2020, 13, 4634 7 of 31 made according to the SoC req , RPD, and the UAP from the power grid through the use of the fuzzy inference mechanism. The aforementioned input parameters are based on the PDFs obtained from the NHTS and from the power grid.
Energies 2020, 13, 4634 7 of 31 UAP from the power grid through the use of the fuzzy inference mechanism. The aforementioned input parameters are based on the PDFs obtained from the NHTS and from the power grid.

National Household Survey Data and the Probability based Functions
The NHTS labels the travel behavior of the American public and collects periodic national survey data for the transportation planners and policy makers [27]. The NHTS data report 2009 has a total of 1,048,575 single trips collected within a 24 h period with 150 attributes per trip [28]. An EV can make three different trips such as home-based-work (HBW), non-home-based (NHB) and homebased-other (HBO) [29].
The study in [30] explored three trips in two different versions. In version A, the first trip originates from home and travel miles to the workplace; the second trip is from the workplace to some intermediate place with a short traveling distance of miles, while the third trip begins from the intermediate place and travel miles to reach back to the home. Similarly, the trip in version B includes, starting from the home to the intermediate place with a short distance of miles, then from the intermediate place to the workplace with miles and finally from the workplace back to home covering miles. The intermediate places represent multiple locations for temporary visits with a short stay time such as shopping malls, medical care centers, and post offices, etc. The home and the workplace represent permanent locations such as each driver has a known home and workplace [31]. Based on the evidence of visiting locations such as permanent & temporary with the short/long stay of EVs, this work categorizes the trip of EVs into routine trips and non-routine trips. The routine trip is considered to be between the home and the workplace while the non-routine trip consists of a trip between three different places such as home, intermediate place and workplace, as shown in Figure 2. A detail of PDFs is given below:

National Household Survey Data and the Probability based Functions
The NHTS labels the travel behavior of the American public and collects periodic national survey data for the transportation planners and policy makers [27]. The NHTS data report 2009 has a total of 1,048,575 single trips collected within a 24 h period with 150 attributes per trip [28]. An EV can make three different trips such as home-based-work (HBW), non-home-based (NHB) and home-based-other (HBO) [29].
The study in [30] explored three trips in two different versions. In version A, the first trip originates from home and travel l 1 miles to the workplace; the second trip is from the workplace to some intermediate place with a short traveling distance of l 2 miles, while the third trip begins from the intermediate place and travel l 3 miles to reach back to the home. Similarly, the trip in version B includes, starting from the home to the intermediate place with a short distance of l 1 miles, then from the intermediate place to the workplace with l 2 miles and finally from the workplace back to home covering l 3 miles. The intermediate places represent multiple locations for temporary visits with a short stay time such as shopping malls, medical care centers, and post offices, etc. The home and the workplace represent permanent locations such as each driver has a known home and workplace [31]. Based on the evidence of visiting locations such as permanent & temporary with the short/long stay of EVs, this work categorizes the trip of EVs into routine trips and non-routine trips. The routine trip is considered to be between the home and the workplace while the non-routine trip consists of a trip between three different places such as home, intermediate place and workplace, as shown in Figure 2. A detail of PDFs is given below: (1) Arrival and departure PDF: The arrival time (from home to PL) and departure time (from PL to home) of EVs are considered to follow a normal distribution function as given in Equation (1) and shown in Figure 3a, and Figure 3b, respectively [32]: where the mean for arrival and departure to/from home and PL are µ home arr = 17.01, µ home dep = 9.97, µ PL arr = 10 and µ PL dep = 16, respectively. Similarly, the standard deviation for arrival and departure to/from home and PL are σ home arr = σ PL arr = 3.2 and σ home dep = σ PL dep = 2.2, respectively. The mean and standard deviation values are obtained from the NHTS-2009 data based on [32].
(2) Traveled distance PDF: A normal distribution with µ tra dis = 3.744 and σ tra dis = 0.396 is considered for traveled distance in [33]. However, for sizable battery capacity with longer all-electric range (AER) [34], this work considers a normal distribution with µ tra dis = 7.488 and σ tra dis = 0.792 to model the traveled distance as shown in Figure 3c.
(3) Parking duration PDF: A normal distribution function with µ PD EV = 8.99 and σ PD EV = 1.92 is considered to model the parking duration of EVs as shown in Figure 3d. The values for mean and standard deviation are given in Ref. [35] provide a reasonable parking duration; therefore, the same values are adopted in this work. (1) Arrival and departure PDF: The arrival time (from home to PL) and departure time (from PL to home) of EVs are considered to follow a normal distribution function as given in Equation (1) and shown in Figure 3a, and Figure 3b, respectively [32]: where the mean for arrival and departure to/from home and PL are  (1) Arrival and departure PDF: The arrival time (from home to PL) and departure time (from PL to home) of EVs are considered to follow a normal distribution function as given in Equation (1) and shown in Figure 3a, and Figure 3b, respectively [32]: where the mean for arrival and departure to/from home and PL are = 17.01, = 9.97, = 10 and = 16, respectively. Similarly, the standard deviation for arrival and departure to/from home and PL are = = 3.2 and = = 2.2, respectively.
The mean and standard deviation values are obtained from the NHTS-2009 data based on [32].

First Stage Fuzzy Logic Inference System
The first stage fuzzy logic inference system is modelled using three different types of linear membership functions. The readers are encouraged to refer to Ref. [19] for the definition and the detail of parameters required to implement the membership functions. The detail of inputs and output parameters for implementing the first stage FIS is given as follows.

Fuzzification of Input Parameters:
The current and required SoCs of an EV are the functions of traveled distance and next traveling trip distance, respectively. The investigation of NHTS 2009 data portrays that the daily traveled distance can be computed by correlating the two independent PDFs of arrival time and departure time events. The first stage FIS is used to correlate the arrival and departure sequence for the traveled distance of each EV. The relevant input and output parameters are the departure time from home, arrival time to PL and the traveled distance (mileage). The PDFs of departure time from home and arrival time to PL are modeled based on mean and standard deviation obtained from the real-time data of the NHTS 2009 report. The real-time data is normalized into time slots such that time slot number 1 represents 12:00 a.m., time slot number 2 represents 12:15 a.m. and so on. The set of crisp inputs needs to be fuzzified for representing it through the degree of membership functions and thus requires the definition of linguistic variables along with their units and ranges. In this work, five membership functions are selected for each of the two input variables. The first input is the departure time from home, which is measured in time slots and its range is from 5:00 a.m. to 3:00 p.m. (Figure 3a These linguistic terms are implemented with two left-right open shoulders and three triangular membership functions. The time slots ranges 29 ≤ µ n EV (PL arr t ) ≤ 41 and 33 ≤ µ n EV (PL arr t ) ≤ 49, denotes the number of EVs in the fuzzy sets VEAPL and EAPL, respectively. The time slots range 41 ≤ µ n EV (PL arr t ) ≤ 57 holds the number of EVs in set NAPL. The ranges 49 ≤ µ n EV (PL arr t ) ≤ 65 and 57 ≤ µ n EV (PL arr t ) ≤ 69 contain the number of EVs in sets LAPL and VLAPL, respectively. The membership functions of departure time from home and arrival time to the PL are depicted in Figure 4a,b, respectively.

Fuzzy Inference System for Traveled Distance:
The fuzzy inference mechanism is basically a function of the degree of membership functions of the input and output variables and the set of expert's rules. The inferred knowledge is the set of the fuzzy variable representing a fuzzified output. Therefore, the definition of the output variable and the fuzzification are required. In this work, the distance travelled M tra (mileage traveled) represents the fuzzy output variable which is modeled based on the PDF of traveled distance, discussed in  Figure 4c. The second step of the fuzzy inference process is to couple the fuzzy rules and the degree of membership functions. The fuzzy rules are the set of processes that map the inputs to the output using the logical IF-THEN statements [36]. The rules are designed according to the expert knowledge for the problem domain and can vary according to the different types of applications [37]. A set of fuzzy rules for the first-stage of FIS is given in Table 1.

Fuzzy Inference System for Traveled Distance:
The fuzzy inference mechanism is basically a function of the degree of membership functions of the input and output variables and the set of expert's rules. The inferred knowledge is the set of the fuzzy variable representing a fuzzified output. Therefore, the definition of the output variable and the fuzzification are required. In this work, the distance travelled (mileage traveled) represents the fuzzy output variable which is modeled based on the PDF of traveled distance, discussed in

Defuzzification of Traveled Distance:
The defuzzification is a process that converts the fuzzified output of FIS into crisp value. There are different standards of defuzzification methods such as the Center of Gravity (COG), Middle of Maxima (MOM), First of Maxima (FOM) and Last of Maxima (LOM) and Random Choice of Maxima (RCOM) for computing the most certain crisp value. Following our previous work, this work models the FIS using the COG method for correlating the two input variables to compute the traveled distance [19,20].

Problem Formulation and Objective Function
Most of the EVs are fully charged when they arrived home from work and consume energy during the day [38,39]. Therefore, SoC and the SoC req of an EV are the functions of the traveled distance, next trip distance, all-electric range (AER) and the battery capacity and can be computed according to Equations (2) and (3) [40]: where AER EV i is the maximum distance that an ith battery electric vehicle (BEV) or Plug-in Hybrid Electric Vehicle (PHEV) can travel by using only electric energy without the use of the internal combustion engine [41]. The variables M tra EV i and M NTD EV i are the travelled and next trip distances in miles of the ith EV. To extend the battery life, a minimum margin value of SoC is considered to be 20% of the battery capacity. It is assumed the EV owners with stored energy higher than the required energy for the next trip distance are willing to sell their excess energy. Therefore, the PL control center determines the G2V and V2G operation for the EVs depending on their initial and required SoCs. Based on the difference of the initial and required SoCs, three cases can be considered to categorize the EVs for G2V, V2G and Idle operations [40].

•
G2V operation: The EVs are considered to perform the G2V if their required SoCs are greater than their corresponding initial SoCs. • V2G operation: The EVs with required SoCs less than their initial SoCs are scheduled to participate in V2G operation. • Idle (no-participation): The EVs are considered to remain idle if their required SoCs are equivalent to their initial SoCs.
The amount of charging energy until the SoC req and the full battery capacity in G2V operation can be computed according to Equation (4) while the amount of discharging energy in V2G operation can be computed according to Equation (5). The amount of charging and discharging of an EV is 0 (i.e., idle/no participation in G2V and V2G) if it's current and required SoCs are equivalent, as given in Equation (6): where E G2V , and BC EV i are the charging energy, discharging energy and battery capacity of the ith EV, respectively. The total amount of required energy for the PL at each time instance t can be computed Energies 2020, 13, 4634 12 of 31 by summing up the charging and discharging energies (E PL total ) of the total number of participating EVs in G2V and V2G operations, as given by Equation (7). The aggregation of baseload (BL) and the PL load represents the total power consumption/load (TL) of any node and can be computed according to Equation (8): The baseload represents the power consumption of the customers (households, buildings, etc.) connected to a certain bus without considering the PL load. Each of the connection points (i.e., a transformer) has a defined capacity; therefore, in each scheduling period the total imported power should be maintained within the permissible limit. Since the baseload is the fundamental requirement of customers and is considered to be an uncontrolled load while the PL load is flexible and needs to be managed. The grid operators define certain boundary lines for the smooth operation of the power grid that must not be violated [42]. In this paper, these boundaries are considered to be Upper Reference Power Limit (URPL) and Lower Reference Power Limit (LRPL) for G2V and V2G operations, respectively, and given by Equations (9) and (10). The available power (AP) from the grid at any time t can thus be a function of the URPL and the baseload and can be computed as expressed by Equation (11). Similarly, the updated available power (UAP) is a function of G2V, V2G, and AP and at any time t can be computed according to Equation (12): where Trans cap , BL o f f Peak load , T are the transformer capacity, off-peak of baseload, and total number of time slots, respectively. The term ω is a stability factor defined by the network system operators. The grid operators have to consider the correlation of the PL charging and discharging, total energy and the UAP while allocating power to the distribution transformer connected to the bus. The correlation of total PL energy (Equation (7)) and the updated available power (Equation (12)) can be defined in two cases [17]: Case 1: The amount of total energy of PL at any time t is less than or equivalent to the updated available power. Since available power is enough to support the charging requirements of EVs; therefore, in this case, there is no need to control the charging activities of EVs. The expression of Case 1 is given by Equation (13): Case 2: The energy demand of PL at any time t is higher than the updated available power, as given by the expression in Equation (14). In such a situation, the PL operators need to reduce the total energy demand by restricting the charging operations of certain EVs. A management algorithm is required to select the most appropriate EVs for charging operations: Energies 2020, 13, 4634 13 of 31 The TSFLIA aims to intelligently control the charging demand of EVs within the power grid URPL by allowing the most needed EVs to charge until their required SoC while shifting the charging operations of others into latter time slots. To limit the energy demand of PL during the time slots where Case 2 is applicable, we defined the objective function of minimizing the PL load with the contribution of preference (PF) variable for each of the ith EVs as expressed by Equation (15): where P T is the total operating hours of the parking lot, C is a binary variable representing the presence and absence of EVs with 1 and 0 at any time t, n is the charging and discharge efficiency, P CD is the charging and discharging power. The decision variable D EV i is a binary variable and it depends on the type of EV participation, the value of PF variable, the accumulated load, URPL, and LRPL and at any time t its value can be computed by Equation (16): The value of the PF variable for each EV is computed by the second stage of the TSFLIA and is discussed in the subsequent section. Each of the ith EV has a stay time in parking (i.e., parking duration) with a subset of charging and discharging operation period of time. Therefore, depending on the participation of EVs in G2V and V2G, the charging and discharging period of time for each of the ith EV can be defined by Equation (17). The optimization function defined in Equation (15) has to satisfy several technical and nontechnical constraints: Parking Lot Timing Constraints: The PL has a defined starting time t P st and ending time P T . The arrival time and departure time of the ith EV should follow the starting and ending time of the PL as expressed by Equations (18) and (19), respectively. Also, the charging and discharging duration T CD EV i of t the ith EV should be within its arrival to PL (PL arr EV i ) and departure from PL (PL dep EV i ) as expressed by Equation (20).
PL arr Battery Efficiency Constraints: The battery efficiency is an important factor which needs to be maintained during the charging and discharging operations. Each battery has a standard minimum dept of discharge (DoD) such as 20% of battery capacity, maximum SoC max EV i , and the maximum number of battery charging cycles B max_cyc EV i [43]. These standard limits should be satisfied at any time t during the charging and discharging operations of EVs and can be expressed by Equation (21) and Equation (22). Also, the charging and discharging power affect the battery life, therefore; at any time t, the Energies 2020, 13, 4634 14 of 31 discharging power (P D ) and charging power (P C ) power should follow the minimum (P DS min ) and maximum (P CH max ) allowable power limits as expressed by Equations (23) and (24): Total Load Constraints: The total load (i.e., the baseload and the PL) at any time t should follow the upper and lower reference power limits to maintain a smooth operation of the smart grid as expressed by Equation (25):

Second Stage Fuzzy Logic Inference System
The objective function defined in Equation (15) optimizes the energy consumption of PL using the decision variable D which is dependent on the value of the PF variable for each of the ith EV. The computation of the PF variable involves several temporal varying factors with uncertainties and is a complicated task. This work estimates an adequate value of PF through the credibility of second stage FIS, which correlates the temporal based varying uncertain parameters from the power grid and EV domains. The most admissible parameters that can influence the preference value for each of the EVs are the UAP, SoC req , and the owner's choice of RPD. Therefore, these parameters are considered as the input variables to the second stage of FIS. Each of the inputs is normalized and linearized in their corresponding minimum and maximum ranges and fuzzified to be represented through membership functions.
The PDF of parking duration in Figure 3d is considered to model the first input i.e., RPD. The 12 h from 4-16 h are normalized from short duration to the long duration and are linearly structured between 0 to 48 time slots. The RPD is represented through three linguistic terms: Short Duration (SD), Average Duration (AD), and Long Duration (LD) [44]. The second input is the SoC req which is normalized from very low to very high and is represented in 0-1. The SoC req is modeled with five linguistic terms including Very Low (VL), Low (L), Medium (M), High (H) and Very High (VH) respectively. Similarly, the UAP is normalized from low available power to high available power and is linearly structured in the range 0-200 [20]. The number of inference rules depends upon the number of input variables and their membership functions [45]. There are three input variables where the first input has three membership functions and each of the other two inputs has five membership functions. To infer the knowledge for the PF variable, a total of 3 × 5 × 5 = 75 inference rules are defined in Tables 2-4. The fuzzified output of the inference system is obtained through the Mamdani min-max aggregation method. The crisp value of the PF variable is obtained using the COG defuzzification method. The procedure of the Mamdani min-max aggregation method and the defuzzification of the PF variable are illustrated in the example given below. The number of inference rules depends upon the number of input variables and their membership functions [45]. There are three input variables where the first input has three membership functions and each of the other two inputs has five membership functions. To infer the knowledge for the PF variable, a total of 3 × 5 × 5 = 75 inference rules are defined in Tables 2-4. The fuzzified output of the inference system is obtained through the Mamdani min-max aggregation method. The crisp value of the PF variable is obtained using the COG defuzzification method. The procedure of the Mamdani min-max aggregation method and the defuzzification of the PF variable are illustrated in the example given below.     Let at any time t, there is an EV in the PL with a battery capacity of 60 kWh, remaining parking duration of 7-time slots, and the required SoC is 0.46 (28 kWh  The aggregated charge/discharge load of EVs affect the total power imported from the power grid. This impact is due to the simultaneous charging/discharging EVs and can be measured in terms of percentage by considering the URPL and the new peak-load as given by Equation (26). The EV owners QoE represent their level of satisfaction and is a basic factor to analyze the performance of the PL. The QoE of the EV owners is the SoC req and for the ith EV, it can be computed based on the and as given by Equation (27). The negative sign in Equation (27) shows the discharging The aggregated charge/discharge load of EVs affect the total power imported from the power grid. This impact is due to the simultaneous charging/discharging EVs and can be measured in terms of percentage by considering the URPL and the new peak-load as given by Equation (26). The EV owners QoE represent their level of satisfaction and is a basic factor to analyze the performance of the PL. The QoE of the EV owners is the SoC req and for the ith EV, it can be computed based on the SoC req EV i and BC EV i as given by Equation (27). The negative sign in Equation (27) shows the discharging of EV. The EVs with satisfied and unsatisfied QoE are represented by N EVsatis f ied and N EVUnsatis f ied variables, respectively. The PL QoP is the function of EVs with satisfied/unsatisfied QoE and the total number of EVs and can as given by Equation (28):  of SoC EV , SoC req EV and F EV to the main algorithm. In the case, if there is no arrival of any new EV such that n EV = 0, the algorithm proceeds with the consequent steps and based on the number of EVs requesting for discharging operations, it computes the updated available power for the current time t according to Equation (12). The total number (N cha EV ) of EVs that can be supported by the updated available power is computed in step 19. From step 20 to step 25, the Algorithm 1 iterates through each of the CSs to check their status, if there are connected EVs with remaining parking duration their G2V and V2G operations are then scheduled by triggering the Algorithm 4: Second_stage_FLM. The services of this sub-algorithm are called by passing the list of arguments such as UAP, PF EV , RPD EV , SoC req EV , SoC EV , N cha EV , D EV , i, j, to it. In this sub-algorithm, the fuzzy inference mechanism evaluates the UAP, RPD EV and SoC req EV to approximate the preference value for the current EV and then resort the updated list of preferences values i.e., PF EV in descending order. Based on the total number of allowable EVs, the sorted list PF EV , and the current and require SoCs the list D EV is updated and constraints defined by Equations (21) and (22) are validated. This updated lists PF EV and D EV are then returned to the main Algorithm 1.
Compute the QoE and the QoP /* According to Equation (27) and Equation (28

Simulation Setting and Assumption
This study adopts the IEEE 34-node bus system which is downscaled from 24.9 kV to 230 V such that this power network represents a residential distribution system [46]. The modified layout of the IEEE 34-node network is presented in Figure 7 which has six spot loads, and 27 distributed loads and the bus number 800 is connected to the power transmission source [47]. The total residential load of each node depends upon the total number of connected houses and their consumption in a day. We assume an average household consumption of about 2.78 kW [48] and a load factor of 70% for each lumped loads of IEEE 34-node system to determine the number of connected houses as given by Equation (29) [49]. The number of connected houses to each of the buses is computed for the six spot loads and 27 distributed loads and is given in the last column of Tables 5 and 6, respectively. The candidate buses for the PL are assumed to be 808, 810, 820, 822, 826, 828, 834, 838, 844, 846, and 856. This work assumes three PLs connected to bus number 820, 834, and 844, respectively. The total residential load (i.e., baseload) profiles connected to these buses is shown in Figure 8. Most of the PLs are operating during the daytime, such that they have operation hours P T from morning 7:00 a.m. to 7:00 p.m. evening [49]. Thus, the simulation is carried out for 12 h where each hour is sampled with a 15 min resolution. The total number of time slots T max is thus computed as 48-time slots. The entire system is developed using Eclipse software where the jFuzzyLogic libraries are utilized to build up the two stages of FIS [50]. The EVs considered in this work are of four different types such as Nissan  [51][52][53][54]. The AER of an EV is a function of battery capacity and its energy consumption rate and can be obtained through Equation (30) [49].

Houses bus j =
Lumped_load bus j * load_ f actor bus j Avg_consumption house (29) where ECR EV i is the energy consumption rate of the ith EV and is measured in kWh per mile. This work considered the ECR values 0.34, 0.36, 0.38, and 0.37 kWh/mile for Nissan LEAF, Tesla-S, Tesla model-3 and Tesla model-X, respectively [55]. In this way, the AERs obtained for the four types of EVs are 115 miles, 165 miles, 210 miles, and 270 miles, respectively. A total of 200 EVs is randomly distributed with different penetration levels for each type of EVs as shown in Table 7. In this work it is assumed that each of the parking spots has a fast CS, where each of the CS has charge/discharge rate of 20 kWh [56] and the EVs owners provide the information of the next traveling distance to the PL operators. Three different scenarios are simulated for buses number 820, 834 and 844, where the PLs are connected. The departure time from home is randomly generated with a µ = 41 slot-number and σ = 8 time-slots using Gaussian distribution. The arrival time and departure time to/from the PL are randomly generated with the mean values of time slot numbers 49 and 55, respectively, and a σ = 12-time slots through Gaussian distribution. These random behaviors of EVs for the three PLs connected to buses number 820, 834, and 844 are depicted in Figure 9. The random arrival and departure sequence of EVs results in a different parking duration or parking occupancy, as shown in Figure 10. The lumped load of the three buses is considered for assuming the Trans cap capacity and similarly the average load profile is considered for the value of ω, which is 10% of the average load profile. The charging and discharging efficiency η is considered to be about 0.90 [57].

Simulation Setting and Assumption
This study adopts the IEEE 34-node bus system which is downscaled from 24.9 kV to 230 V such that this power network represents a residential distribution system [46]. The modified layout of the IEEE 34-node network is presented in Figure 7 which has six spot loads, and 27 distributed loads and the bus number 800 is connected to the power transmission source [47]. The total residential load of each node depends upon the total number of connected houses and their consumption in a day. We assume an average household consumption of about 2.78 kW [48] and a load factor of 70% for each lumped loads of IEEE 34-node system to determine the number of connected houses as given by Equation (29) [49]. The number of connected houses to each of the buses is computed for the six spot loads and 27 distributed loads and is given in the last column of Tables 5 and 6, respectively. The candidate buses for the PL are assumed to be 808, 810, 820, 822, 826, 828, 834, 838, 844, 846, and 856. This work assumes three PLs connected to bus number 820, 834, and 844, respectively. The total residential load (i.e., baseload) profiles connected to these buses is shown in Figure 8. Most of the PLs are operating during the daytime, such that they have operation hours from morning 7:00 a.m. to 7:00 p.m. evening [49]. Thus, the simulation is carried out for 12 h where each hour is sampled with a 15 min resolution. The total number of time slots is thus computed as 48-time slots. The entire system is developed using Eclipse software where the jFuzzyLogic libraries are utilized to build up the two stages of FIS [50]. The EVs considered in this work are of four different types such as Nissan LEAF with 40.0 kWh battery, Tesla-S with 60.0 kWh battery, Tesla model-3 with 80.5 kWh battery, and Tesla model-X with 100.0 kWh battery, respectively [51][52][53][54]. The AER of an EV is a function of battery capacity and its energy consumption rate and can be obtained through Equation (30) [49].
where is the energy consumption rate of the ith EV and is measured in kWh per mile. This work considered the values 0.34, 0.36, 0.38, and 0.37 kWh/mile for Nissan LEAF, Tesla-S, Tesla model-3 and Tesla model-X, respectively [55]. In this way, the AERs obtained for the four types of EVs are 115 miles, 165 miles, 210 miles, and 270 miles, respectively. A total of 200 EVs is randomly distributed with different penetration levels for each type of EVs as shown in Table 7. In this work it is assumed that each of the parking spots has a fast CS, where each of the CS has charge/discharge rate of 20 kWh [56] and the EVs owners provide the information of the next traveling distance to the PL operators. Three different scenarios are simulated for buses number 820, 834 and 844, where the PLs are connected. The departure time from home is randomly generated with a = 41 slot-number and = 8 time-slots using Gaussian distribution. The arrival time and departure time to/from the PL  Figure 9. The random arrival and departure sequence of EVs results in a different parking duration or parking occupancy, as shown in Figure 10. The lumped load of the three buses is considered for assuming the capacity and similarly the average load profile is considered for the value of ω, which is 10% of the average load profile. The charging and discharging efficiency η is considered to be about 0.90 [57].

Simulation Results
To evaluate the TSFLIA scheme, the performance of the proposed TSFLIA is compared with the scheme given in [20]. The scheme given in [20] is more effective as compared to the conventional FCFS-based scheme; however, with time as the parking occupancies increases, its performance degrades in terms of the EV owner's QoE. The reason for this performance degradation is due to the inefficient assumption made for charging and discharging of the EVs. Two types of requirements such as the power grid operation limits and the PL QoP in terms of QoE satisfaction for the EV owners are considered as the performance criteria. The power grid operation is the function of URPL and the peak-load and is measured in terms of the percentage. The EV owner's QoE refers to the amount of charge/discharge energies of EVs required at their departure time and thus representing their level of satisfaction. The QoP is the ratio of EVs with QoE to the total number of EVs.
The results in Figure 11 show the battery capacities, the SoCs and SoC req of EVs in the PL connected to buses number 820, 834 and 844, respectively. The SoCs at the time of arrival are computed based on their traveled distance, while the required SoCs are computed according to their next traveling distance. It can be observed that in each of the PLs, a different number of EVs are requesting for charging and discharging operations. The EVs requesting the charging operations are about 58%, 61.5% and 66.5%, while the EVs with discharging requests are about 42%, 38.5% and 33.5% in the PLs at buses number 820, 834 and 844, respectively. The charging and discharging behaviors of these PLs with respect to the two different schemes are shown in Figure 12. The FLIA schedules the EVs according to the logic α-cut and β-cut properties of fuzzy logic theory where these values were set as α = 0.8 and β = 0.3. The EVs with the value of PF variable equal to or less than β values are scheduled for charging while those with the value of PF variable equal to or greater than α are scheduled for discharging operations. The TSFLIA computes the required SoC according to the next trip traveling distance and utilizes the available power more efficiently for maximizing the EV owners QoE.
the EVs according to the logic α-cut and β-cut properties of fuzzy logic theory where these values were set as α = 0.8 and β = 0.3. The EVs with the value of PF variable equal to or less than β values are scheduled for charging while those with the value of PF variable equal to or greater than α are scheduled for discharging operations. The TSFLIA computes the required SoC according to the next trip traveling distance and utilizes the available power more efficiently for maximizing the EV owners QoE.   In PL 820 (Figure 12a), a consistent charging and discharging between the time slots 35 to 64 can be observed with FLIA. The TSFLIA performs the charging and discharging operations according to the required SoC and mitigates the charging load by keeping those EVs withhold which have longer stay time. Their recharging is performed in the later time slots as can be observed from time slots 62 to 77. In PL 834 (Figure 12b), the FLIA and TSFLIA perform the charging and discharging operations  In PL 820 (Figure 12a), a consistent charging and discharging between the time slots 35 to 64 can be observed with FLIA. The TSFLIA performs the charging and discharging operations according to the required SoC and mitigates the charging load by keeping those EVs withhold which have longer stay time. Their recharging is performed in the later time slots as can be observed from time slots 62 to 77. In PL 834 (Figure 12b), the FLIA and TSFLIA perform the charging and discharging operations differently according to the scheduling mechanism of the algorithms which considers the remaining parking duration, required SoCs, and the available power, respectively. The FLIA schedule the charging and discharging for most of the EVs between time slots 45 to 64. While the TSFLIA first charge the EVs between time slots 40 to 56 where the peak charging is at time slot 48 and then perform the requested charging and discharging between time slots 63 to 75. Due to the limited power availability and discharging more number of EVs, the charging behavior with the FLIA scheme is not significant as compared to the TSFLIA scheme.
In PL 844 (Figure 12c), a limited number of EVs are scheduled for discharging with the FLIA scheme. This is because the available power is enough to accommodate the charging load of EVs. However, in this case, the TSFLIA discharge only those EVs which requested the V2G operations.
Following the charging and discharging behavior of EVs, the aggregated total load with respect to each scheme for buses number 820, 834 and 844 are shown in Figure 13. The URPL for each for each of the buses is computed according to the baseload and the transformer capacity of the buses. The URPL for bus number 820 is 128.13 kW, 146.88 kW for bus number 834, and 376.16 kW for bus number 844, as shown with red dashed lines ( Figure 13). Both the FLIA and TSLFIA schemes are respecting the power grid operational limits and thus keeps the total load within the URPL. The TSFLIA charges the EVs until their required SoCs while FLIA charges the EVs until their battery capacities. Therefore, the TSFLIA is able to efficiently utilize the available power and satisfy the QoE for most of the EVs as compared to the FLIA. Each of the two schemes results in a different QoP measurement as shown in Figure 14.     For all the PLs connected to the three buses, the TSFLIA scheme achieves a higher QoP as compared to the FLIA. The QoP with FLIA and TSFLIA is 57.5% and 68.5%, respectively, (Figure 14a) for the PL connected to the bus number 820. Similarly, the QoP of the PL connected to the bus number 834 is about 27% with FLIA and 46% with TSFLIA as can be observed from Figure 14b.
The reason for this low QoP is due to the limited huge baseload which results in limited available power. A progressive performance in terms of QoP with the two schemes at PL connect to bus number 844 can be observed in Figure 14c. The reason is that there is enough available power that fulfills the QoE for more EV owners during their parking duration. The PL attached to bus number 844 has 72% with FLIA scheme, and 85% with the proposed TSFLIA scheme, as can be seen from Figure 14c. The results of PL at bus number 820 show that the QoP with TSFLIA has been improved by about 20% compared to the FLIA scheme. In the case of PLs connected to buses number 834 and 844, the results depict that the TSFLIA has a higher QoP of about 19% and 13%, respectively, compared to the FLIA scheme. This implies that when the available power is limited, the scheduling for discharging EVs results in obtaining a higher QoP.

Conclusions
In this paper, we proposed a two-stage fuzzy logic inference based algorithm to schedule the charging and discharging operations of EVs that maximized the quality of performance for PLs under the operational constraints of the power grid. The probability density functions of EVs arrival and departure times obtained from the NHTS data have been utilized to model the first stage fuzzy inference mechanism which calculates the amount of charging and discharging energies of EVs according to their next trip distances. Based on the energy requirements, the operations of EVs were categorized into G2V, V2G and idle. Once the EVs participations and their energy requirements were known, the services of the second stage fuzzy inference mechanism were exploited to control the operations of EVs. The proposed scheme was applied to three PLs connected to the buses number 820, 834 and Energies 2020, 13, 4634 28 of 31 844 of the IEEE 34-node distribution system. The simulation was carried out by considering 200 EVs with different penetration levels for each of the PLs. The simulation results verified the feasibility and effectiveness of the proposed scheme against the FLIA scheme. In more detail, the TSFLIA has maximized the QoP by about 11%, 19%, and 13% compared to FLIA for the PLs connected to the buses number 820, 834, and 844, respectively.
Research limitations: There are several other aspects such as forecasting the next trip distance and robustness analysis in terms of time analysis & fairness of the proposed algorithm. In the future, the work will be extended with sophisticated scenarios for approximating an adequate next trip distance requirement using neural network models, and conducting fairness and time analysis (i.e., complexity and execution time).
Research Implications: In order to realize the role of electric vehicles as prosumers, the future parking lots are regarded as a platform that can efficiently utilize the EVs aggregated load as well as the power supply resources in grid-to-vehicle and vehicle-to-grid modes. Therefore, there is a need to study the implications of EVs parking lots by developing models for sustainable development such as social, environmental and market economics.