06-24-2016 08:39 AM
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:
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
State-Read Bridge
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
06-29-2016 06:47 AM
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
06-29-2016 07:51 AM
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
06-29-2016 08:08 AM
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
06-29-2016 08:55 AM
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