Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).
|
Hello,
I need to write a program using the code composer that reads a file (through the port connect) and evaluate the mean and RMS values of the signal samples contained in this file. The file has one cycle of a sine wave (it simulates the output of an ADC ) and the program must calculate using these samples its mean value and its root mean square value. To calculate the mean value I thougth to add all the samples and divide by the number of samples. The problem is to know when does one period end. Does anyone has an idea of how to do that or has ever written a similar program? It would help me a lot. Thanks, Rodrigo |
|
|
|
Usually we just use a simple zero crossing mechanism... keep track of the values...when it goes from pos to neg that's your start... neg to pos that's half cycle...pos to neg again is full cycle... however, if you don't have a DC offset > than the amplitude of the sine wave its tougher... fraid I don't know how to do that off the top of my head, cept to perhaps find the average of a sufficiently large amount of time, and then subtract that average off the values and then repeat the zero crossing stuff again... Hope this helps Carl Chipman Nomadics, Inc. http://www.nomadics.com -----Original Message----- From: Roncada [mailto:] Sent: Thursday, August 22, 2002 11:15 AM To: Subject: [c54x] how to evaluate RMS value Hello, I need to write a program using the code composer that reads a file (through the port connect) and evaluate the mean and RMS values of the signal samples contained in this file. The file has one cycle of a sine wave (it simulates the output of an ADC ) and the program must calculate using these samples its mean value and its root mean square value. To calculate the mean value I thougth to add all the samples and divide by the number of samples. The problem is to know when does one period end. Does anyone has an idea of how to do that or has ever written a similar program? It would help me a lot. Thanks, Rodrigo _____________________________________ |
|
There are two correct answers to this as I see it. The fist is to look for TRUE RMS and the second is to look for Sinusoidal RMS. 1: TRUE RMS: Take an fft, add up the power of all the fft components, but the DC one. 2:SINUSOIDAL RMS Take an fft, only look at the largest component, find its power... there you go. For average, just look at the DC component, it is by definition that. I may have forgotten a square root or some factor of root 2 or something, but you get the idea. Whenever you want to do calculations on a time series like this consider doing them in frequency. Regards, Joel Hello, >I need to write a program using the code composer that reads a file >(through the port connect) and evaluate the mean and RMS values of the >signal samples contained in this file. >The file has one cycle of a sine wave (it simulates the output of an ADC ) >and the program must calculate using these samples its mean value and its >root mean square value. To calculate the mean value I thougth to add all >the samples and divide by the number of samples. The problem is to know >when does one period end. >Does anyone has an idea of how to do that or has ever written a similar >program? It would help me a lot. > >Thanks, >Rodrigo |
|
Hi, If the file has one cycle of sine wave...your question is answered by the file. All the samples in the file are of a single period. Otherwise, different methods can be used. a) The average of the distance between two maximums and/or two minimums, will give you the period. b) find the mean for the whole file. Subtract the mean from each sample. Now you know that the sine after subtracting will approximately be zero mean. Find the period using zero crossing and use this to find the mean and rms of the original data. c) Use a dc remove filter (which makes the sine wave zero mean). Again find the period using zero crossing, use this to find mean and rms of original data. Hope this helps. Regards, Vasudev > Message: 1 > Date: Thu, 22 Aug 2002 13:15:00 -0300 > From: "Roncada" <> > Subject: how to evaluate RMS value > > Hello, > I need to write a program using the code composer > that reads a file (through the port connect) and > evaluate the mean and RMS values of the signal > samples contained in this file. > The file has one cycle of a sine wave (it simulates > the output of an ADC ) and the program must > calculate using these samples its mean value and its > root mean square value. To calculate the mean value > I thougth to add all the samples and divide by the > number of samples. The problem is to know when does > one period end. > Does anyone has an idea of how to do that or has > ever written a similar program? It would help me a > lot. > > Thanks, > Rodrigo __________________________________________________ |