## 5 Virtual Inertia Adaptive Control Strategy Based on TDC Algorithm
### Parameter Settings of the TDC-VSG Adaptive Control Strategy  
The result of adjusting virtual inertia \(J_{0}\) is evident from the grid-connected block diagram of the TVSG presented in Figure 3. The open-loop transfer function \(T_{\text{P}}(s)\) of the APL system is shown below:  
\[T_{\text{P}}(s)=\frac{1}{\frac{J_{\omega}}{K_{\omega}+D_{\omega}}s+1}\cdot\frac {1}{s}\cdot\frac{3 EUL_{\text{g}}}{\omega_{0}X} \tag{23}\]  
At the cutoff angular frequency \(\omega_{\text{c}}\) of the APL, defined as \(\omega_{\text{c}}=2\pi f_{\text{cp}}\), the amplitude of \(T_{\text{P}}(s)\) for the TVSG equals 1, as illustrated by Equation (24):  
\[|T_{\text{P}}(\text{j}2\pi f_{\text{cq}})|=\ \frac{1}{|\frac{J_{\omega}2\pi f_{ \text{cq}}}{K_{\omega}+D_{\omega}}+1}\cdot\frac{1}{\text{j}2\pi f_{\text{cq}} }\frac{3 EUL_{\text{g}}}{X\omega_{0}}=1 \tag{24}\]  
Solving the above equation yields the following:  
\[J_{\omega}=\frac{K_{\omega}+D_{\omega}}{2\pi f_{\text{cp}}}\sqrt{\left(\frac{ 3 EUL_{\text{g}}}{2\pi f_{\text{cp}}\omega_{0}X(K_{\omega}+D_{\omega})}\right) ^{2}-1} \tag{25}\]  
To satisfy the virtual inertia requirements of the TVSG, the expression under the radical sign in Equation (25) should be greater than zero as shown below:  
\[f_{\text{cp}}\leq\frac{3 EUL_{\text{g}}}{2\pi\omega_{0}X(K_{\omega}+D_{\omega} )}=f_{\text{cp\_max}}\approx 3.25 \tag{26}\]  
To ensure that the system phase margin \(\gamma_{\text{ref}}>45^{\circ}\) and the cutoff frequency remains below 0.2 times the rated frequency [30], the following conditions must be satisfied:  
\[\gamma=180^{\circ}+\angle T_{\text{P}}(\text{j}2\pi f_{\text{cq}})\geq\gamma_ {\text{ref}} \tag{27}\]  
By substituting Equation (23) into Equation (27), the following is obtained:  
\[J\leq\frac{K_{\omega}+D_{\omega}}{2\pi f_{\text{cp}}}\cot\gamma_{\text{ref}} \tag{28}\]  
The \(J\)-\(f_{\text{cp}}\) characteristic curve and phase angle margin constraint curve are delineated in accordance with Equations (25) and (28), as illustrated in Figure 10. Predicated on the selection area of \(J_{\omega}\) and \(f_{\text{cp}}\) depicted in Figure 10, \(f_{\text{cq\_min}}=2.30\), allowing for the determination of the virtual inertia \(J_{0}\), which is selected as 0.9.  
Figure 9: ISRU(\(x\)) function and its derivative trend.  
The appropriate compensation coefficient \(K_{\rm j}\) and the virtual inertia switching threshold \(T_{\rm j}\) are determined to enhance the dynamics and precision of the TDC-VSG adaptive control strategy. Figure 11 displays the system's active power and frequency output characteristics under various control parameters.  
The output characteristics of the system corresponding to various compensation coefficients are illustrated in Figure 10(a). When \(K_{\rm j}=0.9\), the control system demonstrates the most pronounced effectiveness in suppressing transient oscillations. The output characteristics of TDC-VSG under varying \(T_{\rm j}\) are depicted in Figure 10(b). As \(T_{\rm j}\) decreases, the system performs better in mitigating power and frequency oscillations. Consequently, the optimal switching threshold \(T_{\rm j}\) identified is 0.2.