## 4 Results and Discussion
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline \(V_{n}\) & \(U_{dc}\) & \(V_{t}\) & \(R_{g}\) & \(R_{s}\) & \(f_{n}\) & \(C\) \\ \hline
380 V & 700 V & 300 V & 0.135 \(\Omega\) & 0.045 \(\Omega\) & 50 HZ & 50 uF \\ \hline \(C_{\text{dc}}\) & \(x\%\) & \(y\%\) & \(Q\) & \(L_{g}\) & \(L_{s}\) & \(R\) \\ \hline
10 mF & 100\% & 0.5\% & 100 Ah & 0.45 mH & 0.15 mH & 1000 \(\Omega\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Parameters of EVs’ bi-directional charger. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \(\mathbf{Class_{i}}\) & \(\textit{Pref}_{i}\) & \(S_{i}\) & **Cost1** & **Cost2** \\ \hline SoCi.class = 1, AVDT\({}_{i}\).class = 1 & –2346 & 11,416 & 3100 & 445 \\ \hline SoCi.class = 1, AVDT\({}_{i}\).class = 2 & –190 & 12,561 & 2619 & 419 \\ \hline SoCi.class = 1, AVDT\({}_{i}\).class = 3 & –1618 & 15,098 & 5512 & 1325 \\ \hline SoCi.class = 2, AVDT\({}_{i}\).class = 1 & –852 & 6412 & 7908 & 474 \\ \hline SoCi.class = 2, AVDT\({}_{i}\).class = 2 & 283 & 12,817 & 995 & 197 \\ \hline SoCi.class = 2, AVDT\({}_{i}\).class = 3 & –106 & 19,267 & 923 & 186 \\ \hline SoCi.class = 3, AVDT\({}_{i}\).class = 1 & –1393 & 5458 & 3242 & 723 \\ \hline SoCi.class = 3, AVDT\({}_{i}\).class = 2 & –277 & 5762 & 5592 & 570 \\ \hline SoCi.class = 3, AVDT\({}_{i}\).class = 3 & –895 & 15,119 & 1580 & 183 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Optimal Solution and Relative Costs. Figure 8: Charging power of EV\({}_{ij}\) in the group of: (**a**) SoCi.class = 1,AVDTi.class = 1; (**b**) SoCi.class = 1,AVDTi.class = 2; (**c**) SoCi.class = 1,AVDTi.class = 3; (**d**) SoCi.class = 2,AVDTi.class = 1; (**e**) SoCi.class = 2,AVDTi.class = 2; (**f**) SoCi.class = 2,AVDTi.class = 3; (**g**) SoCi.class = 3,AVDTi.class = 1; (**h**) SoCi.class = 3,AVDTi.class = 2; (**i**) SoCi.class = 3,AVDTi.class = 3. From the simulation results, as shown in Figure 8, as the frequency of the power grid rises to 50.02 Hz, according to the optimal results, the charging power of the EVs of the nine groups are as _Pref_ at \(t=1\) s. Then, at \(t=2\) s, the droop mechanism of the virtual synchronous machine are enabled, and then it can be seen that the charging power of all groups of EVs increased again according to different \(S_{i}\), which presents different droop coefficient of different virtual synchronous machines. Apparently, EVs with lower SoC have more margins for raising charging power, so when the power grid frequency is higher than its rated value, EVs with lower SoC and with higher AVDT absorb higher active power from the power grid. If the power grid frequency is lower than its rated value, \(\Delta\omega_{ij}\), which is the deviation between the local frequency and the rated frequency, is negative. By applying the proposed optimization algorithm, \(\mathrm{Pref_{i}}\) and \(S_{i}\) are determined to minimize the power imbalance (J1) and the energy gap between the drive needs and the charged energy (J2) defined by Equations (13) and (14). According to Equation (13), when \(\Delta\omega_{ij}\) is negative, \(\Delta\)P is negative. To minimize the power imbalance, the optimization result will drive the term of \(\sum_{j=1}^{N}P_{j}^{\prime}\) in Equation (13) be low. Apparently, EVs with higher SoC have more margins for lowing charging power (or discharging to the power grid), so when the power grid frequency is lower than its rated value, EVs with higher SoC and with lower AVDT absorb lower active power from the power grid (or release active power to the power grid), which would be contrary to the results of when grid frequency is high. Establish 1000 Electric Vehicles' SoC and AVDT Models by Monte Carlo sampling Method, make the distribution of SoC and AVDT value of the EVs subject to normal distribution. The rated capacity of each EV's power battery is 100 Ah, the battery end voltage is 300 V; The minimum spacing between different SoC classes D1 = 30%; The minimum spacing between different AVDT classes D2 = 20 km; The clustering results of the 1000 electric vehicles are as Figure 9 shown.