Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition rate differs from sampling rate?

Solved!
Go to solution

Hi everyone,

 

I am working with a cDAQ 9171 chassis and a NI 9775 DAQ card.

 

I am performing a continuous data acquisition measurement with a sampling rate of 100Hz and a sampling size of 100 samples/channel. My understanding has been that this would yield 100 data points every second. However, I receive 100 data points around every ~0.3s. 

 

Am I missing anything here?

 

Best and thank you in advance

0 Kudos
Message 1 of 8
(1,295 Views)

Your understanding is correct, 100Hz sampling rate would mean that it captures 100 samples per second. The real question is not a lot of HW support such low rates, in fact, driver auto coerce to the minimum supported value.

 

You can query back the sampling rate to know the actual rate. Please share the code you used to measure these numbers.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 8
(1,286 Views)

How can I query back the actual sampling rate?

 

In the code below rateNumeric.Value = 100 and samplesPerChannelNumeric.Value=100 (Notice that this is just the generic code from the examples files).

 

// Create a new task
myTask = new Task();

 

// Create a virtual channel
myTask.AIChannels.CreateVoltageChannel(physicalChannelComboBox.Text, "",
(AITerminalConfiguration)(-1), Convert.ToDouble(minimumValueNumeric.Value),
Convert.ToDouble(maximumValueNumeric.Value), AIVoltageUnits.Volts);

 

// Configure the timing parameters
myTask.Timing.ConfigureSampleClock("", Convert.ToDouble(rateNumeric.Value),
SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, Convert.ToInt32(samplesPerChannelNumeric.Value));

 

// Verify the Task
myTask.Control(TaskAction.Verify);

 

runningTask = myTask;
analogInReader = new AnalogMultiChannelReader(myTask.Stream);
analogCallback = new AsyncCallback(AnalogInCallback);

 

// Use SynchronizeCallbacks to specify that the object
// marshals callbacks across threads appropriately.
analogInReader.SynchronizeCallbacks = true;
analogInReader.BeginReadWaveform(Convert.ToInt32(samplesPerChannelNumeric.Value),
analogCallback, myTask);

 

0 Kudos
Message 3 of 8
(1,277 Views)
Solution
Accepted by topic author scitune

To the data sheet we go...

 

Page 12 states the valid data rates.  After doing the math, the slowest rate the 9775 can achieve is 305.18 S/sec.


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 8
(1,242 Views)

Or you take a look at the datasheet of the module (page 12):

 

https://www.ni.com/pdf/manuals/377101b_02.pdf

 

Lowest rate according to this is a little bit above 305 Hz

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 5 of 8
(1,241 Views)

I think you got your answer why you get 100 samples every ~0.3 seconds, though you configure 100Hz as sampling rate since the lowest supported is 305Hz, it coerced and captured at 305Hz which would give you 100 samples every ~0.328 seconds.

 

To read back the actual sampling rate, use the timing property node (do this only after the task is verified or committed)

santo_13_0-1620396632714.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 6 of 8
(1,231 Views)

Thanks! That explains things.

0 Kudos
Message 7 of 8
(1,217 Views)

Thanks!

0 Kudos
Message 8 of 8
(1,216 Views)