Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/30/05 18:48
Read: times


 
Msg Score: +1
 +1 Informative
#94118 - Elaboration
Responding to: ???'s previous message
Hi Neil,

I will gladly elaborate. First let me try to do a little damage control. I said that the rms value of a given signal does not depend on it being sinusoidal. You took that to imply that the rms value of a signal is independent of its shape (or period), and that I implied that:

x1= some waveform
x2= another waveform different in shape and freq. than x1

And RMS(x1) = RMS(x2)


This is absolutely not true. All I meant was that there is no requirement that a signal be sinusoidal in order that it have an rms value. In other words, you do not need to ensure that your signal is sinusoidal in order to measure it and calculate its rms value. That absolutely does not imply that two different waveforms will have the same rms value. Not only can you safely bet that two different waveforms will have two different rms values, the same waveform will have different rms values if taken over different intervals.

There is a formula which aserts that the rms value of a sine wave is the peak value of the sine wave divided by the square root of two. Many people forget that this formula is calculated from the integral I described in my previous post. Moreover, in order for this formula to hold, it must be assumed that you are talking about a whole number of waveform periods. In other words, if you calculate the rms value of a sinewave over a quarter of its period, or over two thirds of its period, you would get two different values, both different than that of a whole period (the formula above). Now since electrical/electronic engineers are usually interested in the amount of power a signal will deliver, and since most of their signals are sinusoidal, the above formula works fine for their purpose, but you should bear in mind the special restrictions that apply when using it.

So if you know for a fact that the signal you are working with is sinusoidal, then just find the peak value and apply the formula. If you are worried that it might be offset by a DC bias, then use half the difference between the max and min values. But don't forget to add the value of the DC bias to your rms value. It definitely counts as part of the rms value (which, after all, has to do with how much power the signal will deliver to a given load).

On the other hand, if you use the math I described in the previous post, you do not need to assume anything about the nature of the signal. If the signal is periodic, then the rms value you calculate will asymptotically approch the whole period value mentioned earlier, getting closer with each whole period you sample. That means that if you just keep iterating the loop I described with pseudo-code, it will "settle down" on the whole period rms value of the signal.

I did an experiment just now with a spreadsheet. Using a sine wave signal with no DC bias, and a step size (delta-t) of 0.8% of the period (0.05 radians), it took less than 8 periods for the calculated rms value to "settle" to 3 decimal places of accuracy. Repeating the experiment with a 2 volt DC bias made it take longer.

In short, the algorithm I described is a general case algorithm that will always give you the actual rms value of any signal over whatever interval you choose (within the accuracy of numerical approximation, which is why you will want smaller delta-t steps). If that signal is a DC voltage, it will give you the value of that voltage. If that signal is monotonically increasing, your calculations will yield a continually increasing rms value. And if your signal is periodic (sinusoidal or otherwise) then it will yield a result that asymptotically approaches the whole period rms value of the signal. It's very general purpose.

Now as to the square root algorithm, there are many to choose from. As for me, if Keil has a function provided I would use that one. The fact is they are a pretty class act, and I suspect that they've already done the work to optimize it. If I am wrong about that, I will leave it to some of the others on the forum (who know far more than I about 8052s and Keil) to give better advise.

I hope this helps. If I still haven't made something clear let me know. I will gladly try again. Good luck.

List of 20 messages in thread
TopicAuthorDate
RMS Calculation            01/01/70 00:00      
   Going back to basics...            01/01/70 00:00      
   How Many Samples Per Second?            01/01/70 00:00      
   Square Root Algorithm            01/01/70 00:00      
   RMS for sinusoidal signals            01/01/70 00:00      
      Clarification            01/01/70 00:00      
         I beg a question...            01/01/70 00:00      
            Full o' holes            01/01/70 00:00      
            Bang on target...            01/01/70 00:00      
         thats true...            01/01/70 00:00      
   RMS Value            01/01/70 00:00      
      Please elaborate more...            01/01/70 00:00      
         Elaboration            01/01/70 00:00      
            Correction            01/01/70 00:00      
               DC+AC RMS            01/01/70 00:00      
                  DC contribution to total rms value            01/01/70 00:00      
            Thanx Anywayz...            01/01/70 00:00      
               square root by Newton's Rule            01/01/70 00:00      
               Lookup table            01/01/70 00:00      
                  better option...as of now            01/01/70 00:00      

Back to Subject List