From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-16-2011 11:37 AM
Hi!
Its been awhile since I've messed with Shared Variables, and their inflexibility back in 2008ish lead me to just use the DataSocket server approach instead.
Revisiting them now for an application using LabVIEW 2010, and trying to see what has changed.
I'm interested in using shared variables to communicate between labview applications that run on seperate machines. Neither machine will have the full LabVIEW development system. They will have runtimes installed.
From what I recall before, I had to create two seperate shared variable libraries that mirrored each other. One was for my "publisher" computer, and the other "subscriber" library contained variables that linked to the "publisher's" shared library. The path had to be entered in the shared variable dialog box (which made it difficult to test on my development machine...I didn't like having to use a static computer name or IP address in the setup of these variables).
I also recall that I had to check if my application was an EXE and then deploy the variable libraries progmatically. Is that still the case? I see that there is a check box in the application build for deploying shared variables but the path names bother me.
Does anyone have a clean LabVIEW 2010 example for this? The shipped Shared Variable example won't open because it says I'm missing some addin (which addin would be nice to know, but that information was not in the dialog box....). Example I find on website is for LabVIEW v8, and I know there have been changes to Shared Variables since then.
Thanks for your input!
06-16-2011 04:30 PM
I did some testing. It appears that there no longer needs to be any special programming to detect if the VI is part of an application build and if it is ensure that the library containing the shared variables is deployed. There also doesn't seem to be a need to "Always Include" the library that contains the shared variables and ensure that it is installed in a known location. The checkbox in the Application build specifications to "Deploy the shared variables" works as expected.
What still seems to be needed is in the "consumer" applications running on other machines, another library with shared variables needs to be setup and configured to alias the shared variables on the "producer" application and machine. This will work fine for the application I'm building now, but I still dislike this hard-coded network path in a dialog box. Easy to use, but lacks flexibility.
06-17-2011 11:05 AM
Hi Nickerbocker,
I'm glad that you've found Shared Variables in LV 2010 to be easier to use. It sounds like you've gotten to the point of understanding it. Here's a document that will go into more details, for your reference:
http://zone.ni.com/devzone/cda/tut/p/id/4679
Regards,
06-17-2011 09:14 PM - edited 06-17-2011 09:15 PM
That was a good reference article. Thank you.
I have a couple of implementation questions. This is vanilla LabVIEW 2010 development suite, mind you.
Thanks!
06-17-2011 11:32 PM - edited 06-17-2011 11:33 PM
So, I think I answered my first question. The way I was linking the varibles in my code and deploying a library of shared variables in each of my applications to local machine SVEs was more overhead than I needed (and it looked like it was slower than it is now).
I can use the variables in a single library in both application VIs and builds. This works if I modifity the .alias file that is created and set [My Computer] = "SVEHostComputer" on the client machines. It makes me uncomfortable pointing an alias titled "My Computer" to another computer. Is there a better way to do this? Are there any cosequences?
The only other way I've found that works is if I right-click the shared variable and select "Replace with Programmatic Access", and then change the "My Computer" to "SVEHostComputer". I prefer just changing the .alias file.
Thanks for the input.
06-20-2011 11:30 AM
Another question: is there anyway to setup an interrupt driven thread for reading shared variables? Or is polling the only option?
06-21-2011 08:59 AM
Hi Nickerbocker,
You can do an interrupt driven. However, it does require that you're using the DSC module. Please see the following forum post regarding this:
Also, an example can be found here:
https://decibel.ni.com/content/docs/DOC-4375
If you're interested in this approach, then please let me know. I can get an account representative to contact you if you're interested in getting the DSC module.
Regards,
06-21-2011 10:29 AM
Thanks for your reply. The DLC module looks too expensive and I would only like to have this 1 feature from it. I think I'll go with a polling setup for this project.
What about the .alias file? Are there any unforseen sideeffects of setting the [My Computer] entry to point to another network location? It is awfully convienant to do it this way for testing on my development machine and deploying w/ a pre-configured .alias file that points to the SVE.
06-29-2011 10:10 AM - edited 06-29-2011 10:11 AM
The .alias file is there to resolve logical target names in NSV URL's. The only potential problem would be if you also want to have locally hosted NSV's in which case you would need to
modify the default target name to something unique since it will also be named [My Computer].
It is too bad that NI requires you to purchase the expensive DSC if you only want NSV events since actually that capability is built into the SVE but LabVIEW does not exposed that functionality.
In CVI you can access those events right out of the box. I imagine that someone who knows CVI could create some sort of wrapper that could setup and trap NSV events and then trigger a LV occurance or even better a LV user event.