Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Acquisition for multiple cDAQ using single labview

Hello All, 


My application works but my gutt feeling is that I may be doing something really daft and application may not be a reliable long term solution. Here is the requirement of applications:

  • Over ethernet many cDAQ devices are communicating with PC powered with labview executable application. 
  • Client may wish to disconnect any cDAQ device by disconnecting ethernet connection and application must continue and read other devices without creating errors. 
  • When application is running and ethernet connection is re-established to disconnected cDAQ device, then application starts reading the cDAQ device as normal. 

 

I have created application and it works fine. I am using following control algorithm for two states of states machine - Build task and Read Bridge- I have not seen so far any problems but i wanted to ensure that I am doing it the right way and I have created a good vi. 

 

VI algorithm:

State-Build task

  • Use array of references to each cDAQ device to access unique cDAQ device within each iteration of for loop. 
  • Use Daqmx function 'Daqmx self test.vi' to check if device is present. If device is present and communicating, there would be no error so build task using Daqmx function 'Create task.vi' and iterate to state 'Read Bridge'. Please see image 'Building task so often'. 
  • The above actions would create Daq references after for loop finish iterations, use shift register to collect these and use in 'Read Bridge' state. 
  • If vi 'Daqmx self test.vi' creates error due to ethernet problem for a particular cDAQ device in corresponding for loop iteration, clear error in error case using 'Clear Error.vi'.
  • Next state is 'Read Bridge'.
  • And that's about it.

State-Read Bridge

  • Use Daq References accumulated in state 'Building task so often' to iterate using for loop for each cDAQ device. 
  • Use again 'Daqmx self test.vi' to check if device is available and if communication fails and vi returns error, simply clear error. 
  • If 'Daqmx self test.vi' returns no error, use 'Daqmx Read' function to take reading. 
  • Next state is again 'Build task'. It is to ensure that application continuously reconnects with cDAQ devices, create tasks, update Daq references and do not respond to any errors caused by disconnected devices. 

Above principles work but I am not sure if it is right to reuse every iteration function 'Daqmx self test.vi' and create task using function 'Create task.vi' in every iteration of vi. 

 

Please advice if it is ok to use these Daqmx functions in arrangement that I have described and if there is a better way to achieve same requirements! Please find attached images for both states 'Build task' and 'Read Bridge' state of vi. Unfortunately, as vi links too many other subvis and project itself contains multiple libraries and vis, I am unable to share whole project. 

 

Many thanks

Khurram

ATE and Labview Consultant
https://www.easybodge.com
Download All
0 Kudos
Message 1 of 5
(3,739 Views)

Dear k-waris,

 

This could probably end up in a lot deeper discussion about LabVIEW architecture but to keep it short I try to answer just the question you asked.

 

The way you have written the code seems good and clean, good work!

 

Considering the application it will run exactly as you have planned. Also it will not use too much extra resources since polling whether the device is connected or not does not use a lot of processor resources. Still though, if/when you might want to start expanding and further developing the application it might be worth considering to add a state, where the devices are checked. This would save the trouble of checking on each iteration. But you would loose the .vi functionality that the user could disconnect and connect a device in the middle of measurement without getting an error.

 

So even though some processor resources could be saved by making small changes to the code, it may require more configuring from your end to maintain all the features. If this is the eventual application then you should possibly stay with it.

 

Best regards,

Jarmo Levo

Applications engineer

National Instruments

0 Kudos
Message 2 of 5
(3,660 Views)

Hello Jarmo,

Many thanks for your suggestion. I am more worried if NI DAQmx function 'SelfTest.vi' that I have used physically sets/resets anything on cDAQ 9181? or things like maximum number of read/write for cDAQ 9181 which could be affected by using this function? 

 

I might be sounding daft but is it possible for NI R and D to advise if it is ok to use this function how I have used or should i used basic tcp/ip function to ensure handshaking takes place before reading Daq device?

 

Kind Regards

K Waris

ATE and Labview Consultant
https://www.easybodge.com
0 Kudos
Message 3 of 5
(3,651 Views)

Hello again k-waris,

 

While in LabVIEW press ctrl+h, this will bring up the pop-up help window. Now place your mouse over the SelfTest.vi function. The help window will show you the basic information of function. While you have this function visible, from the bottom of help window press Detailed help.

 

This will give you more information on the functionality of this function. As you can see from the three different self-test configurations possible the basic (0) testing will only test whether your device is connected. Unless you are using the full (2) test functionality you are not required to disconnect anything from your device and such the device will not reset in any way.

 

This thread also gives optional method for checking your DAQ devices. It uses property nodes and an for loop to actively monitor if the devices are connected.

http://forums.ni.com/t5/LabVIEW/How-to-check-if-DAQmx-device-is-connected/td-p/3110101

 

Regards,

Jarmo

0 Kudos
Message 4 of 5
(3,646 Views)

Hello Jarmo, 

I have built software using NI Daqmx self test vi, location NI Daq-mx>Dev Config> Reset Device.vi

This does not have input to set 'self-test configuration'! 
However, I would try to use vi that you recommended which is found under System Configuration api and set it to basic. 

 

Thank you

K Waris

ATE and Labview Consultant
https://www.easybodge.com
0 Kudos
Message 5 of 5
(3,644 Views)