LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate RMS with offset

Solved!
Go to solution

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
(9,628 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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(9,612 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
(9,607 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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(9,604 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 :)) 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 🙂 ) to get the amplitude and phase and look at the residual (RMS :), 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
(9,579 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
(9,561 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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 11
(9,553 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. 😄

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 11
(9,539 Views)

turn it 90° or 270° ??

😄 😄

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
(9,531 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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 10 of 11
(9,511 Views)