LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Samples to Read and Rate (Hz)

Solved!
Go to solution

In the DAQ Assisant window, there are two options for reading samples:

1. 'Samples to Read'

2. 'Rate (Hz)'

 

Could someone please define the meaning of these? the context help did not clearify the meaning of these for me.

 

Examples would help also:

 

for example right now I have the settings at:

Samples to Read: 1

Rate (Hz): 200

what does this mean in terms of samples read per second?

Am i recording data at 200 Hz?

 

Any help would be greatly appreciated.

 

Cheers,

Oliver

Message 1 of 13
(20,991 Views)

What is your sample type (Continuous, Finite Samples, Single Sample)?

 

If you are using Continuous, then the sample rate is how often a sample is taken.  Not sure in the DAQ Assistant, but with the DAQmx Timing VI, the number of samples sets the buffer size.

 

If you are using Finite Samples, then the sample rate is the same as the Continuous, but the number of samples is how many samples you want in a single acquisition.  The DAQ card will not continue to gather samples between reads.  It only gathers the defined number of samples with each read.

 

If you are using Single Sample, then neither of those settings are useful.  The card will just take a single sample and be done.


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
Message 2 of 13
(20,982 Views)
It's really pretty simple. The sample rate is how often a sample is taken/output. If doing an analog input at 1000 Hz, the interval between each sample will be .001 sec (1/1000). Instead of Hz, you will often see sample rate expressed as samples per second. Samples to read is just a count of how many samples to retrieve.

In your case, it is probably silly to talk about sample rate when you only request a single sample. You may be reverting to software timing when you request a single sample.

Use simple arithmetic to determine how long it will take to do a read - # samples/samples per second.
Message 3 of 13
(20,979 Views)

Hey thank you crossrulz,  I am using continuous for my sample type.  Ok so I am taking 200 samples per second becuase I have my Rate set to 200, but what about 'samples to read?'

I have 'samples to read' set at 1, what does that mean?

0 Kudos
Message 4 of 13
(20,933 Views)

Thank you Dennis_Knutson, so if samples to read is just a count of how many samples to retrieve, what does it mean for me if i am sampling at a rate of 200 Hz, but have samples to read set at 1?

If i want to get 200 samples a second what should i have samples to read set at?

0 Kudos
Message 5 of 13
(20,931 Views)
One sample means 1 sample. The time until the next sample is unknown if you are using on demand timing

Again, this is basic arithmetic and I already gave you the formula. No calculator required. At that rate, if you request 200 samples, it will take 1 second to acquire them.
0 Kudos
Message 6 of 13
(20,926 Views)
Solution
Accepted by topic author OliC

@OliC wrote:

Hey thank you crossrulz,  I am using continuous for my sample type.  Ok so I am taking 200 samples per second becuase I have my Rate set to 200, but what about 'samples to read?'

I have 'samples to read' set at 1, what does that mean?


That means you will read 1 sample each time the DAQ Assistant is called.  A sample is added to the buffer every 5ms, so there will be likely be more data in the buffer.  Therefore you might want to read more.  For instance, if your loop takes 1 second to read, you should read at least 200 samples to keep the buffer cleared.


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
Message 7 of 13
(20,911 Views)

What everyone is talking about is what I thought.   I set the rate to 10hz, then the sample to 1, thinking I'm sampling at 10hz and getting 1 sample per second and that is not the case.  I'm running DaqAssitant in Continuous.  No matter how long I run, it will only give 1 sample.  Unless I increase that number.   The explanation is confusing from labview.


@crossrulz wrote:

@OliC wrote:

Hey thank you crossrulz,  I am using continuous for my sample type.  Ok so I am taking 200 samples per second becuase I have my Rate set to 200, but what about 'samples to read?'

I have 'samples to read' set at 1, what does that mean?


That means you will read 1 sample each time the DAQ Assistant is called.  A sample is added to the buffer every 5ms, so there will be likely be more data in the buffer.  Therefore you might want to read more.  For instance, if your loop takes 1 second to read, you should read at least 200 samples to keep the buffer cleared.



@crossrulz wrote:

@OliC wrote:

Hey thank you crossrulz,  I am using continuous for my sample type.  Ok so I am taking 200 samples per second becuase I have my Rate set to 200, but what about 'samples to read?'

I have 'samples to read' set at 1, what does that mean?


That means you will read 1 sample each time the DAQ Assistant is called.  A sample is added to the buffer every 5ms, so there will be likely be more data in the buffer.  Therefore you might want to read more.  For instance, if your loop takes 1 second to read, you should read at least 200 samples to keep the buffer cleared.


 

0 Kudos
Message 8 of 13
(13,812 Views)

Hi jaguirre,

 

I set the rate to 10hz, then the sample to 1, thinking I'm sampling at 10hz

Upto here your thinking is correct…

 

and getting 1 sample per second and that is not the case. 

Why do you think you are getting just 1S/s?

You defined a samplerate of 10S/s and so you will get 10S/s (by calling the DAQAssistent 10 times when you always read just one sample)!

 

No matter how long I run, it will only give 1 sample. 

Why do you expect more samples when you only ask for 1 sample?

 

Unless I increase that number.

As soon as you request more samples you will get more samples per read request!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 13
(13,801 Views)
  1.  How do you determine how long it takes for your loop to run, and
  2. How often is data read from this "buffer" (time in seconds)
0 Kudos
Message 10 of 13
(12,010 Views)