Data acquisition with NI modules with different sampling rate requirements (NI 9219 and 9234) on a 9174 chassis

19 vues (au cours des 30 derniers jours)
Hi everyone.
I am trying to acquire signals coming from two National Instrument modules (NI 9234 and 9219) which are docked to the same cDAQ 9174 chassis.
The problem is : on the one hand, the 9234 is a high-speed Delta/sigma converter module, which lowest sample rate is 1651.6129Hz. On the other hand, the 9219 is a slow-sampled module, which sample rate cannot exceed 100Hz.
According to this page, it is possible to do what I am looking for. When measuring the same signal on both channels of NI Measurement and Automation eXplorer software, I experience what is described (the 9234 acquires data at the chosen sample rate while the 9219 acquires data as fast as it can and replicates samples to fill the gaps). So, what I am trying to do is possible (Yay !)
I am looking to do this with Matlab Data Acquisition Toolbox solution (NI Max cannot save the recorded data). However, I have trouble because the sampling rate is defined for the session. Creating a session with channels coming from both 9234 and 9219 results in the following warning messages :
Warning: A channel that does not support on-demand operations was added to the session. On-demand operations using inputSingleScan and outputSingleScan will be disabled. Only clocked operations using startForeground and StartBackground can be done.
Warning: The Rate property was increased to 1651.6129 due to changes in the session configuration. Warning: A channel that does not support clocked sampling was added to the session. Clocked operations using startForeground and startBackground will be disabled. Only on-demand operations using inputSingleScan and outputSingleScan can be done.
Warning: This property must be the same for all channels on this device. All channels associated with this device were updated.
The resulting session has an authorized sample rate ranging from zero to zero... I do not know inputSingleScan very well but it does not seem well-fitted for continuous data acquisition.
To overcome this, I tried to create two data acquisition sessions : s0 (sampled at 6400 Hz, with a channel from 9234) and s1 (sampled at 100 Hz, with a channel from 9219). However, starting these sessions separately results in a ~800ms delay between channels (I guess it is the initialization time of the first session for which I use startBackground).
Does someone know a trick to help me ? Either a way to create a DAq session with several sampling rates, or a solution to start acquisition on two sessions simultaneously ?
I tried to use the addTriggerConnexion function to trig one session with the other one. I am quite a beginner with DAq Toolbox but it does not seem to work (given that both my modules are connected to the same 9174 chassis, the source and destination of the trigger are on the same device, resulting in an error).
Thanks in advance,
Lionel

Réponse acceptée

lionel velut
lionel velut le 29 Mar 2017
Hello.
I submitted the question to mathworks support. I attach the codes they sent to me. Basically, it consists in building two sessions (one for the "fast" 9234 module, one for the "slow" 9219 module) and calling a DAQmx driver function to trigger one session with the other.
These codes may help some people here, because even if the NI support website provide some documentation about the driver functions, it is (obviously) Labview-oriented, and it seems impossible to find any suitable documentation about how to call these with Matlab.
  1 commentaire
Roni Hilel
Roni Hilel le 9 Oct 2018
I am getting the error "No appropriate method, property, or field TaskHandle for class daq.ni.CompactDAQ.AnalogInputThermocoupleChannel." after running the line:"taskHandle2 = s2.Channels(1).TaskHandle;" from the example file. What can be done about this? is there a alternative?

Connectez-vous pour commenter.

Plus de réponses (2)

Andrei
Andrei le 21 Mar 2018
Modifié(e) : Andrei le 21 Mar 2018
There is now an example that shows how to do this.
This examples works for a compactDAQ chassis that has PFI terminals (such as NI 9178) or if you have a an additional digital I/O compact DAQ module with PFI terminals (such as NI 9402).
If you have neither of the above you need to use the workaround posted by lionel velut on 29 Mar 2017.

Walter Roberson
Walter Roberson le 24 Jan 2017
If it is physically possible, do not have one session trigger the other: instead run a physical sync line between the two (sorry the proper terminology is slipping my mind). One of the devices could emit the sync that is used by other, or if your chassis permits, sync out off of the chassis and sync in on both slots.
  4 commentaires
lionel velut
lionel velut le 25 Jan 2017
I have no idea this was possible... but I guess I should ask. Also, a sales representative from NI will come in some days I will ask him.
Walter Roberson
Walter Roberson le 26 Mar 2018
(The terminology I was looking for back then was "genlock")

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simultaneous and Synchronized Operations dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by