SNOAAA7 April 2024 LMG3522R030
After the RMS value of the AC voltage is obtained, the value is utilized in the voltage loop first. The reference voltage is first initialized in the start function which is 220. The loop calculation rate is the same as the sample rate, 20kHz. First, the error value between the sampled RMS value and the reference voltage is obtained, using the PI compensator to adjust gain and voltage loop phase.
To further reduce the 100Hz voltage ripple in the sampled signal, a notch filter is employed after the voltage PI compensator. The central frequency of the notch filter is set to 100Hz or 628rad/s, with a bandwidth of 5Hz. Figure 3-8 illustrates the parameter initialization of the notch filter in the start function, while Figure 3-9 demonstrates the code of the voltage loop with the notch filter implemented.