09-27-2012 11:21 AM
I am building two applications that will shared information between each by shared variables. The first application will deploy the shared variable library. I would like to build into second application the ability to check if the library is deployed and inform the user to start the first application before continuing with the second. The problem I am having is finding a way to check if the library is deployed. Can someone help me out with this.
Terry
09-28-2012 07:01 PM
Hello Terry,
That is a great question. There are two options for you to do this. The first is you could set up a known signal variable in the shared variable library that is created by the first application. Then you could build into the second application code that checked if it can read that known value from the shared variable library. In the second method you could use errror handling in order to be assured that the library has been deployed. You could read the information that was already in the shared varible library and if it gives you a timeout error that there is no informaiton available at that location then you could inform the user to check if the second application is looking in the correct location or if the first application deployed the shared variable and did it deploy it to the correct location.
Regards,
Izzy O.
Applications Engineer
National Instruments
11-30-2015 03:45 AM
Does anybody know any better (more elegant and without waiting for timeout) way to check this out (LabVIEW 2014 SP1)?
Thanks!
Mateusz Owczarek
11-30-2015 06:39 AM
@MateuszOwczarek wrote:
Does anybody know any better (more elegant and without waiting for timeout) way to check this out (LabVIEW 2014 SP1)?
Thanks!
Mateusz Owczarek
Maybe I'm being naive, but it seems to me that you almost have to "wait for a timeout", at least if you want to conclude "The Shared Variable is not available". Here's my simple example -- disconnect the remote PC from the network. How can you "know" that it is not there without "asking" for it (Ping, attempt to access something, etc.) and having it fail? What does it mean, "to fail"? Doesn't it mean "no response for N milliseconds"?
Bob Schor
11-30-2015 06:52 AM
Hi Bob,
Thanks for your answer, actually you're right about the timeout.
However, I still miss something I'm looking for. I can check if specific variable exists (and set timeout value for that operation, which is great!) using 'Open and Verify Variable Connection Function' (http://zone.ni.com/reference/en-XX/help/371361L-01/lvcomm/veropenvarcon/), but I would like to examine the library, not a single variable. Any idea?
11-30-2015 10:24 AM
The machine from which you deployed the Shared Variables should have an instance of the NI Distributed System Manager running (look for it in the National Instruments folder under All Programs). This shows you all "reachable" machines and any variables they may be hosting, and even allows you to (manually) read, write, and otherwise "play" with them.
Bob Schor
12-01-2015 01:17 AM
Thanks, I know this tool. I'm looking for programatically access from LabVIEW.
12-02-2015 11:35 AM
Hi Mateusz
I don’t think you’ll be able to determine the reachable machines programmatically in LabVIEW to the same degree as you would by looking at the Distributed System Manager. I think the best option may be the previous suggestion, waiting for a timeout of one of the variables. Would it work if you just checked a specific variable that always exists when the deployed machine is in a reachable state?
12-02-2015 02:02 PM
I never did find an elegant way of determining if the library is deployed. So in my case I decided to check whether the first application is running. The first application looks after the error checking to ensure deployment. The second application only needs to determine if the first is running. I sys exec.vi to check the computers tasklist.
Terry
12-03-2015 03:52 AM
Terry,
Will,
Bob,
Thank you guys for answers. Of course I can handle that e.g. using your ideas. Unfortunately netiher of them are what I'm really looking for (simple and elegant way to check if shared variable library is deployed), so it is probably impossible in LabVIEW.
As you suggested, probably the best available way is to read specific variable, so we can close this topic unless somebody has any brilliant idea 🙂
Mateusz