10-14-2011 01:14 PM
Hello,
I am new to signal processing and confused about the DAQ Assistance option "samples to read".
What I understand is about
Sampling rate indicates the samples read per second, I run my vi for a second and I got 10K samples when my sampling rate is 10k. Frequency resolution is also depend on this sampling rate and Samples to read.
My settings in DAQ Assistance are
continuous acquisition, Samples to read--1K, sampling rate--10K and I run my Vi for exactly one second and I got 10K samples but I am confused about "Samples to read". What it is exactly?
Thank you.
10-14-2011 01:39 PM
Hi shjukheter,
In LabVIEW samples per channel attribute could have two performance, using continuous acquisition that attribute specify the DAQ buffer size. Using Finite Samples, that attribute specify the number of samples to acquire for each channel in the task.
In your case DAQmx don´t use that value in order to configure the buffer size, due using sampling rate-->10kS/s the minimum buffer size should be 100kS.
I hope this information will be helpfully.
Regards,
Hiram Hernandez
10-14-2011 01:43 PM
I did not understand quite but what happens if I do not write any thing on that box.
10-14-2011 02:00 PM - edited 10-14-2011 02:02 PM
You can't write "nothing" in that box. The value must be 1 or greater.
It is a bit confusing, because in Continuous Mode, it really isn't Samples to Read, it is a range of buffer sizes - which was described in the previous reply.
Check out the HELP >>> Buffer Size
If your acquisition is finite (sample mode on the Timing function/VI set to Finite Samples), NI-DAQmx allocates a buffer equal in size to the value of the samples per channel attribute/property. For example, if you specify samples per channel of 1,000 samples and your application uses two channels, the buffer size would be 2,000 samples. Thus, the buffer is exactly big enough to hold all the samples you want to acquire.
If the acquisition is continuous (sample mode on the Timing function/VI set to Continuous Samples), NI-DAQmx allocates a buffer equal in size to the value of the samples per channel attribute/property, unless that value is less than the value listed in the following table. If the value of the samples per channel attribute/property is less than the value in the table, NI-DAQmx uses the value in the table.
Sample Rate | Buffer Size |
---|---|
No rate specified | 10 kS |
0–100 S/s | 1 kS |
100–10,000 S/s | 10 kS |
10,000–1,000,000 S/s | 100 kS |
>1,000,000 S/s | 1 MS |
Note For performance reasons, the default buffer size for continuous acquisitions differs slightly when logging is enabled. |
You can override the default buffer size by calling the Input Buffer Config function/VI.
NI-DAQmx does not create a buffer when the sample mode on the Timing function/VI is set to hardware-timed single point.
Note Using very large buffers may result in diminished system performance due to excessive reading and writing between memory and the hard disk. Reducing the size of the buffer or adding more memory to the system can reduce the severity of these problems. |
10-14-2011 02:03 PM
Hi,
I don't have LabVIEW available at the moment, but if I remember right "samples to read" controls how many samples are read from data buffer per one call of DAQ assistant. So if sample rate is 10kS/s and samples to read is 1k it takes 10 calls to get 10k samples. You could for example control the execution speed of your DAQ loop with that samples to read input. For example if sampling rate = 10kS/s and samples to read = 1k it will take ~100ms to get 1k samples from data buffer.
-Matti
10-15-2011 04:39 AM
Don't be harsh on me but still. I am in confusion.
@MattI Autioniemi wrote:
Hi,
I don't have LabVIEW available at the moment, but if I remember right "samples to read" controls how many samples are read from data buffer per one call of DAQ assistant. So if sample rate is 10kS/s and samples to read is 1k it takes 10 calls to get 10k samples. You could for example control the execution speed of your DAQ loop with that samples to read input. For example if sampling rate = 10kS/s and samples to read = 1k it will take ~100ms to get 1k samples from data buffer.
-Matti
I though the same what you explained but what happens when I run for 500ms. Is it give only 5k samples incase if I have 10Ks sampling rate and 1K samples to read. I don't have DAQ now to test it but I tested yesterday that with normal while loop nothing inside it. For, one second it gave me morethan 1000 counts and for one ms it gave me counts in hundreds. So, Now if I run my continuous acquisition for one second, Is it exactly run for 10 iterations and stop after this?
10-15-2011 06:27 AM
Well that's the expected behaviour to return 5k samples in ~500ms when using sample rate of 10kS/s and samples to read of 1k. In one second (10 iterations, ~100ms each) you should get 10k samples with the same settings. So, everytime you call DAQ assistant with those settings, it waits until 1k samples are available in the data buffer before it can output that data.
Here's some info about this http://digital.ni.com/public.nsf/allkb/8EF7084B908ABF6686257589007C97DF
Those functions you see in the previous link are DAQmx-functions which you could check out. In the long run it would be a better solution to replace your DAQ assistant with DAQmx read. Here's one simple example using DAQmx: https://decibel.ni.com/content/docs/DOC-2118
You can find more examples on the subject from Help->Find examples.
-Matti
10-15-2011 07:40 AM
Thank you so much for that link. Now, I tested with 6008 and I understand well
S.rate Samples to read Loop count Loop stop time in sec NO.of samples Got
---------- ---------------------- ----------------- -------------------------------- ------------------------------
10K 1k 10 1S 11k
10K 5k 2 1S 15k
10K 5k 1 0.1S 10k
10K 1k 1 0.1 or 0.05S 2k
Every time i got a chunk of samples to read extra data because of one extra loop count. I studied the help about while loop and it says zero is the normal count. So it is giving one extra count everytime. I am curious to know about "Can we control that to stop at zero count?"
More, when I run while loop with out any stuff inside I got count in some 1000's for one second and in 100's when it is stopped for a Milliseconds. But in the above case, How it is synchronized with loop counts and time? Why not I am not getting more counts when I run for 1 second?
10-15-2011 07:57 AM
Hmm, how do you calculate those loop stop times? Could you tell a bit more about your application and the problem? It would make it easier to help you.
10-15-2011 08:03 AM
It is not for my application but I am just playing for a while with DAQ. I just have DAQ Assistance in while loop with an elapsed time option to stop the while loop for specified time and at the same time I am writing my samples to a file and counting the loop. This just for knowing nothing related to application.
More, I run the while loop without anything inside only the specified time to stop and loop count to check the iterations.