This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Digital RMS Measurment

Hello All,

I would like to do a continuous RMS calculation in the C2000's MCU core using digital calculations. Essentially I have a potentially noisy sine wave with potentially varying amplitude that I would like to do a digital "RMS to DC" conversion on.

My understanding of the RMS calculation is that it is: sqrt{ (1/period)*integral(x[n]^2) }. Does this change for a continuous streaming RMS calculation? Does anyone have any suggestions on how I might sensibly do this?

Thank you,

Alex

  • Hi Alex,

    Basically thing are still the same as the integral translates into sum. One thing that you must take care of is to keep the window size of your sum length multiple of lowest harmonic of your signal. This is quite important in order to get the correct result.

    The other issue depends on your target CPU. If you are working on delfino go with the floating point implementation even if you require fixed point input and output data, as the code will run much faster (square and square root). If you are using fixed point CPU and IQ library you should code the module in assembly as sum of squared values requires at least double width accumulators in order to retain resolution. you might even use triple width accumulators. And of course you will need cutom square root routine that can handle double (triple) width input. You could get away with single width accumulators, but you would need to do normalization before each step and store the normalization data in order to do correct denormalization at the end.

    Regards, Mitja