## 3 Proposed Methodology
### Utilization of RES by End Users  
The end users utilize rooftop solar panels and a plug-in hybrid electric vehicle with V2G capability. The solar panel characteristics are assumed to be similar to those specified in Section 3.1. With regard to the day-ahead market, there are operating procedures for the electric vehicles (EVs) for each end user depending on whether the EV is charging or discharging within a given time slot within the day [36]:  
\[P_{real,m}^{min}(t)=min\left(\left|B_{c,m,j}\ast\frac{60}{t_{i}}-a\right|,b_{1 }\right)\ast Ch_{m,j}(t), \tag{12}\]  
\[P_{real,m}^{max}(t)=min(|a|,b_{2})\ast Ch_{m,j}(t), \tag{13}\]  
where  
\[a=\left(1-S_{m,j}(t)\right)\ast\ B_{c,m,j}\ast\frac{60}{t_{i}}-\eta_{m,j}\ast p _{m}(t), \tag{14}\]  
\[b_{1}=p_{max,m}+p_{m}(t), \tag{15}\]  
\[b_{2}=p_{max,m}-p_{m}(t). \tag{16}\]  
This system of bidirectional energy flow between the grid and the EVs provides a symbiotic relationship between both the grid and EVs. This provides incentives to EV users to pool the collective capacities of their vehicles together in order to maximize energy cost savings through the DR aggregator. In other words, the aggregator uses the benefits of V2G capability for the benefit of both the end users and the DSO. The optimal EV scheduling by the DR aggregator is specified according to [36]:  
\[ \begin{array}{ll}F_{EV,\ DA}(t)=&\max(\sum\limits_{t=1}^{T}{(P_{EV,up}(t)+P_{ EV,down}(t)+P_{SR})}\\ &+\sum\limits_{m=1}^{N}{\sum\limits_{t=1}^{T}{S_{op,m,j}(t)-\sum\limits_{m=1}^ {N}{\sum\limits_{t=1}^{T}{P_{dis,m,j}(t)\cdot P_{e}(t)-\sum\limits_{m=1}^{N}{ \sum\limits_{t=1}^{T}{B_{deg,m,j}(t)}}}}}}\\ \end{array}  \tag{17}\]  
where  
\[ \begin{array}{ll}P_{EV,up}(t)=\sum\limits_{m=1}^{N}{P_{draw,\ m,j}^{min}(t) },\\ \\ P_{EV,down}(t)=\sum\limits_{m=1}^{N}{P_{draw,\ m,j}^{max}(t)}).\end{array}  \tag{18}\]  
Equation (17) maximizes the reward to the end user with the EV as advised by the DR aggregator. Here we consider the effect of EV battery degradation over time as well as the maximum power discharged by the battery within a given time slot due to commuting, considering unplanned vehicle trips. Equations (18) and (19) specify the conditions for EV up- and down-regulator capacity (for vehicle-to-grid and grid-to-vehicle modes respectively). With respect to maintaining EV battery health over charging cycles, Equations (18) and (19) ensure that charging is scheduled such that there are rest intervals between charge cycles. This ensures that charging is done without undue stress on battery cells [36]. In general, the concept of DR aggregation involves maximization of benefits to all stakeholders in the energy distribution chain. Therefore, with regard to ensuring the battery health of EVs, effective charging is a priority since the EV battery is the most expensive single component in the vehicle. Equation (17) is subject to the following constraints:  
\[ \begin{array}{ll}P_{op,m,j}(t)(1-Cl_{m,j}(t))=0,\end{array}  \tag{20}\]  
\[\begin{array}{ll}P_{drnav,m,j}^{max}(t)(1-Cl_{m,j}(t))=0,\end  
\[\sum_{m=1}^{N}P_{\varphi,m,j}(t)-\left(\frac{L_{DA,max}-L_{DA}(t)}{L_{DA,max}-L_{DA, min}}\right)\cdot\sum_{m=1}^{N}P_{max,m,m,j}(t)Cl_{m,j}(t)<0, \tag{31}\]  
\[B_{deg,m,j}(t)-\left[\left(P_{\varphi,m,j}(t)-P_{dmw,m,j}^{min}(t)-P_{SR,m,j}^{ rad}(t)\right)C_{deg,m,j}\cdot f_{comp,m,j}(t)\right]/\eta_{m,j}\geq 0, \tag{32}\]  
\[P_{\varphi,m,j}(t)+P_{max,m,j}(t)\geq 0, \tag{33}\]  
\[P_{dmw,m,j}^{max}(t)\geq 0, \tag{34}\]  
\[P_{dmw,m,j}^{min}(t)\geq 0, \tag{35}\]  
\[P_{SR,m,j}^{ord}(t)\geq 0, \tag{36}\]  
\[B_{deg,m,j}(t)\geq 0. \tag{37}\]  
Equations (20)-(23) specify constraints for monitoring the charging status of the EV battery in each aggregator cluster. Nominal power drawn from the EV battery is maintained at acceptable levels by ensuring that maximum power is drawn when the battery is at \(\geq\)70% of full capacity, and minimum power is drawn when the battery is at \(\leq\)30% of full capacity. This state is maintained when the EV is either commuting or charging.