05-06-2021 05:44 PM
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
Solved! Go to Solution.
05-06-2021 05:55 PM
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.
05-06-2021 06:08 PM
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);
05-07-2021 05:45 AM
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.
05-07-2021 05:46 AM
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
05-07-2021 09:10 AM
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)
05-07-2021 03:01 PM
Thanks! That explains things.
05-07-2021 03:01 PM
Thanks!