LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to average dynamic data from DAQ Assistant at every second?

Hi guys,

 

Currently my DAQ program (inside a while loop) runs at every second. However, there is a problem whereby the fluctuation of values is very big. I used the Mean.vi block to average out the dynamic values. I am not sure the problem is due to my 1s timing or it's due to the mean.vi.

 

Does anybody knows what is the mistake?

 

Very much appreciated! :')

 

Vanessa

0 Kudos
Message 1 of 9
(4,421 Views)

Hello,

 

You have configured the DAQ Assistant to acquire data at a sample rate of 1KS/s.  You are asking the function to return 100 samples each time you are calling it, so the loop should execute every 100ms, BUT for this you must remove the "Time delay" that you have put in the loop. In this case you will perform an average over 100ms worth of data.

 

If you want to perform an average each second, configure the DAQ assistant to acquire at 1KS/s and set the "Samples to read" to 1000. Remove the "Time delay" from your code.

 

Michel

0 Kudos
Message 2 of 9
(4,411 Views)

You also might want to change the acquisition mode to Continuous Samples.  This way the DAQ can be taking data for the next average while you are calculating the current average and logging it.  It doesn't seem like much, but it does help the entire system.


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 3 of 9
(4,405 Views)

Hi Michel,

 

I had tried to make the DAQ to obtain 1k samples at 1kHz. However, I never removed the record time at 1s as I wish show show the data in front panel at every second.

 

The fluctution still present. 😞

 

Vanessa

0 Kudos
Message 4 of 9
(4,398 Views)

Hi crossrultz,

 

I will try the method that you mentioned at get back to you again.

 

Thanks!

 

Vanessa

0 Kudos
Message 5 of 9
(4,396 Views)

Hi Michel,

 

Is there a way to get an average value (1000 samples at 1000Hz) without removing the 1s time delay? This is because I need the program to run at 1s.

 

Vanessa

0 Kudos
Message 6 of 9
(4,363 Views)
Please understand the basic arithmetic. The time it takes to acquire is number of samples/sample rate. As already mentioned, the correct way to acquire 1 second of data is to set the number of samples to be the same as the rate. Using any sort of software wait in a loop is wrong.
0 Kudos
Message 7 of 9
(4,353 Views)

@VanessaWen wrote:

Hi Michel,

 

Is there a way to get an average value (1000 samples at 1000Hz) without removing the 1s time delay? This is because I need the program to run at 1s.

 

Vanessa


The DAQ Assistant will keep your 1 second timing.  If you are reading 1 second worth of data, the DAQ Assistant will have to wait for that 1 second for the data to come in.


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 8 of 9
(4,352 Views)

You will get a loop executing each second and performing an average over 1000 samples if:

 

  • Like 

0 Kudos
Message 9 of 9
(4,332 Views)