LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

small data loss

Hello everybody


I developed a code to be able to stop the acquisition in finished mode with a stop button and it works quite well but I noticed a small loss of data
Why do you think there was this loss? and is there a way to fix this problem?


thanks in advance

0 Kudos
Message 1 of 11
(508 Views)

here is what I did on labview

0 Kudos
Message 2 of 11
(504 Views)

Hi Amelie,

 


@ameletudiante99 wrote:

I noticed a small loss of data


Please define "small loss of data"!

 


@ameletudiante99 wrote:

Why do you think there was this loss? and is there a way to fix this problem?


I guess you compare the number of samples read vs. the number of samples configured in your "Finite Samples" task!?

So you stop acquisition before the task has finished and still wonder why you read less samples than configured!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(489 Views)

2 acquisition channels at 25 kHz for 1 s I only read 24833 samples

 

yes I compare that but I have a loss even when I don't stop with the stop button

0 Kudos
Message 4 of 11
(476 Views)

Hi Amelie,

 


@ameletudiante99 wrote:

2 acquisition channels at 25 kHz for 1 s I only read 24833 samples

 

yes I compare that but I have a loss even when I don't stop with the stop button


So you miss 67 samples?

 

  1. In the last iteration of the loop you read the number of available samples
  2. You read that amount of samples from the buffer.
  3. You determine the "task finished" condition.
  4. You stop the loop when DAQmx says "all samples acquired" at step 3.

The problem is: between step 1 and 3 will be a (small) delay!

When you read the number of available samples (at step 1) the task is not finished yet, but milliseconds later (at step 3) it has finished. Your "loss" relates to this delay (67 samples / 25kS/s = 2.7ms)…

 

You may iterate the loop one more time or you may read the remaining samples from the buffer after the loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 11
(453 Views)

How can I iterate the while loop in my case?

can you put me on a trail?

I tried to put the while loop in a for loop I set the number of iterations as 2, the problem is solved but now if I want to stop I have to press the stop button twice

0 Kudos
Message 6 of 11
(431 Views)

Hi Amelie,

 


@ameletudiante99 wrote:

How can I iterate the while loop in my case?

can you put me on a trail?


You want to stop the while loop when

  • an error occurs
  • the STOP button is pressed
  • all samples are acquired (this is different to "DAQmx task finished" as I explained in my previous message!)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(414 Views)

@ameletudiante99 wrote:

here is what I did on labview


Try to call the DAQmx nodes in a different order.

In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read. 

Message 8 of 11
(402 Views)

@UliB wrote:

@ameletudiante99 wrote:

here is what I did on labview


Try to call the DAQmx nodes in a different order.

In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read. 


Or easier, just tell the Read to read the buffer size of samples and the loop is unencessary.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(398 Views)

@Yamaeda wrote:

@UliB wrote:

@ameletudiante99 wrote:

here is what I did on labview


Try to call the DAQmx nodes in a different order.

In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read. 


Or easier, just tell the Read to read the buffer size of samples and the loop is unencessary.


Well, OP didn't say it in this thread, but wanted to stop the read operation even if not all samples are taken in this thread https://forums.ni.com/t5/LabVIEW/stop-acquisition-in-finished-mode/m-p/4376436#M1286823 only yesterday 😎.

0 Kudos
Message 10 of 11
(390 Views)