## 3 VSM Based Optimal EV Charging Strategy
### Frequency Droop Characteristic of VSM  
When the EVs are connected to the power grid through VSM, the EVs group connected to the power grid can be regarded as a synchronous generator running directly or indirectly in parallel [23]. This is because the VSM simulates real synchronous generator's external characteristic. One of the outstanding advantages of this control is that the parallel bidirectional inverter of grid-connected electric vehicles can share the load proportional to their capacity, that is:  
\[m_{1}s_{1}=m_{2}s_{2}, \tag{2}\]  
Figure 3: The topology of EV bidirectional charging circuit and its’ virtual synchronous machine (VSM) controller. When an EV is driving on the road at a constant speed, the output power of the battery can be calculated by following the equation [24]:  
\[P_{b-out}=-\frac{v_{j}}{\eta_{l}\eta_{lm}}\Big{[}Mg(f_{r}+i)+\frac{1}{2}\rho_{s}C _{D}A_{f}v^{2}\Big{]}. \tag{9}\]  
The the negative sign in the equation is because the positive direction of power is from EVs to the grid. In Equation (9) assuming that mechanical transmission efficiency \(\eta_{t}\) is 90%, motor efficiency \(\eta_{m}\) is 90%, vehicle weight \(M=1500\) kg, road gradient \(I=0\), rolling friction coefficient \(f_{r}=0.012\), air density \(\rho_{s}=1.29\), wind resistance coefficient \(C_{D}=0.2\), windward area \(A_{f}=2.0\) m\({}^{2}\), \(v_{j}\) is the average vehicle speed of the EV, which can be calculated by [7]:  
\[v_{j}=\frac{D_{AVDT,j}}{t_{ave}}, \tag{10}\]  
where \(D_{AVDT,j}\) is the value of AVDT miles of clustering center of EV group \(j\). \(t_{ave}\) is the average time cost of the EVs which are on the road. The energy need of EV \(i\) in EV group \(j\) can be modeled as:  
\[E_{i,j,need}=E_{j,need}=P_{b-out,j}t_{ave}=-\frac{D_{AVDT,j}}{3.6\cdot\eta_{l} \eta_{lm}}\Bigg{[}Mg(f_{r}+i)+\frac{1}{2}\rho_{s}C_{D}A_{f}\Bigg{(}\frac{D_{ AVDT,j}}{3.6\cdot t_{ave}}\Bigg{)}^{2}\Bigg{]}. \tag{11}\]  
In the power system, the imbalance of active power causes the system frequency to change, which also means that the system frequency change reflects the imbalance of the system's active power. The process of large generator units adjusting the frequency of the power grid can be approximated by a linear mathematical formula as:  
\[q=\frac{\Delta P}{\Delta f}=\frac{\Delta P}{\Big{(}f_{g}-f_{n}\Big{)}}=\frac{ \Delta P}{\Lambda\omega/2\pi}, \tag{12}\]  
where \(f_{g}\) is the local grid frequency of the power grid detected by the phase lock loop (PLL), \(f_{n}\) is the rated grid frequency. \(\Delta P\) is the corresponding active power needed by the power grid to balance the system frequency in response. Then, a multi-objective optimal problem can be formulated as follows:  
J1 = Minimize the power imbalance  
\[Min\ J1=\Bigg{(}\Delta P+\sum_{j=1}^{N}P_{j}^{\prime}\Bigg{)}^{2}=\Bigg{(}q \cdot\Delta\omega/2\pi+\sum_{j=1}^{N}\Big{[}M_{j}\Big{(}P_{ref,j}-C_{p}S_{j} \Delta\omega_{j}\omega_{n}\Big{)}\Big{]}\Bigg{)}^{2}, \tag{13}\]  
where \(\Delta P\) is frequency regulation demand, \(\Delta P\) is positive when grid frequency is higher than its' rated value and require downward frequency regulation, \(\Delta P\) is negative when grid frequency is lower than its' rated value and require upward frequency regulation. \(\sum_{j=1}^{N}P_{j}^{\prime}\) is the total charging/discharging power of EVs group, it can be positive or negative, depends on optimization results. J2 = Minimize the energy gap between the drive needs and the charged energy  
\[Min\ J2=\sum_{i=1}^{M_{j}}\sum_{j=1}^{N}\Big{(}E_{i,j,n\alpha t}-P_{i,j}^{ \prime}T\Big{)}^{2}=\sum_{j=1}^{N}M_{j}^{2}\Big{(}E_{j,n\alpha t}-P_{j}^{ \prime}T\Big{)}^{2}, \tag{14}\]  
where \(E_{i,j,n\alpha t}\) is defined by Equation (11), which means daily drive energy needed by EV \(i\) in EV group \(j\). \(T\) is the average time that EV connected to the power grid. \(P_{i,j}^{\prime}\cdot T\) means the energy \(EV_{i,j}\) get from the power grid.