## 4 Stability Analysis of GFMC APF
### Stability Analysis  
The stability and performance of the GFMC APF are evaluated using the Bode plot, both with and without the RC. The system and control parameters used in the analysis are shown in Tables 1 and 2.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Description** & **Symbol** & **Value** \\ \hline Nominal dc voltage & \(V_{\text{dc}}\) & 400 V \\ Grid voltage & \(V_{\text{s}}\) & 110 Vrms \\ Converter-side inductor & \(L_{\text{gi}}\) & 2 mH \\ Grid-side inductor & \(L_{\text{gg}}\) & 4 mH \\ Line inductor & \(L_{\text{s}}\) & 10 mH \\ Load inductor & \(L_{\text{load}}\) & 20 mH \\ Filter capacitance & \(C_{\text{gf}}\) & 50 uF \\ Grid resistance & \(R_{\text{s}}\) & 0.1 \(\Omega\) \\ Load resistance & \(R_{\text{load}}\) & 10 \(\Omega\) \\ Nominal frequency & \(f_{0}\) & 50 Hz \\ Switching frequency & \(f_{\text{sw}}\) & 10 kHz \\ Active power reference & \(P_{\text{g\_ref}}\) & 0 W \\ \hline \hline \end{tabular}
\end{table}
Table 1: System parameters.  
Figure 4: Simplified control block diagram of GFMC APF with system dynamics.  
Figure 5 illustrates the Bode plots of the system without the RC, showing the influence of the PI controller gains \(K_{\text{vp}}\) and \(K_{\text{vi}}\) on the system's stability and dynamic performance. As \(K_{\text{vp}}\) increases, the phase margin decreases, enhancing the system's responsiveness but making it more prone to oscillations and potential instability if excessively tuned. On the other hand, increasing \(K_{\text{vi}}\) lowers the gain margin, which reduces the system's ability to tolerate variations in system parameters without becoming unstable. It shifts the gain crossover frequency to lower values, affecting the system's ability to reject high-frequency disturbances. After a systematic tuning process, \(K_{\text{vp}}\) = 0.14 and \(K_{\text{vi}}\) = 60 values were selected. This tuning resulted in a gain margin of 19.51 dB, ensuring the system can tolerate parameter changes while maintaining stable operation. These carefully tuned values achieve adequate stability and ensure the system effectively suppresses harmonics, allowing optimal dynamic performance even under varying grid conditions.  
Figure 6 presents the Bode plots of the system with RC for different values of \(K_{\text{r}}\). Without the RC, the system shows limited harmonic compensation. When the RC is activated, harmonic peaks appear at integer multiples of the fundamental frequency, indicating effective harmonic suppression. As \(K_{\text{r}}\) increases from 0.1 to 0.3 and 0.5, the harmonic compensation improves, however, the gain margin decreases, which affects system stability. Furthermore, using \(Q_{x}\) = 1 as a filter is unsuitable because it integrates the error and destabilizes the controller. To mitigate the peaks at higher frequencies near the critical frequency, a better filter, such as selecting \(Q_{x}\) slightly less than unity, is required [24]. This adjustment, combined with careful tuning of \(K_{\text{r}}\), achieves a balance between harmonic suppression and system stability. The effects of varying \(K_{\text{r}}\) and \(Q_{x}\) on harmonic suppression and stability are summarized in Table 3.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Description** & **Symbol** & **Value** \\ \hline Active power droop gain & \(D_{\text{p}}\) & \(2.85\times 10^{-3}\) \\ Reactive power droop gain & \(D_{\text{q}}\) & \(14.2\times 10^{-3}\) \\ Voltage controller P gain & \(K_{\text{vp}}\) & 0.14 \\ Voltage controller I gain & \(K_{\text{vi}}\) & 60 \\ Current controller P gain & \(K_{\text{cp}}\) & 0.1 \\ RC scaling factor & \(K\) & 6 \\ RC gain & \(K_{\text{r}}\) & 0.22 \\ RC filter coefficient & \(Q_{x}\) & 0.99 \\ Short-circuit coefficient & \(K_{\text{sc}}\) & 0.1 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Control parameters.  
Figure 5: Bode plots of the system without RC.