i designed a sinusoidal pwm amplifier (3KHz to 20KHz) that regulates its output voltage reading the RMS value of output current.
The RMS is obtained squaring the signal sampled by AD converter @200KHz and then applyng a FIR filter with 120 TAPS.
The advantage of this method is that the settling time of the FIR (so the response to amplitude changing) is about 600us so i can correct the pwm duty every 1ms because the value is alread stable.
All works fine but the problem arises when an external signal is added to the signal the amplifier is generating.
Infact a signal of about 600Hz different from original one (i.e. amplifier generates 4950Hz and a 5550Hz signal is added as external noise) causes an oscllation in RMS measure makes the amplidifer works in wrong way.
Applying a bandpass FIR makes the response of FIR slower. I tried downsampling by a factor of 4 and make a FIR of 1KHz bandwith but the fastest settling time i obtained was about 5ms that is too much because i've to regulate every 1ms.
Have you any idea or advice? Is there any algorithm to cancel unwanted component maintaing fast RMS response?
Thank you . Let me know.