Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-time performance of cDAQ-9174 vs. DAQcard6062E

I am running a Matlab script for real-time PID control of a basic system at a 100Hz sampling rate.  When using the DAQcard 6062E, the control loop easily operates at 100Hz (probably capable of 200Hz).  I need more digital outputs than the DAQcard can offer, so I am investigating the use of a cDAQ-9174 (with NI-9403 DIO module and NI-9205 AI modules) that we have onsite.  Unfortunately, I can only get the cDAQ to operate the same loop at 20Hz.

 

The basic structure of my script is:

 

- Configure task

- Begin control loop

   - Read AI's (1 sample per channel)

   - Compute PID value

   - Write DO's

   - Wait for next sample clock

- Repeat loop

 

Could the slower sampling rate of the cDAQ just be due to the USB connection, as opposed to the PCMCIA-connected DAQcard?  Or, could it be something else?  I did need to change 2 things in the Task Configuration just to make the script work with the cDAQ:

 

1) I added the DAQmxSetSampTimingEngine function in the cDAQ script to set the clock to be the "ai" clock.  I could not get the DAQmxCfgSampClkTiming function on the next line to work without setting the timing engine.

I did not have to set the timing engine in the DAQcard script, I assume because the timer and all AI's and DO's belong to the same device name. (?)

 

2) I could not use "HWTimedSinglePoint" as the sampleMode in the DAQmxCfgSampClkTiming function.  I get the following error:

 

DAQmx error - Requested value is not a supported value for
this property. The property value may be invalid because it
conflicts with another property.

 

So, I had to use DAQmx_Val_FiniteSamps to allow the script to work.  I set the number of samples per channel to 2 (which I think is the minimum allowable for DAQmx_Val_FiniteSamps), and only used the first sample.

 

 

I understand there is hardware and software to make real-time running more robust, but at only a 100Hz sample rate, I am hoping to get by with something as simple and straightforward as the Matlab/DAQcard system that I have, whether it be the cDAQ, or one of the newer portable DAQ's.

 

Any help is greatly appreciated!

 

Thanks,

Paul

0 Kudos
Message 1 of 1
(2,815 Views)