## 2 Methodology
### PEV Charging Scheduling
#### 2.3.2 Proposed Charging Strategy  
A rule-based algorithm is used in order to schedule the PEV charging. At first, the charging is assigned to the time slots with the lowest electricity price. The time slot is considered as a time period of \(\Delta t=1\) h. Then, a search takes place to find if there are time slots that the PEV can discharge and recharge in a profitable manner. More particular, it searches the time slots with the lowest (t\({}_{1}\)) and the highest (t\({}_{2}\)) electricity price during the parking session in which the charging power is under the permitted power limit, as it is explained below in the charging constrains. The condition that must apply in order for the PEV to participate in the discharging process is shown in Equation (1). Finally, the discharging power is calculated depending on the available charging power at the t\({}_{1}\) and t\({}_{2}\). \[n_{\text{ch}}\cdot n_{\text{dis}}>\frac{C(t_{\text{B}})}{C(t_{\text{S}})} \tag{1}\]  
where n\({}_{\text{ch}}\) and n\({}_{\text{dis}}\) are the charging and discharging efficiencies. In this study they are considered equal, and both are being represented by the n parameter. This coefficient is considered to be equal to 0.93 and it represents the energy losses during the charging and discharging process. The t\({}_{\text{B}}\) and t\({}_{\text{S}}\) are the time slots that the energy will be bought from and sold to the grid, respectively. C is the electricity price. The flowchart of the proposed charging strategy is illustrated in Figure 4.  
Figure 3: Arriving PEV state of charge probability. The charging constrains are formulated in Equations (2)-(4). \[-P_{limit}\ \leq\ P(i,t)\ \leq\ P_{limit} \tag{2}\]  
\[E_{min}(i)\ \leq\ \sum_{t_{A}}^{t_{D}-1}(ch(i,t)\cdot n\ -\ dch(i,t))\cdot P(i,t) \cdot\Delta t\ +\ E_{A}(i)\ \leq\ E_{max}(i) \tag{3}\]  
\[\sum_{t_{A}}^{t_{D}-1}(ch(i,t)\cdot n\ -\ dch(i,t))\cdot P(i,t)\cdot\Delta t\ +\ E_{A}(i)=\ E_{D}(i) \tag{4}\]  
where \(P_{limit}\) depends on the charger and PEV power limitation, \(E_{min}(i)\) is the lowest energy limit of the ith PEV which is considered the 20% of the SoC and \(E_{max}(i)\) is the upper power limit which is considered 100% of the SoC. The ch(i,t) is a binary variable set to 1 when the P(i,t) is positive and 0 otherwise. Similarly for the dch(i,t), with the differentiation that it is set to 1 when P(i,t) is negative. \(E_{D}(i)\) is the desirable energy of the ith PEV during its departure. In fact, the algorithm calculates the PEV charging schedule based solely on the electricity price criterion. Hence, in this format, the discussed charging strategy would not take into consideration the PV production. The proposed charging method that is taking into consideration only the electricity price is referred as s1. A modification in the price, that the proposed algorithm is taking as criterion, is introduced as shown in Equation (5) to alleviate this issue. This case of the proposed charging method is referred to as s2. The charging cost in the case of the s2 is evaluated with the real electricity price. \[C_{new}(t)=\ C(t)\cdot(c1(t)+\ c2(t)) \tag{5}\]  
Seasonal average PV generation curves are estimated from the known yearly data of the PV generation in order to calculate the factor c1 which varies between 0 and 1. When  
Figure 4: Flowchart of the proposed charging strategy. the estimated PV generation is the lowest, then c1 is set to 0 and vice versa. c2 is a value that is set between 0 and 1 depending on the electricity price during the parking period of each PEV. It is set to 1 when the electricity price gets its maximum value during the parking duration and to 0 when the electricity price gets its minimum value. In particular, in s1, during the parking duration, energy is saved to the PEVs' battery when the electricity price is relatively \"low\". The energy is sold back to the grid or supplies the microgrid when the electricity price is relatively \"high\".