## 3 Co-Optimization Model of EVs and PVs
### Constraints  
(1) Battery power constraints  
In order to meet the uncertain travel needs of EV users, the electric quantity of an EV shall not be lower than the minimum electric quantity \(E_{ms}\) at all times, in addition to reaching the expected electric quantity of users when off grid. If the electric quantity of an EV is lower than \(E_{ms}\) when connected to the power grid, it should be charged to the minimum electric quantity at the maximum power immediately after being connected to the power grid [32].  
Therefore, according to the difference of the initial electric quantity \(E_{start}\) when the EV is connected to the power grid, the formalization of the EV battery electric quantity constraint is shown in Equations (9) and (10).  
1 when \(E_{start}^{i}<E_{ms}^{i}\)  
\[E_{min}^{i}(k)=\left\{\begin{array}{ll}E_{start}^{i}+P_{max}\Delta t(k-k_{ start}^{i})\,&k_{start}^{i}\leq k<k_{ms}^{i}\\ E_{ms}^{i}\,&k_{ms}^{i}\leq k<\left[k_{end}^{i}-(E_{exp}^{i}-E_{ms}^{i})/P_{max} \right]\\ E_{exp}^{i}-P_{max}\Delta t(k_{end}^{i}-k)\,&\left[k_{end}^{i}-(E_{exp}^{i}-E_{ms}^{i})/P_{max} \right]\leq k\leq k_{end}^{i}\right. \tag{9}\]  
2 when \(E_{start}^{i}\geq E_{ms}^{i}\)  
\[E_{min}^{i}(k)=\left\{\begin{array}{ll}E_{ms}^{i}\,&k_{start}^{i}\leq k<\left[k_{ end}^{i}-(E_{exp}^{i}-E_{ms}^{i})/P_{max}\right]\\ E_{exp}^{i}-P_{max}\Delta t(k_{end}^{i}-k)\,&\left[k_{end}^{i}-(E_{exp}^{i}-E_{ ms}^{i})/P_{max}\right]\leq k\leq k_{end}^{i}\right. \tag{10}\]  
where \(E_{min}^{i}(k)\) is the minimum electric quantity required to be satisfied by the \(i\)th EV in time period \(k\); \(E_{ms}^{i}\) is the guaranteed minimum electric quantity of the \(i\)th EV; \(E_{exp}^{i}\)is the expected electric quantity when the \(i\)th EV user is off the power grid; \(P_{max}\) is the maximum charge and discharge power of the EV; \(k_{start}^{i}\) is the time when the \(i\)th EV is connected to the power grid; \(k_{ms}^{i}\) is the time when the \(i\)th EV is charged to the guaranteed minimum electric quantity; and \(k_{end}^{i}\) is the time when the \(i\)th EV is off grid.  
2. Charge-discharge power constraints of a single EV  
The upper and lower limit constraints of the charge and discharge power of the EV are shown in Equation (11). The values of the minimum charging power, the maximum charging power and the maximum discharging power in each time period are shown in Equations (12) and (13).  
\[-P_{ev,min}^{i}(k)\leq P_{ev}^{i}(k)\leq P_{ev.max}^{i}(k) \tag{11}\]  
\[P_{ev.max}^{i}(k)=\left\{\begin{array}{ll}P_{max}(k)\,&P_{max}(k)\leq E_{ max}-E^{i}(k)\\ E_{max}-E^{i}(k)\,&E_{max}-E^{i}(k)\leq P_{max}(k)\\ 0\,&E_{max}-E^{i}(k)\leq 0\\ \end{array}\right. \tag{12}\]  
\[P_{ev.min}^{i}(k)=\left\{\begin{array}{ll}P_{max}(k)\,&P_{max}(k)\leq E^{i}(k)-E_{ min}^{i}(k+1)\\ E^{i}(k)-E_{min}^{i}(k+1)\,&P_{max}(k)>E^{i}(k)-E_{min}^{i}(k+1)\\ 0\,&E^{i}(k)-E_{min}^{i}(k+1)\leq 0\\ \end{array}\right. \tag{13}\]  
3. Total power constraints  
The power supplied by the PV power plant to the EV cluster should be less than the total power generated by the PV power plant (as shown in Equation (14)). The charging power supplied by the power grid to the EV should not be less than 0 (as shown in Equation (15)).  
\[P_{pv.sum}(k)\geq P_{ev,pv}(k) \tag{14}\]  
\[P_{ev,grid}(k)\geq 0 \tag{15}\]  
where \(P_{pv.sum}(k)\) is the output of the PV power station in period \(k\).