LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying Network Shared Variables From a Compiled Executable

Hi all. I am trying to get two compiled LabVIEW executables to pass data through a network using network shared variables. Somehow I can't seem to get it to work on two seperate computers. It does work if both executables are running on the same computer with the network parameters set to "localhost". I have ensured that MIcrosoft Firewall is disabled. I have also installed LV runtime engine on the computers since they do not have LabVIEW installed.
 
I have manually deployed the library using the "invoke node " block. However, I am unsure of what I should put for the  "Target IP Address" and "Library Path" for both programs. Should each program be pointing to their own Library Path where the shared variables are located? Also, is the Target IP Address of the Server program set to "localhost" since it only writes to the shared variable? The Client program should have the Target IP Address set to the IP address of the computer where the Server program resides? The setting for the client shared variable is blind to the server shared variable.
 
I read somewhere on this forum that the ALIASES file has to be set correctly too, but I do not know correct settings to use.
 
I have attached the VI and executables. Could anyone help to advice on what could be wrong. Thanks
0 Kudos
Message 1 of 15
(8,050 Views)

Hello,

Clients subscribe to the published variable on the server - the terminology often used with shared variables is simply subscribers and publishers.  There is actually a good document discussing requirements and pitfalls when attempting to do this, but it isn't live on the web yet.  I have also included a couple links below, one of which is to a tutorial which is quite descriptive about the NI-PSP protocol from a high level.  Here's an excerpt from it, followed by the relevant contents of the document which isn't yet live on the web:

Excerpt from the "Using the LabVIEW Shared Variable" tutorial also linked below:

"In order to use network-published shared variables, an SVE must be running on at least one of the nodes in the distributed system. Any node on the network can read or write to shared variables that the SVE publishes. As shown in Table 1, nodes can reference a variable without having the SVE installed. You also might have multiple SVEs installed on multiple systems simultaneously if you need to deploy shared variables in different locations based on application requirements."

Document Contents Not On-line Yet:

How do I Communicate Between Multiple LabVIEW Executables using Shared Variables?

Problem: I have developed two Executables and need to pass data between the two, how is this done using Shared Variables?

Solution: In order to communicate between multiple executable applications using the shared variables it is important to use one LabVIEW Project that contains all of the Build Specifications for each Executable that is to be built.

In order to use Shared Variables they must be deployed, and when using them with Executables, it is important to explicitly do this as it cannot be automatically achieved as it normally can within the LabVIEW Environment.

This is best achieved programmatically using VI Server and is fully documented in the following document:

How Do I Deploy Network Shared Variables From a Compiled Executable?

One common pitfall is including the Project Library that hosts the Shared Variable(s) within the Executable itself as this is the default destination. Whilst configuring the Build Specifications settings, remember to change the Library's Destination to the Support Directory or another Pre-defined Directory.

An example project is attached to this document and can be used to demonstrate the behaviour. Remember to check through all of the Build Specification Settings in order to resolve any file paths to suit the local machine.

 

See also these resources:

1. Troubleshooting Network-Published Shared Variables

2. Using the LabVIEW Shared Variable

If you find these resources insufficient or you have other questions, definitely repost here!

Best Regards,

JLS

Message Edited by JLS on 05-09-2006 05:46 PM

Best,
JLS
Sixclear
0 Kudos
Message 2 of 15
(8,043 Views)
Hi JLS. Thanks for replying. I think you have forgotten to attach the example project you mentioned.
0 Kudos
Message 3 of 15
(8,038 Views)
Hello,
 
Ooops... sorry about that!  It was part of the document which isn't live yet - it should be attached here!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 4 of 15
(8,029 Views)
Hi. I have just tried out the example you attached but I am getting the same problem again. The executables are working well when both are running on the same computer. However, when I have the publisher and subscriber on different computer, it doesn't work anymore.
 
I also noticed that your approach is different from mine. You are using 1 network shared variable in both programs whereas I have 2 different shared variables but one is bounded to the other. What is the difference in this case? I am suprised that you did not do a manual library deploy in your subscriber VI. If the subscriber is running on another computer, it wouldn't know where is location of the library to deploy.
 
I actually got it to work on 2 seperate computer using the program I attached earlier in my first post. The problem lies in how I bound both the network variables together. I have the following shared variables, "Count" and "Bind Counter". "Bind Counter" is binded to the "Count" variable with the path set to "192.168.100.100\SVServer.lvlib\Count". Then I have the Server and Client VIs running on two different computers each having the IP addresses "192.168.100.100" and "192.168.100.101" respectively. On both the executables, I just need to set the target IP address to "localhost" and the Library Path to the local directory where the library file is located. Then everything works. The computer running the Server program has LabVIEW installed while the computer running the Client program does not have LabVIEW installed but has LabVIEW runtime engine installed instead.
 
