# Optimal Coordination of PV Active Power Curtailment and EVs Charging among Aggregators
## 2 Mathematical Modelling of PVs and EVs
### Individual EV Model  
The charging process of an EV \(j\) managed by an aggregator \(k\) can be modelled by its power and energy boundaries (\(\epsilon_{k,j}^{upper/lower},p_{k,j}^{upper}\)), which enclose the optimal charging paths that fulfill its energy requirements. These boundaries are based on the arrival/objective energy level of each EV \(j\), which can be calculated using Equations (2) and (3).  
\[\epsilon_{k,j}^{arr}=SOC_{max}\cdot BC_{k,j}-ECR_{k,j}\cdot d_{k,j} \tag{2}\] \[\epsilon_{k,j}^{obj}=SOC_{k,j}^{obj}\cdot BC_{k,j} \tag{3}\]  
where \(BC_{k,j}\) is the battery capacity of the vehicle in kWh; \(SOC_{max}\) is the maximum state of charge of the vehicle's battery, which is often limited to 95%; \(SOC_{k,j}^{obj}\) is the objective state of charge that fulfils the owner's driving demand, which can also be equal to \(SOC_{max}\); \(ECR_{k,j}\) is the energy consumption rate of the vehicle in kWh/km, and \(d_{k,j}\) is the daily travelled distance in km, which is typically described by a log-normal distribution function [21; 22].  
Based on the parameters defined above, the energy limits of the \(j\)th EV under aggregator \(k\) are formulated by recursion as defined by Equation (4).  
\[e_{k,j}^{upper}(t)=\epsilon_{k,j}^{lower}(t)=\epsilon_{k,j}^{arr},\quad \forall k\in K,\forall j\in N_{k}^{EV},\ t=0,\ldots,t_{k,j}^{arr}+1 \tag{4}\]\[e_{k,j}^{upper}(t_{k,j}^{arr}+t)=min\Big{\{}e_{k,j}^{upper}(t_{k,j}^{arr}+t-1)+p _{ch}^{max}\cdot\eta_{ch}\cdot\Delta t,\,e_{k,j}^{obj}\Big{\}},\\ \forall k\in K,\forall j\in N_{k}^{EV},\;t=1,\ldots,N_{slots}-t_{k,j}^{arr} \tag{5}\]  
\[e_{k,j}^{lower}(t_{k,j}^{dis}+t)=e_{k,j}^{obj},\quad\forall k\in K,\forall j\in N _{k}^{EV},\;t=t_{k,j}^{dis},\ldots,N_{slots}-t_{k,j}^{dis} \tag{6}\]  
\[e_{k,j}^{lower}(t_{k,j}^{dis}-t)=max\Big{\{}e_{k,j}^{lower}(t_{k,j}^{dis}-t+1) -p_{ch}^{max}\cdot\eta_{ch}\cdot\Delta t,\,e_{k,j}^{arr}\Big{\}},\\ \forall k\in K,\forall j\in N_{k}^{EV},\;t=1,\ldots,t_{k,j}^{p}+1 \tag{7}\]  
Equation (4) imposes that the energy state of an EV before its arrival time \((t_{k,j}^{arr})\) must be equal to its arrival energy level for both the upper and lower energy boundaries, as the energy state previous to this event is unknown for the aggregator. Equation (5) specifies that the upper energy state of the EV \(j\) at time \(t\) could be at most \(p_{ch}^{max}\cdot\eta_{ch}\cdot\Delta t\) higher than the energy level at the previous period, but it should not be larger than its objective energy, where \(\Delta t\) is the time slot, \(p_{ch}^{max}\) and \(\eta_{ch}\) are the nominal capacity and the efficiency of the EV charger. Equations (6) and (7) enforce that the lower energy state of the \(j\)th EV at the time when disconnected \((t_{k,j}^{dis})\) must match with its objective energy level, and in previous periods \((t_{k,j}^{dis}-t)\) could be at most \(p_{ch}^{max}\cdot\eta_{ch}\cdot\Delta t\) lower than its value at \((t_{k,j}^{arr}+t-1)\) but cannot be lower than its arrival energy state. Notice that the expected disconnection time \(t_{k,j}^{dis}\) is equal to \(t_{k,j}^{arr}+t_{k,j}^{p}\), where \(t_{k,j}^{p}\) is the number of discrete-time intervals of vehicle \(j\) parking at home under aggregator \(k\).  
As the maximum charging power of an EV \(j\) is limited by the rated power of its charger, its upper power boundary \((p_{k,j}^{upper})\) in the time slot \(t\) can be defined by Equation (8). Notice that its charging power must be equal to zero for a time step out of the interval \([t_{k,j}^{arr},t_{k,j}^{dis}]\). It is worth mentioning that its lower power boundary is set to zero because only the charging process is considered.  
\[p_{k,j}^{upper}(t)=p_{ch}^{max}\cdot\eta_{ch},\quad t=t_{k,j}^{arr},\ldots,t_{ k,j}^{dis},\forall k\in K,\forall j\in N_{k}^{EV} \tag{8}\]