## 2 System Model Formulation
### Overall System Architecture
The EVs having a bidirectional charging capability can be utilized to give electricity to load demand, feed energy back into the utility grid, and provide backup electricity in case of a power outage or emergency. In this system, the discharging power of EVs, which is determined depending on the EV charging/discharging scheduling algorithm, can also be used to supplement the local load demand and charging demand of EVs. When the produced PV power and discharging power of EVs are insufficient for total load demand,the grid power is used. The key role of the proposed EV charging/discharging scheduling algorithm is to decrease the peak load that incurred by the simultaneous charging demand of EVs and minimize the operating cost of the PV-based charging station by selling the PV power and discharging power of EVs to the electric market while supplying them to local load demand. In the PV-based charging station, three charging modes, such as \(M_{0}\) (0 kW), \(M_{1}\) (7 kW), and \(M_{2}\) (19.2 kW), are utilized to satisfy EV owners with different charging requirements and improve the charging service quality [55]. The \(M_{1}\) and \(M_{2}\) mode are included in the level 2 charger which is described as a primary charging method typically used in public facilities [56]. Depending on the EVs' information, such as the predetermined parking time, the current SOC, and target SOC, the charging mode is assigned to each EV. The determination of charging mode for each EV is shown as follows. \[CM_{i}=\left\{ \begin{array}{ll}M_{1}&T_{p,i}\geq T_{c,j}^{M_{1}}+T_{w}\\ M_{2}&T_{c,i}^{M_{1}}+T_{w}>T_{p,i}\geq T_{c,i}^{M_{2}}+T_{w}&\forall i\in I\\ M_{0}&\textit{otherwise}\end{array} \right. \tag{1}\]  
where the identification number of an EV which requires charging is represented by the variable \(i\in{1,2,3,\cdots,I}\), the charging mode of \(i\)-th EV is represented by \(CM_{i}\), the predetermined parking time of \(i\)-th EV is represented by \(T_{p,i}\), the minimum required charging time of \(i\)-th EV in \(M_{1}\) and \(M_{2}\) mode is represented by \(T_{c,i}^{M_{1}}\) and \(T_{c,i}^{M_{2}}\), and the margin time considering discharging of EV is represented by \(T_{w}\). \(T_{c,i}^{M_{1}}\) and \(T_{c,i}^{M_{2}}\) are calculated based on the assumption that each EV is only charged without discharging in the PV-based charging station. In order to utilize EV discharging for the power management of the MG, \(T_{w}\) is added to \(T_{c,i}^{M_{1}}\) and \(T_{c,i}^{M_{2}}\), respectively, to determine the charging mode of each EV. For \(i\)-th EV, if \(T_{p,i}\) is larger than the sum of \(T_{c,i}^{M_{1}}\) and \(T_{w}\), the charging mode is assigned to \(M_{1}\) mode. If \(i\)-th EV is not assigned to \(M_{1}\) mode and the \(T_{p,i}\) is larger than the sum of \(T_{c,i}^{M_{2}}\) and \(T_{w}\), the charging mode is assigned to \(M_{2}\) mode. If \(i\)-th EV is not assigned to \(M_{1}\) or \(M_{2}\) mode, the EV is denied entry to the charging station and its charging mode is assigned to \(M_{0}\) mode. After assigning the charging mode to parked EVs, on-off strategy is applied for EV charging/discharging as it is more practical method than regulating the charging rate to control a number of EVs. Figure 1: Overall system architecture of the PV-based charging station. To describe the driving pattern of a vehicle, the distribution of arrival time at home and workplace is used as shown in Figure 2. The commuter's daily moving pattern during weekdays is considered for the distribution of arrival time. The driving pattern is developed from [57], after analyzing the parking time and driving time of commuters in [58]. From the characteristics of the routine trip of commuters, it is observed that more than 60% of vehicles arrive at workplace from 7:20 to 13:20 h and at home from 15:00 to 21:00 h. As a time interval is considered to be 15 min, the total number of time slots for a day becomes 96 slots. Then all vehicles can be divided into several groups depending on these arrival times.