I used network published shared variable for communication between PC and a RT target. The shared variable is deployed to RT target. In the host program the shard variable is directly dropped in from the Project Explorer. After I changed the IP address of the RT target I have to rebuild the application in LabVIEW to get the host application to communicate with the shared variable on the RT target again. It doesn't work just changing the IP address of the RT target in the aliases file. Is there a way to get the host program to communicate with the RT again without rebuilding the application program? Thanks for help!
The trick lies in the library that you create to define "subscribing" shared variables bound to the host (publisher) shared variables.
In this library, just change the PSP URL of the shared variables (without changing shared variable names) so that now they again refer to a valid IP address. Save this library (without changing library name).
Now, wherever you have installed/deployed your application, just replace the original library with this new library, and that's it. Your program should work as before.
Please let me know if this is not working for you.
The shared variable library was deployed to RT target. On host there is no library deployed. There is no library file after building the host application.
Thanks for help!
Ok, when you build the application EXE, there will be a "data" folder in the directory where your .exe file is generated, right?
In this "data" folder you can find the "library" that has definition of the shared variables that you have used in your program, if you are using shared variable nodes in your program (and not accessing them just by "psp" url using datasocket functions).
These shared variables in the deployed application, are referring to host shared variables (where the shared variables are originally located). I don't understand why you don't have any library in the "host" machine. There must be a library which would contain the shared variables. What do you mean by "host" machine? Can you please be more elaborative about this?
you need a copy of the library on your PC Host. Usually I export the library as a csv file from RT Target ( right click on RT Libray). Then I import libray into Host PC and rename as **Host.lvlib
so you end with 2 libraries:**RT.lvlib & **Host.lvlib.
Use Distributed System manager (DSM) to verify that the libraries are present on Host PC and RT target. DSM is useful tool to verify variables are functional.
'hard wire' your variables to front panel indicators ( if necessary ). Have on ocassion found that using PSP url directly to FP indicators does not refresh values!
a snowed in xseadog.
If your NSV's are derived from the project with absolute reference mode, then they should have a relative process name in the URL. This process name gets resolved by the .alias file when your startup.exe runs.
For host I mean PC, not the real time target. I don't have a shared variable library in my pc. The shared library is only on RT target. There is no data folder in the .exe file. I have attached my project file. The exe file is in build directory.
I tried to use two shared variable library -- one on PC and one on RT target then bind the variable on PC to the ones on host. It works under LabVIEW project explorer. But after I build the exe file and chagne the ip address of the alias the file it didn't work. Could you post a example of your project? Thanks!
you have not included your library for the PC host. So when you build you do not have a reference to it!.
See attached zip. I have not built it but included the library file in the build script.
For reference: export your Rt library ( as a csv file) Create a new library under you PC host. Import the csv file ( RT library). Save the new library as PC.
When building include the libary in the build ( under always include).
Use the Distributed System Manager tool to test your application!
On this computer I have only LV8.6 so I could not open your program. Besides I do not use RT Targets, but I do believe that the things should not be too different for the RT targets in the case of library referencing concepts - the methods are different though.
Let me just explain in plain words what I was saying before and you will see it in your context.
There is a machine (say a PC) where the shared variables are "published" (originally created - without Aliasing) meaning, they are the main (or "server") shared variables, and the library they are contained in is the host library. This variables are called "publisher" variables. In your case the host machine is a PC. And do you mean to say you didn't create these variables inside a library?
Ok, continuing my explanation -
There is another machine, where the shared variables are also created (program design time) and while creating through the project explorer, these shared variables are created with aliasing (bound to the original "publisher" variables) and let's call them as "subscriber" variables.
Now, I am not sure how you have these "subscriber" variables created manually, by binding them to the publisher or in fact they are not created on a remote machine, but rather just deployed automatically from the built application (when it's executed).
In any case, there should be 2 libraries, each on each of the machines, and one library has publisher variables and the other has subscriber variables which are bound (referencing) to the publisher variables.
This is not true only if you are using datasocket API to pass just the PSP URL of the publisher variables. In that case, there won't be any "subscriber" variables or library. But from your posts, you don't seem to be doing this. So, I just guess that you are missing one of the libraries.
And if you are changing the IP address of the publisher variable, you just have to change the definition of the subscriber variable in the library. You can do this programmatically as well, by using DSC module functions or Shared variable IO property node.
Additionally, if none of this is helping you, you might be interested in checking the document - How Do I Deploy Network Shared Variables from a Compiled Executable? and Using Shared Variables in Executables.
I hope this helps.
Please give some more description of your case if this information is not helpful/relevant to you.