From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

averaging on the fly instead of oversampling?

My pickup coil signal contains noise of 50Hz and harmonics (power line is 50Hz). 1st, 3rd and 4th harmonics have the same amplitude and the 2nd one is two times larger. The problem is how to get rid of them.
One way is to sample exactly at n*50Hz. This does not work since the power line never is exactly 50Hz.
The second way is to always sample at 600Hz and then make averaging. But in this case I get huge files because sometimes I am interested just in 20 points/sec.
I am interested in the third way - taking average of every N scans on the fly and then passing data to dispay and processing. So if I am interested in 20s/sec I would take average of every 30 scans at 600Hz.
The point is - HOW to do this FAST
enough. We have the DAQCard 6062E. As I understand there is no such option (return average of every N points) in DAQ VIs.
0 Kudos
Message 1 of 7
(3,149 Views)
Hi, Alexei

You can also sample at 600Hz, low pass filter the signal at 20Hz (if only the 50Hz and its harmonics are causing trouble), then down-sample to 20samples/sec before you save the signal to a file.

You should be able to process the data "on the fly" unless you have a really slow computer.

Regards

Ian
0 Kudos
Message 2 of 7
(3,149 Views)
Hello Alexei,

There isn't an option to have the DAQ device take an average of the last N readings. You could do this in LabVIEW very easily, but the averaging might take some additional CPU. If you're only acquiring at 600 Hz then you shouldn't have a problem with adding an averaging VI to your program.

You can set the AI Read VI to read 30 scans from the buffer at a time (using the number of of scans to read input) and then use the Mean VI to average those 30 points and just write the average to file. If you include the AI Read VI in a loop, you'll be getting 30 points at a time from the hardware and then just averaging in software. This should work.

I hope this helps. Let me know if you have any additional questions.

Regards,

Todd D.
NI Ap
plications Engineer
Message 3 of 7
(3,149 Views)
Hi Todd,

Thank you for information.

I have already modified our old program. I removed all data processing already present and put reduction of the array from "AI Read" by N times (N-points averaging). Also I forced the "number of scans to read" to be N*k, where k is an integer number. It works perfect! This fact surprised me. It turned out that it was the old data processing code that slowed down the program.
I think it is a very attractive idea - to implement N points averaging into NI hardware. But it could probably make prices unacceptable.

Alexei.
0 Kudos
Message 4 of 7
(3,149 Views)
Hey Alexei,

I'm glad you got everything working. I can somewhat see your point about the harware performing the averaging. On the other hand, if you are acquiring a certain number of samples via hardware, you would want to at least have the option of seeing each sample. Thanks for the feedback; I'll submit it to our development team.

Regards,

Todd
0 Kudos
Message 5 of 7
(3,150 Views)
I also believe averaging on the fly by the hardware would increase the efficiency of acquisition (if someone wants to use averaging) instead of doing so in the labview VI (using wathever icons/math in the while loop, after the read process). One can say that with a fast computer, it should not be a problem; but usually, we want to use the computer at its maximum CPU.. So every millisonced of CPU is a piece of gold for fast acquisition.

The question would be, what is the fastest way to extract an average of sample on the fly? is that using the Labview icon "mean" or making it yourself by taking the sum (labview icon) and dividing by the size of the sampling...?
0 Kudos
Message 6 of 7
(3,094 Views)
Just give it a little time. I don't think it will be too long until NI expands it FPGA product line to DAQ cards with FPGA access to do this kind of real-time processing.
Randall Pursley
0 Kudos
Message 7 of 7
(3,086 Views)