## 2 Implementation of VSG Algorithm to Emulate Frequency Control  
The system frequency indicates the overall power balance between the generation and the demand at any instantaneous time. In the traditional SG-dominated power system, the active power-frequency control is a series of multiple temporal stages. The stage of IR is naturally provided by all SGs from the direct coupling between mechanical and electrical parts. The stage of PFR is spontaneously provided by the SGs with headroom from the turbine-speed governor systems [31]. The properties of IR and PFR are summarized in Table 1.  
For the PEI-based IBG, the external characteristics are largely determined by the supplementary controller. In inchoate studies, among the VSG implementations in different orders, the simplest second-order model is with better stability in transients [32] and can be combined with virtually any VSC control strategies based on the conventional cascade structure [33]. By the modification of the supplementary controller, the VSG algorithm enables the PEIs to function in the same way as SGs with the ability to perform IR and PFR.  
The inertia response of the SGs is instantaneous without prerequisite measurements. For traditional SGs, the inertia is provided by the kinetic energy stored in the rotation equipment. The inertia constant HSG indicates the inertia property, which can be expressed as  
\[H_{SG}=\frac{J_{SG}\omega_{r}^{2}}{2 VA_{base}} \tag{1}\]  
where \(J\) is the moment of inertia, \(\omega_{r}\) is the angular speed of the rotor, and \(VA_{base}\) is the rated power. Similar to \(H_{SG}\), the virtual inertia constant \(H_{vir}\) of PEIs can be expressed as the ratio of the provided energy to the rated power  
\[H_{vir}=\frac{J_{vir}\omega_{m}^{2}}{2 VA_{base}} \tag{2}\]  
where \(J_{vir}\) is the virtual moment of inertia and \(\omega_{m}\) is the virtual angular speed. The inertia response follows [PERSON]'s law of motion, which can be expressed as the swing equation  
\[P_{m}-P_{e}=\frac{d\Delta\omega_{r}/dt}{M}+D\Delta\omega_{r} \tag{3}\]  
where \(M=2H_{vir}\), \(D\) is the damping coefficient of the load, \(P_{m}\) and \(P_{e}\) are the virtual mechanical and electrical power, and \(\omega_{r}\) is the virtual angular speed. When the swing equation is represented by the inertia constant, all the parameters are per-unit values.  
The PFR of SGs is provided by the turbine-governor system. In per-unit value, the droop property is  
\[\Delta Y=-\frac{1}{R}\times\frac{1}{1+sT_{G}}\times\frac{1+sF_{HP}T_{RH}}{(1+ sT_{CH})(1+sT_{RH})}\Delta\omega_{r} \tag{4}\]  
where \(R\) is the speed droop, \(Y\) is the valve position, and \(T_{G}\) is the time constant of the speed governor. For a typical steam turbine, \(T_{CH}\) is the time constant of main inlet volumes and steam chest; \(T_{RH}\) is the time constant of the reheater; and \(F_{HP}\) is the fraction of the total turbine power generated by high-pressure (HP) sections. The control structure of the active power-frequency loop is shown in Figure 1.  
\begin{table}
\begin{tabular}{c c c} \hline  & **IR** & **PFR** \\ \hline Time scale & Instantaneous & Seconds-30 s \\ Activation & ROCOF & Frequency deviation crosses a \\  & & preset deadband \\ Reference & Naturally provided & Frequency deviation \\ Control parameter & \(H\) & Percentage \(R\) \\ Participants & All SGs & All SGs with headroom \\ Executor & Rotating equipment & Speed governor \\ Energy resource & Kinetic & Primary energy input \\ \hline \end{tabular}
\end{table}
Table 1: Properties of inertia response (IR) and primary frequency responses (PFR). ROCOF: change of the range of frequency, SGs: synchronous generators.  
The IR and PFR provided by VSG-PEIs is shown in Figure 2. The inertia and primary frequency response are autonomously delivered to stabilize the system frequency after load disturbances. The key performance indices involve the magnitude of ROCOF, the frequency nadir, the settling time, and the settling frequency.