What I am puzzled about is why the "Target IP Address" should be set to "localhost". The conclusion I have reached is that the client program actually reads from the "Bind Counter" variable located in it local library directory and since this shared variable is bounded to the "Count" variable with the path settings (192.168.100.100\SVServer.lvlib\Count), it is then able read the data from the "Count" variable located in the other computer specified by the IP address. So then what is the use of the "Target IP Address" in the deploy library node?
 
I also believe that there should be another way of doing it because we should be able to set the path we want to bind the variable to from the executable program and not from LabVIEW. Else it would be pointless since we cannot move the Server program to another computer having a different IP address. Perhaps that is what you are trying to do with your method where no binding is done and only one shared variable is used across all the subscribers and publishers.
 
This is a pretty new and interesting topic. Hope we can get all the doubts and problems sorted out.
 
 
Cheers,
KP
0 Kudos
Message 5 of 15
(8,023 Views)

I forgot to mention about something else. How effective would network share variables be used for publishing data from acquisition devices? I have tried publishing 1 Channel of acquisition data sampled at 200kHz using network shared variables without buffering and with the subscriber program running on the same computer and was losing same data on my subscriber program. I have switched to using the basic TCP/IP protocol instead and everything works well without any problems. Does it mean that the network shared variable method is inferior to TCP/IP method? I thought it was mentioned on the internet that network shared variables can be use with real time targets from remote acquisition and monitoring?

Anyone has any experience to share on how they have used network shared variables for this kind of work and what was the size of the data being transferred.

 

Cheers,

KP

0 Kudos
Message 6 of 15
(8,021 Views)
Hello,
 
Have you tried this with buffering?  The following is taken directly from the tutorial (item 2) linked in my previous post:
 
"With buffering, you can account for temporary fluctuations between read/write rates of a variable. Readers that occasionally read a variable slower than the writer can miss some updates. If the application can tolerate missing data points occasionally, the slower read rate does not affect the application and you do not need to enable buffering. However, if the reader must receive every update, enable buffering. You can set the size of the buffer on the Variable page of the Shared Variable Properties dialog box, so you can decide how many updates the application retains before it begins overwriting old data. LabVIEW uses the buffer size you specify to create two internal buffers, one at the SVE engine and one at the subscriber."
 
Your network communication is going to fundamentally be tcp/ip, so by using it directly, you may reduce some abstraction overhead, and this could be the reason for the behavior you describe.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 7 of 15
(8,010 Views)
Hi everybody,


I share precisely K.P.'s wonderings in its message no.5 ("what is this "target IP adress" and how to make things work with two executables running on differents machines ?) but I reached the end of the threat without finding any clear answer... !

I hope somebody have answer ? K.P., did you found it out ?

Thanks

Boris... lost in the shared variable's labyrinth...
0 Kudos
Message 8 of 15
(7,314 Views)
Hi Boris,
 
The target IP from LabVIEW Help, "Specifies the IP address of the target where the library is deployed." This should be set to localhost for deploying a library on the same machine. It can be left blank and it will default to the localhost. To make things work with two executables running on different machines, you must deploy the shared variables on both machines and set the client machine's shared variables to "bind" to the host machine's shared variables. This is selected in the shared variables properties within the Project Explorer. Thanks
0 Kudos
Message 9 of 15
(7,274 Views)
To make things work with two executables running on different machines, you must deploy the shared variables on both machines and set the client machine's shared variables to "bind" to the host machine's shared variables. This is selected in the shared variables properties within the Project Explorer.

Ok, it works. For other users, you'll have to know that you must turn off the windowsXP firewall to achieve any shared variable stuff.

I just like to add that you can make two executables work without using two shared variables and the "bind" tip : you can use one shared variable only on the server computer, use a dynamic deploy of the lvlib on the server computer with "localhost"  in the target ip adress, use Datasocket read and write in both executables with input connexion set to "psp://localhost/sharedvariablename" in server VIs and "psp://ipadressoftheserver/sharedvariablename" in client VIs, but don't use the global variable-like "shared variable" structure in the client app (that you can put on the BD with a drag and drop from the project explorer). It's useful when your client is non-windows.
Hope it can help, and thanks again for help.

Boris



 
0 Kudos
Message 10 of 15
(7,246 Views)