## 6 Simulation Results  
Simulations performed in MATLAB/Simulink (R2024a) assessed the proposed GFMC APF's capabilities in harmonic suppression, power regulation, and improving the harmonic  
Figure 7: Harmonic compensation principle of GFMC APF. spectra of PCC voltages and grid-injected currents. Figures 8-16 show that the system effectively maintains sinusoidal waveforms, significantly reduces voltage and current harmonics, and ensures stable real and reactive power dynamics. Figure 8 illustrates the system response without the GFMC APF, revealing significant power quality degradation. The \(v_{\text{gabc}}\) shows noticeable distortion, with sharp peaks and notches, due to harmonic currents from the nonlinear load interacting with the grid impedance. Similarly, the \(i_{\text{ggabc}}\) are heavily distorted, exhibiting abrupt spikes from dominant 3 rd, 5 th, and 7 th order harmonics, risking grid stability, with the simulation conducted at a nominal grid voltage of 110 Vrms and a 50 Hz frequency. Figure 9 depicts the harmonic spectra of the system without the GFMC APF active, providing a baseline for the unmitigated harmonic distortion. The top graph shows the harmonic spectrum of \(v_{\text{gabc}}\), revealing a high THD of 30.77%, far exceeding the IEEE Std. 519-2014 limit of 8%, indicating severe voltage distortion caused by the nonlinear load. The bottom graph presents the harmonic spectrum of \(i_{\text{ggabc}}\), displaying a high THD of 9.39%, surpassing the IEEE limit of 4%, with notable harmonic peaks at the same frequencies, underscoring the extent of current distortion in the absence of compensation. The simulation was run with a sampling and switching frequency of 10 kHz, as listed in Table 1.  
Figure 8: PCC voltages and grid-injected currents without GFMC APF. Figure 9: Harmonic spectra of PCC voltages and grid currents without GFMC APF. Figure 10 shows the performance of the GFMC APF under harmonic compensation, demonstrating its ability to mitigate distortions. The top graph displays the \(i_{\text{giabc}}\) injected by the GFMC APF, which are specifically shaped to include harmonic components that are out of phase with those produced by the nonlinear load, effectively canceling them at the PCC. The bottom graph depicts the distorted load currents \(i_{\text{habc}}\), characterized by sharp, non-sinusoidal peaks due to the diode bridge's nonlinear behavior, highlighting the source of harmonic distortion that the GFMC APF targets. Figure 11 demonstrates the performance of the GFMC APF during operation, showcasing its effectiveness in maintaining power quality. The \(v_{\text{gabc}}\) waveforms are perfectly sinusoidal, balanced, and stable, reflecting the GFMC APF capability to suppress harmonics and provide precise voltage regulation at the PCC, even under the influence of nonlinear loads. Additionally, the \(i_{\text{giabc}}\) currents are clean and free of harmonic distortion, indicating that the GFMC APF compensating currents effectively neutralize the harmonics from the nonlinear load, ensuring seamless grid integration and maintaining system stability under challenging conditions. The controller settings were tuned to achieve a phase margin of 19.51 dB, as detailed in Section 4.2, with the repetitive controller (RC) gain adjusted to balance harmonic suppression and stability. Figure 12 presents the system's dynamic performance with the GFMC APF active, focusing on power regulation. The active power stabilizes at approximately 6000 W, demonstrating the GFMC APF's capability for rapid and precise active power regulation,  
Figure 11: PCC voltages and grid-injected currents during GFMC APF operation. Figure 10: Converter-side and nonlinear load currents under harmonic compensation operation. even with nonlinear loads that typically introduce disturbances. Meanwhile, the reactive power decreases steadily from around 600 VAR to near zero, highlighting the GFMC APF's effectiveness in reactive power compensation, which reduces the burden on the grid, enhancing overall system efficiency and stability.