From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample rates for sinewaves

Dear Community,

 

Please help my sanity! I am acquiring a 400Hz signal using a PXIe-6363 DAQ card and performing an RMS calculation within LabView. Reading the white papers published by NI I should need a sample rate ten times the fundamental to accurately represent the sinewave in the digitial domain and get the right result.

 

When I perform the measurements in the lab the thereory does not seem to align with reality! I have tried a number of different measurement configurations using whereby I vary the number of samples recorded to capture a single sinewave cycle at different sample rates. At a sample rate of 4kHz each time I run the acquisition I get a slightly different RMS value. Only when I perform the measurement at a 24kHz sample rate (60 times) do I get an acceptable and repeatable result.

 

Am I missing something? 

0 Kudos
Message 1 of 3
(2,719 Views)

It would help if you supplied code.

 

My first thought is your RMS calculation.  To get a really accurate RMS measurement, you have to have exact whole number of cycles in your array.  Here is a VI I used to cut out samples from a waveform for this purpose.


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
0 Kudos
Message 2 of 3
(2,711 Views)

A big part of your issues is the weight you are giving each sample by only doing 10pts per cycle, and only one cycle (i.e only 10 samples). In statistical terms, this is a sampling error that approaches zero as samples increase. When you couple with this a few realities of your system, some issues emerge. Here's a few of them:

 

1. Your measurement system and generation sytem do not share the same timebase. One of them will be faster or slower than the other, so you will probably not ever actually get one exact full cycle. How severe these vary depends on how stable the two are. The DAQ device will be quite stable since its clocks are derived from a good quality crystal (be it on the board or through the backplane). However, I cannot comment on how stable your source is in time. Non-integer numbers of cycles can likely be fixed with a windowing function, but the effect of the window must be taken into account as well. 

 

2. A true RMS calculation will include the effects of a mean value (offset). A standard deviation calculation will not include the effects of offset, which could be used if you only want to measure the AC portion of your signal. You mention that increasing the points per sample improves your result, so this is likely not the case.

 

-------------------

Larry Morgan
Senior Hardware Engineer
National Instruments
0 Kudos
Message 3 of 3
(2,701 Views)