# Modeling and Solving Method for Supporting Vehicle-to-Anything' EV Charging Mode
## 3 Modeling for V2A Charging Mode
### Constraints  
Other than charging for a whole day, an EV usually completes its power refilling within a certain period, while its charging/discharging should be subject to constraints from both user power demand and battery technical limitations:  
(1) Constraint of battery SOC (State-of-charge)  
\[Soc^{i}_{EV,\min}\leq Soc^{i}_{EV,t}\leq Soc^{i}_{EV,\max}\leq Soc^{i}_{EV}\ \ \forall t\in\text{ST},\ \forall i\in\text{SE} \tag{1}\]  
\[Soc^{i}_{EV,t}=Soc^{i}_{EV,t_{start}}+\frac{\frac{\eta^{i}_{EV}}{\eta^{i}_{EV}} \sum\limits_{t=start}^{t}S^{i}_{EV,t}}{\frac{\eta^{i}_{EV}}{\eta^{i}_{EV}} \sum\limits_{t=start}^{t}S^{i}_{EV,t}}\]  
\[-\frac{\eta^{i}_{EV}}{\eta^{i}_{A}C_{EV}}\sum\limits_{t=start}^{t}(S^{i,dV2H}_ {EV,t}+S^{i,dV2H}_{EV,t}+S^{i,dV2V}_{EV,t}+S^{i,dV2G}_{EV,t}),\]  
\[\text{s.t.}\ t,t_{start}\in T^{i}_{EV}\]  
Figure 5: Paradigm of V2G.  
where \(Soc^{i}_{EV,min}\) and \(Soc^{i}_{EV,max}\) are typically set to 20% and 90% to prolong the lifetime of the EV battery [18]; ST is normally set to 24 with a one-hour time resolution for a whole day; and SE is usually set to 1 for a single household.  
Energy requirement from EV user  
The charging activity of a single EV during its charging period should satisfy the energy desire of the EV user for traveling purposes:  
\[\begin{split}& Soc^{i}_{EV,t_{\text{end}}}=Soc^{i}_{EV,t_{ \text{end}}}\frac{+\frac{\mu^{i}_{EV}p^{i}_{EV}}{C_{EV}}\sum\limits_{t=t_{start} }^{t_{\text{end}}}S^{i_{\text{c}}}_{EV,t}\\ &-\frac{p^{i}_{EV}}{\mu^{i}_{A}C_{EV}}\sum\limits_{t=t_{start}}^{t _{\text{end}}}\left(S^{iVt2H}_{EV,t}+S^{iV2H}_{EV,t}+S^{iV2V}_{EV,t}+S^{idV2G}_ {EV,t}\right)\\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \For the final EV charging state limited by the energy desire from EV users, the constraint Equation (4) can be added to Equation (9) with an additional penalty function; the consideration Equation (6) for EV battery life can be also handled with the above method [17; 19]. Then the objective function changes to:  
\[\begin{array}{rl}\min&\text{G}(U)=F(U)+\sum\limits_{i\in\mathbb{E}}\rho_{i}( Soc^{i}_{EV,I_{tot}}-Soc^{i}_{EV,exp})^{2}\\ &\quad+\sum\limits_{i\in\mathbb{E}}\lambda_{i}\Big{[}\big{(}S^{i,c}_{EV,I+1}- S^{i,disC}_{EV,I+1}\big{)}-(S^{i,c}_{EV,I}-S^{i,disC}_{EV,I}\big{)}\Big{]}^{2}\,\\ &\text{s.t. constraints (\ref{eq:1}), (\ref{eq:2}), (\ref{eq:3}), (\ref{eq:5}), (\ref{eq:7}), (\ref{eq:8})}\end{array} \tag{10}\]  
where \(\rho_{i}\) denotes the penalty coefficient for EV charging satisfaction quantified through the deviation of final SOC state from the desired SOC; \(\lambda_{i}\) represents the penalty coefficient for EV battery degradation quantified through EV charging/discharging cycles.  
In addition, the following limit should be guaranteed to ensure that the discharging power of V2H, V2B and V2V will not pour into the power grid:  
\[P_{b,t}+\sum\limits_{i\in T^{i}_{EV}}(S^{i,c}_{EV,I},P^{i}_{EV}-S^{i,dV2H}_{EV,t}P^{i}_{EV}-S^{i,dV2B}_{EV,t}P^{i}_{EV}-S^{i,dV2V}_{EV,t}P^{i}_{EV})>0. \tag{11}\]