'RMS Calculations - More than meets the eye'
|On 22 March Zack Cilliers asked -
"I want to get the r.m.s value of a
sinewave with the pic16c71 a/d.
Can someone tell me how i can do this
please? Pseudo code will be fine."
I think I was the only one who replied.
Sean Breheny sent me private email suggesting my reply was only
partially correct. I have thought about this and discussed it with an
associate who is heavily involved in industrial signal processing. It
turns out my answer was OK as far as it goes but not complete.
Sean pointed out part of the problem but the whole problem is much
larger than was apparent.
For a pure sine wave the crest value may be multiplied by 0.7071 - no
problem. For a mix of sinewaves (generally unknown) the square root of
the average of the squared values is taken OVER A PERIOD OF TIME. It
turns out there is NO "long enough" time if a nearly exact answer is
required. As Sean pointed out, if the period chosen is not an exact
multiple of all frequencies present then the presence of partial
cycles will cause inaccuracies. However, in the "real" world the
frequencies present will be unknown and it is virtually certain that
some (actually most) frequencies will have an inexact multiple of a
This problem occurs in a practical context when mean power drawn from
the mains is to be calculated. I am told that "real" people like
Yokogawa sample "as fast a possible for as long as possible".
Typically is at 100 kilo samples per second and they keep a very large
accumulator and sum the squares on an ongoing basis and also of course
count the number of samples. Calculations of average square value can
then be carried out with increasing accuracy with time. This is meant
to be good to the 13th harmonic (I think it was) for 50 Hz and also
gives "useful" results on 400 Hz.
Also, on reflection, sampling should be substantially above the
Nyquist rate in this application - ie much greater than 2 x the
highest frequency present.
Not as simple as it sounded at first. With a PIC reasonable results
should be obtainable by sampling as fast as possible (limited by A2D
| - Quantum Mechanics
| The Dreams that Stuff are made of.
| - All models are wrong -
| some models are useful.
| _________________________ |
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...