LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate RMS with offset

Solved!
Go to solution
Highlighted

Hello,

 

I acquire a sinusodial waveform signal and calculate the RMS value using "Average DC-RMS.vi". The calculation works, if the waveform is symmetric around 0. If I add an offset, the calculation is wrong. Any ideas how to solve this?

Thanks a lot and best regards.

Michael

 

P.S.: I am using LabVIEW 2012.

 

2016-11-30_09h00_34.png

 

0 Kudos
Message 1 of 11
(3,134 Views)

Hi Micha,

 

If I add an offset, the calculation is wrong.

What exactly is wrong with the result? Which result do you expect?

 

You know how the RMS is defined?

 

Any ideas how to solve this?

You might subtract the DC offset from your waveform before calculating the RMS…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 11
(3,118 Views)

Hello Gerd,

 

if amplitude is less high then the negative offset the vi calculates a positive value (e.g. amplitude 1V, offset -2V ==> RMS = 2,12V). Okay, depending on the definition, the result might be right, but in realitiy for me it is wrong. In reality it should be a negative value.

 

How can get the offset, if I only have a acquired wafevorm?

 

Thanks a lot and best regards.

Michael

 

0 Kudos
Message 3 of 11
(3,113 Views)

Hi Micha,

 

In reality it should be a negative value.

So you want to have a negative value - from an operation, which involves to square values and take the root from a sum?

Really???

 

Okay, depending on the definition, the result might be right, but in realitiy for me it is wrong.

No, even in reality the result is correct!

You need to define your requirements - and develop an algorithm to fulfill those requirements…

 

How can get the offset, if I only have a acquired wafevorm?

There are functions to calculate the DC offset from a waveform…

(Basically it's just the mean value.)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 4 of 11
(3,110 Views)

So, what is the task you have to solve?

 

I have a maybe similar task when I calibrate DAQ cards: My calibrator (Fluke 5700A Smiley Happy) create a well defined RMS output and the DAQ will read a sine including an offset (and more) .  In my application the sine amplitude is the value of interest.

So I apply a sine fit ( easy method is tone detection.vi Smiley Happy ) to get the amplitude and phase and look at the residual (RMS Smiley Happy, peak to peak noise, offset and (harmonic) distortion).  Read a full number of periodes that also matches full periodes of your line frequency and you can get nice results.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 11
(3,085 Views)

@MichaGue_01 wrote:

 

How can get the offset, if I only have a acquired wafevorm?

  


Suppose I generate a random signal (using the NI Random Number generator which gives values between 0 and 1) of 1000 points and ask "What is the offset of this signal"?  What would you answer?  How did you get that?  What if I added an (unknown-to-you) additional offset to it?  How would you compute the offset?

 

You could do the same thing with a sinusoidal signal, but you might be a little bit "off" depending on how you define "offset".  To understand what I mean, consider that the signal represents a half-sinusoid, i.e. sin (theta), where theta goes from 0 to pi.  If you have many cycles of a sinusoid, the "offset estimation" method I hope you figured out from the previous paragraph should give a more accurate answer.

 

Bob Schor

0 Kudos
Message 6 of 11
(3,067 Views)

Us the;

 

Signal Processing >>> Waveform Measurments >>> Basic Averaged DC-RMS

 

to calculate the DC level and simply subtract that DC from your waveform PRIOR to getting the RMS value and you will get the value you want save the negative sign.

 

Spoiler
Somewhere in teh back of my head there is an alarm going off saying "Negative RMS? Doesn't that break some physical law if not qualify one for  a Nobel prize or something?

 

 

Ben

0 Kudos
Message 7 of 11
(3,059 Views)

@Ben wrote:

 

Spoiler
Somewhere in teh back of my head there is an alarm going off saying "Negative RMS? Doesn't that break some physical law if not qualify one for  a Nobel prize or something.

It's perfectly logical if it's the RMS of an imaginary signal, the Imaginary RMS. Smiley Very Happy

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
Message 8 of 11
(3,045 Views)

turn it 90° or 270° ??

Smiley Very Happy Smiley Very Happy

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 9 of 11
(3,037 Views)
Solution
Accepted by topic author MichaGue_01

@MichaGue_01 wrote:

if amplitude is less high then the negative offset the vi calculates a positive value (e.g. amplitude 1V, offset -2V ==> RMS = 2,12V). Okay, depending on the definition, the result might be right, but in realitiy for me it is wrong. In reality it should be a negative value.


No.  RMS is a measurement of the AC component of a signal (closely related to peak-to-peak).  Offset is the DC component.  So RMS should never be negative.

 

As Ben stated, to do your measurements properly you need to calculate the average of the signal (gives you the offset), subtract that value from every data point and then calculate the RMS.  If you have really tight limits, you should also do some processing to make sure you have an integer number of cycles captured.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 10 of 11
(3,017 Views)