LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an easy way to calulate the RMS value of a sine wave (AC Volts) if I have 1 full wave + extra points?

I am going to be receiving 40 scans of an AC voltage wave. This will give me 1 full sine wave + some extra points. RMS.vi returns a different RMS voltage depending on where the sampling starts on the AC waveform. I can get a close RMS value from this VI if I truncate enough points so I have (approximately) 1 full sine wave, but I figure there's got to be a way to measure the RMS of a sine wave besides this, or is there an easy way I can curve fit the rest of the wave (assuming a perfect sine) to get 2 periods and then calulate the RMS using RMS.vi? Thanks.
0 Kudos
Message 1 of 9
(5,145 Views)
Your question is actually a very interesting challenge that is not trivial. There are different techniques that can be used depending on how well you know your signal. If you could describe your signal in more details, that could help tracking the right technique.
Some questions are:
- How well do you know your signal frequency (+/- %).
- Is this a pure tone?
- Do you have any offset in your signal?
- What accuracy are you shooting for?
- What version of LabVIEW are you using?

Also if you could post a single VI with sample data (2 or more acquisitions), that could be helpful.

Regards,
Alain Moriat
National Instruments
LabVIEW/DSP
0 Kudos
Message 2 of 9
(5,145 Views)
The signal will be from an inverter hooking up to the local power grid, one AC leg, so -

Answers to your questions, in respective order:
1) Frequency should be 60 Hz, don't know the +/- of the local grid but I imagine should be very close.
2) I don't know what is meant by pure tone. If it is whether it is a "clean" sine wave or not, I'm not sure, as I don't won't a chance to sample the exact signal until right before the test, but I suspect there will be some noise. If pure tone means is it just one frequency, not multiple frequencies, then the answer is mostly yes, there may be some minor other frequcencies present, but the main deal will be one frequency.
3) No DC offset.
4) +/- 1 Volt if possible.
5) LabVIEW 6i (6.0)

Since the equ
ipment is not in-house yet, I do not have actual data for this, but I'm approximating the signal knowing my sample rate, signal frequency and amplitude. I've attached a quick VI that has 5 sample values and the corresponding RMS returned. The actual RMS is 120.21 Volts.
0 Kudos
Message 3 of 9
(5,145 Views)
Here are 2 different approaches (also shown in the 2 attached VIs).

1 - Assuming that your signal does not have any offset, you can square your signal and get a new signal composed of a DC component and a pure tone at twice your original frequency. If you remove the tone (using the tone detection VI) you are left with the DC part that represents the RMS energy of your original signal. This technique is very accurate if your signal is DC-free. The result degrades fast if you add a DC offset.

2 - You can do a curve fitting based on a model of your signal (with optional offset). To make this work, you need a good start guess, but since you know your approximate frequency and levels this should also work fine.

As you can see, b
oth techniques return 6 digits of accuracy on your test data.
0 Kudos
Message 4 of 9
(5,145 Views)
I'm trying to do something that is similar to that as well. The signal is an
AC voltage sine wave. This signal could be distorted and could vary away
from the normal 50Hz.

I am using labview 6.1.

Any ideas on how to get the most accurate result??

Sam Chen


"Alain Moriat" wrote in message
news:50650000000500000070B50000-1031838699000@exchange.ni.com...
> Your question is actually a very interesting challenge that is not
> trivial. There are different techniques that can be used depending on
> how well you know your signal. If you could describe your signal in
> more details, that could help tracking the right technique.
> Some questions are:
> - How well do you know your signal frequency (+/- %).
> - Is this a pure tone?
> - Do you have any
offset in your signal?
> - What accuracy are you shooting for?
> - What version of LabVIEW are you using?
>
> Also if you could post a single VI with sample data (2 or more
> acquisitions), that could be helpful.
>
> Regards,
> Alain Moriat
> National Instruments
> LabVIEW/DSP
0 Kudos
Message 5 of 9
(5,145 Views)
"Gibnets" wrote in message
news:5065000000080000005E670000-1031838699000@exchange.ni.com...
> Is there an easy way to calulate the RMS value of a sine wave (AC
> Volts) if I have 1 full wave + extra points?
>
> I am going to be receiving 40 scans of an AC voltage wave. This will
> give me 1 full sine wave + some extra points. RMS.vi returns a
> different RMS voltage depending on where the sampling starts on the AC
> waveform. I can get a close RMS value from this VI if I truncate
> enough points so I have (approximately) 1 full sine wave, but I figure
> there's got to be a way to measure the RMS of a sine wave besides
> this, or is there an easy way I can curve fit the rest of the wave
> (assuming a perfect sine) to get 2 periods and then calulate the RMS

> using RMS.vi? Thanks.

If you are going assume it is a good quality sine wave, then why not just
divide by the square root of 2?
0 Kudos
Message 6 of 9
(5,145 Views)
If you are using LabVIEW 6.1 you may want to try the new Cycle Average and RMS.vi located in your Waveform Measurements palette. But the VI may need more than one period of signal to extract a cycle correctly. The VI will work even if your signal is distorded.

Alain
0 Kudos
Message 7 of 9
(5,145 Views)
Thanks Alain. This gives me some decent options.
0 Kudos
Message 8 of 9
(5,145 Views)
a -

yea, I thought about dividing the peak by sqrt 2, and it does work for a sine, albeit with some small error. Since I'm not positive about the signal noise, etc. I figured there had to be a mathmatical way to fit the curve (which I couldn't figure out how to do off-hand), or some other mathmatical method which should give me better accuracy if the signal wasn't quite 'perfect'.
0 Kudos
Message 9 of 9
(5,145 Views)