LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Modes

 

Hello.

 

I have two short questions, and I would be thankful if someone could solve them.

 

1) What is the practical difference between N Samples and Continuous Samples? I read several topics about the issue, which mentioned the buffer and memory, but I can't seem to grasp what is the observable difference between the two. If I want to acquire X samples/second from a thermistor and plot them into a graph, what mode should I use?

 

labview modes.png

 

2) I want to acquire data from a thermistor and plot it in real time. Should I use "1 Sample on Demand" + chart, or N/continuous Samples + graph? What are the advantages of using each mode?

 

Thank you very much for your time. I will wait for your valuable input.

Cheers

0 Kudos
Message 1 of 6
(3,145 Views)

Hi Varjak,

 

what is the observable difference between the two.

The obvious difference is the way the task will stop: either after reading a fixed number of samples or by function call…

 

If I want to acquire X samples/second from a thermistor and plot them into a graph, what mode should I use?

Use continuous mode…

 

What are the advantages of using each mode?

I will answer with disadvantages:

- reading one sample per DAQmxRead call is the slowest you can do: "1ch1sample" is only suitable for slow sample rates (of about 50S/s)…

- reading n samples per call might be a problem when you want to implement a control loop which needs to process all samples as fast as possible…

Best regards,
GerdW


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

Hello GerdW,

Thank you very much for your quick answer. Here are my doubts after reading it:

 

The obvious difference is the way the task will stop: either after reading a fixed number of samples or by function call…

I fear it is not so obvious to me... From the table from my initial post, it can be read for both modes, on a Run Once operation: "The device acquires N samples and stops".  

On a Run Continuously operation, for the N samples and Continuous modes, respectively: "The device acquires N samples repeatedly until you stop the execution." and "The device acquires time contiguous blocks of N samples until you stop the execution."

The way the task stops seems to be the same to me, in both modes, in either modality. We can focus on a Run Continuosly operation from now on, as I am more interested in using de DAQ assistant inside a while loop.

 

reading n samples per call might be a problem when you want to implement a control loop which needs to process all samples as fast as possible…

Why isn't that not valid for the Continuous mode?

 

0 Kudos
Message 3 of 6
(3,108 Views)

varjak wrote:

The obvious difference is the way the task will stop: either after reading a fixed number of samples or by function call…

I fear it is not so obvious to me... 


Fixed Samples will read the N samples and be done.

 

The Continuous Samples will constantly read samples and put the data into a buffer.  When you perform a read, you are just taking data off of that buffer.

 

 


@varjak wrote:

reading n samples per call might be a problem when you want to implement a control loop which needs to process all samples as fast as possible…

Why isn't that not valid for the Continuous mode?


A control loop needs to take a single sample, do some calculations on it, and output a control signal.  Therefore, a control loop is typically a Fixed Samples with 1 sample.  These are best done in an FPGA.


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 4 of 6
(3,102 Views)

Hi crossrulz,

 

Thanks for the input.

 

Recapitulating, I asked what was the difference between N Samples and Continuous Samples mode, and the way the task stops in each case was argued to be different. I asked how, and you explained that the use of the buffer in each mode is also different. This has nothing to do with the way the task stops, right?

 

With regard to the buffer. The way I understand it, the buffer is a segment of memory that a program uses (in this case, Labview) to store data that is coming from somewhere, temporarily, so it has time to read it.

So, when I choose N Sample mode, I believe the program allocates a buffer with size N. This is written in NI support page:

  • If the acquisition is finite (sample mode on the DAQmx Timing VI is set to Finite Samples), NI-DAQmx allocates a buffer equal in size to the value of samples per channel.

When I choose Continuous mode, however, it allocates a buffer with one of 4 possible sizes. In the same NI page:

  • If the acquisition is continuous (sample mode on the DAQmx Timing VI is set to Continuous Samples), NI-DAQmx will allocate a buffer according to the following table:

table buffer labview.png

 

 

 

 

What is the practical implication of these two scenarios?

 

For example, imagine my thermistor is reading temperature values that follow a straight line with constant positive slope: at a given instant it reads 20ºC, if you were to look 1 second later it would read 21ºC, 0.5 seconds later it would read 21.5ºC, and so on. If you chose N Sample mode, with N = 2, with sampling frequency of 4 Samples/s, what would you see on the Labview graph? And what would be different in a Countinuous mode case?

This example is basically the root of my doubts, if someone could answer it, it would be very helpful.

 

 

Still regarding this:

reading n samples per call might be a problem when you want to implement a control loop which needs to process all samples as fast as possible…

So in a control loop, it might be a problem to use the N sample mode as well as the Continuous mode? I think I understood it wrong, I though this meant only N sample would be inappropriate, and so Continuous mode was the solution. But what was said was that both this modes were inappropriate, and 1 sample on demand was the best way. Am I correct?

 

Thanks again for the effort.

 

(Source of my quotes: http://digital.ni.com/public.nsf/allkb/E1E67695E76BA75B86256DB1004E9B07)

 

0 Kudos
Message 5 of 6
(3,074 Views)

You are way over thinking this.

 

Finite Samples: Reads N samples when you perform a Read and it is done.  If you do another read, the data between reads will not be continuous (ie there will be a time gap).

 

Continuous Samples: The DAQ constantly takes samples.  You just get the last samples when you perform a Read.  This eliminates the time gaps between you performing reads.


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 6 of 6
(3,070 Views)