LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving sample average

Hello everyone,
 
I know this question has been talked about quite a bit but I am a beginner and a lot of this doesnt make a lot of sense.  Here is my situation.
 
I am retrieving data from a thermocouple continuously at 1000 hz and the temperature flucuates alot (noise).  what I would like to do is take a minutes worth of data (or some other finite value) and find the average.  then collect the next minute worth of data and calculate the average and so on until I stop my test.  the temeprature rise is slow and my test will run a couple hours, thats why the time I am averaging is so long.  then I want each of the average values to be written to a measurement file.
 
If anyone can help, that would be great.  Like I said I am a beginner so some of the real indepth info is hard to understand.
 
Thank you,
 
Brian
 
 
0 Kudos
Message 1 of 4
(3,332 Views)

you have four options, each of them complementary:

1) my guess is your thermocouple is not so noisy, yet your reading resolution is (we are talking few 10uV per degree probably..) so either amplification, or reducing the range of your DAQ card 16 bits (is it?) would help a lot.

2) put an RC filter at the output of the thermocouple.

3) do not sample at 1KHz, rather at 1Hz

4) average the values trough LAbview.  you just need to keep the values in an array and a shift register. for that, you will need:
     a little bit of LAbview tutorial,
     then browse trough Labview examples,
     then begin to make a small code,
     then post it here for help, corrections and advice.

-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 2 of 4
(3,317 Views)
If you are seeing a lot of fluctuation (and you didn't tell us how much fluctuation you are seeing) it most likely isn't the TC, particularly at 1kHz! Look for other noise sources on the signal path back to your card's input, particularly in the routing of the signal wires. The lower bit values represent very small signal levels and in many environments, industrial in particular, there are tons of "noise" sources, ranging from adjacent wires carrying control signals, power leads, etc.  As said in the previous post, low pass filtering can help as well as just reducing the sampling rate. As to running averaging, run a search on this forum, the topic has been discussed many times.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 4
(3,308 Views)
Here are some thoughts:
 
"I am retrieving data from a thermocouple continuously at 1000 hz and the temperature flucuates alot (noise)." 
 
I would not normally expect temperature to fluctuate significantly at 1000Hz.  You might want to verify that you have a solid (not intermittent) connection, and that your physical test setup is good.  (Although it may just be that you require very tight accuracy?)
 
"what I would like to do is take a minutes worth of data (or some other finite value) and find the average.  then collect the next minute worth of data and calculate the average and so on until I stop my test.  the temeprature rise is slow and my test will run a couple hours, thats why the time I am averaging is so long."
 
A simple way to accomplish what you have specified would be to:
 
1) acquire 60,000 samples at 1kHz (using the express vi for daq input)
2) extract the values (an array) from the waveform (generic waveform vi)
3) use the generic math functions to a) sum the array & b) divide by 60000
 
"  then I want each of the average values to be written to a measurement file."
 
use the generic file i/o subvis (such as the Write to Spreadsheet.vi) to log the data to a file of your choice.
 
Good luck
0 Kudos
Message 4 of 4
(3,294 Views)