Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with sample rate for add_ai_bridge_chan

Solved!
Go to solution

Hello, everyone,

I am using nidaq in python to acquire analog channels. When I use ai_current_chan or add_ai_voltage_chan I have no problem, I set the acquisition frequency and get what I expect. But when I use add_ai_bridge_chan, it is as if the set frequency is not taken into account. Below is a code example.
Thank you for your help.

import nidaqmx
import numpy as np
import time

Samples_rate = 50 # [n]
Time_sampling = 13 # [s]
Samples_Per_Ch_To_Read = Time_sampling * Samples_rate
task_read = nidaqmx.Task()
task_read.ai_channels.add_ai_bridge_chan('cDAQ1Mod7/ai0', min_val=-0.4, max_val=0.4, voltage_excit_val=3.3,
units=nidaqmx.constants.BridgeUnits.MILLIVOLTS_PER_VOLT,
nominal_bridge_resistance=351.000)
task_read.timing.cfg_samp_clk_timing(Samples_rate, sample_mode=nidaqmx.constants.AcquisitionType.FINITE,
samps_per_chan=Samples_Per_Ch_To_Read)
task_read.ai_channels.add_ai_current_chan('cDAQ1Mod1/ai0:3', min_val=4 * 10 ** (-3),max_val=20 * 10 ** (-3), ext_shunt_resistor_val=390)
t = time.time()
data = task_read.read(Samples_Per_Ch_To_Read,timeout=-1)
elapsed = time.time() - t
print(elapsed)
print(np.shape(data))
0 Kudos
Message 1 of 5
(639 Views)

How do you tell that the set frequency is not working? What is the expected behavior and what were you seeing?

What is the model of the DAQ device you are using?

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 2 of 5
(617 Views)

For example in the given code I expect to receive as elapsed 13 seconds. If I only use the current channel, I receive exactly 13 seconds. Invese if I add the bridge, I get less than 1 second. It is as if it does not listen to the value of Samples_rate (in the example 50 Hz) and acquires at a high frequency.
I am using cDAQ-NI9178, NI9215 and NI9237.

0 Kudos
Message 3 of 5
(610 Views)
Solution
Accepted by En_Am

According to NI-9237 Specifications, the minimum data rate is 1.613kS/s. Even if you specify a sampling rate of 50S/s, the driver will coerce this value to 1.613kS/s.

For a detailed explanation, see Valid Sampling Rates for NI DSA, CM C Series and SC Express Devices

 

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 4 of 5
(576 Views)

Thank you!

0 Kudos
Message 5 of 5
(570 Views)