LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure shared variables for use on multiple PCs within LabVIEW

   I have an application in which I've used shared variables to communicate between a PC and LV-RT on a cRIO.  The program runs within LabVIEW, not compiled.  This was fairly easy to set up, since the RT controller is specified in the project and given an IP there.  The SV's are hosted on the PC.

   Now I want to add another PC.  It will be running LV, not compiled programs.  I can't figure out how to get the program to link to the SV engine on the original PC.

   I develop all the code on machine A, my desktop PC.  I have a project there with the SV library, the VI's that run on the PC, the RT and FPGA targets and all their VIs.  Now I write the new VI that I want to run on machine B, which also runs XP and LabVIEW 8.5.  But when I move the "B" VI to machine B, how do the variables know where the SV engine is?  Do I move the entire project, and open the B VI from within the project?  In that case, "My Computer" becomes Machine B, which isn't where the SV Engine is.  Do I need to create a completely new project, which contains just the B VI?  It would seem, then, that Machine A should be a target within that project, and that I should have the Shared Variable library in that Project B, but under the Machine A target.  I've tried adding another networked computer to a project using the New \ Targets and Devices menu selection.  I can specify a Networked Computer, and give it a name and IP address.  But I can't drag VI's or libaries into it.  I can add a "Virtual Folder".  But then if I try to add a VI to that Virtual Folder, I get a Generic Project error.

   It seems like it should be fairly simple to use Networked Shared Variables between two PC's, but I haven't been able to find any instructions.  All the forum posts and tutorials seem to deal with deploying compiled programs or RT program.

 

Thanks for any help,

   DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 1 of 14
(6,351 Views)
From Machine B, you will need to alias to all the variables in Machine A. So, on Machine B, create a new project, a new VI and new variables. For all of these variables, alias them to the variables on Machine A. Let me know if you have any questions.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 14
(6,345 Views)

This should help as well:

Developing Portable Shared Variable Applications

 

Let me know if I have not understood your question correctly.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 14
(6,344 Views)

Adnan,

   Thanks for the quick response.  Unfortunately, I'm not quite there yet...

   The link you sent dwells a lot on the issues surrounding deploying compiled programs.  I am trying to run VI's under LabVIEW on both computers.

   Your main suggestion was, as I understand it:  create a new project on Machine B.  Add the VI.  Create a new library with the variables needed.  Then re-alias the variables to Machine A.

   I cannot get this to work.  Furthermore, it seems to me that this idea is incomplete.  I created a new project.  Added the VI.  The VI complained because the shared variables weren't in the project.  So I created a library and created the shared variables.  It still didn't like them, maybe because the library had a different name than on the original machine.  In any case, I replaced the SVs in the VI with the new ones of identical names.  The VI was happy.  But when it ran, it deployed the variables to Machine B, where the VI was running.  So I exited LV.  The only alias file was the project alias, and the only IP inside it was for My Computer (Machine B).  I changed that IP to the IP for machine A, but as soon as I launch the project again, it updates the alias file and puts in the IP for Machine B.

   Actually, this makes sense, as far as I understand it.  The library (as described in the link you sent) is deployed on the machine it appears under in the project.  So as I described it above, the library is deployed on Machine B.

   I think the trick is that I need Machine A to show up in the project that I created on Machine B.  Then I need to add the existing library on Machine A to the project, and use SV's in that library.

   I cannot make Machine A show up on the project on Machine B.  Machine B has LabVIEW, but not RT or FPGA.  So under the New menu under the Project (first line of the project hierarchy), there is only "New...", no option for adding new targets.  So, if you don't have RT installed, is it impossible to add another networked computer to a project?

   Just for fun, I went back to the project on Machine A.  Since this has RT installed, I get "Targets and Devices" under New.  One of the options there is Networked Computer, so I added one, and I gave it the IP of Machine B.  Then I added a Virtual Folder.  Then I tried adding a file.  Using the Windows dialog, I can browse across the network and see Machine B.  Looks like I'm getting close to adding an item on a different networked computer to a project, though this is from A to B, and I need to do B to A if I'm going to host the library on A.  Anyway, ignoring that minor issue...  When I try to navigate into Machine B, it presents me with a Windows login.  No big surprise.  Except that the user name is already filled in as Guest, and the Guest account on Machine B is disabled.  And the dialog won't let me change the user name.

    If I am on the right track, then the only way I can figure to accomplish this is to 1)install RT on Machine B, just so that I get the Targets and Devices option, and 2)enable a Guest account on Machine B, so that I can log in with the only name that LabVIEW seems to feel should be used.

   Any ideas?  It really shouldn't be this hard.  It shouldn't be necessary to install RT just to use shared variables between two networked computers from within the LV development environment.  Another alternative might be to use data sockets and get a connection to a shared variable by IP address.  I would prefer to do it through the project, though.


Regards,

    Dave

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 4 of 14
(6,337 Views)

Hi Dave,

 

I have understood what you want to do but have not figured out the motivation behind it. Is there a reason why you want to develop the application on Machine B and then run it? Why not just create the VI on Machine A, make it into an executable and run that executable on Machine B?

 

Anyways, since I have understood what you want to do, I would say the alias library is the recommended method, which means create a NEW VI, a NEW library and NEW variables and alias those variables to the variables on Machine A. This will deploy the NEW library on machine B, and that's the implementation with which I work (I mostly use it for debugging). To help you with what you are doing, creating a Networked Computer/Device is not the right way since that is only for a remote FPGA system. What you might want to try is the Real-Time Desktop as explained in the link below; it does require the Real Time module to be installed:

Alternative Method for Using Shared Variables Between Systems in LabVIEW 8.x

 

Try it and let me know if it works. I have not done this before, so I am eager to know the result 🙂 If you have any other questions, please be sure to let me know.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 5 of 14
(6,314 Views)

Adnan,

   Thanks again for the quick reply.  I appreciate your efforts.  Unfortunately, this still doesn't get me where I'm trying to go.

   You mention using a compiled program and using RT.  I've seen plenty of online documentation and suggestions for those situations, but neither addresses what I want to do.    In terms of my use case, you suggest making a new project on Machine B, containing the Machine B VI, a new library, and new variables.  I tried all that.  Then you say to alias those variables to Machine A.  That's the point where I'm stuck.  Doing the above, the only "Target" in the new project is Machine B.  The new library is under Machine B in the project hierarchy.  Thus by definition the variables will be hosted on Machine B.  To follow the logic in the link you sent earlier, the way to get the VI on Machine B to use variables on Machine A would be to have the project on Machine B include another networked computer, and for the library to be under that computer in the hierarchy.  That is what I tried to set up, but could not do for reasons mentioned in the previous message.  

   You say to alias the variables to Machine A.  On Machine B, the only alias file I could find is the project alias file, and the onlly IP address there is the IP of Machine B.  Is there some other way to alias the variable besides editing that file or adding Machine A to the project?  What exactly are the steps you use to alias the variables to the other machine?  Have you done this before for two computers running LV (e.g. not RT and not compiled programs)?

  As for my use case:  What I want to do seems (to me) like it would be one of the most trivial use cases, yet I can find no discussion of it.  I am running LabVIEW from within the development system, on two networked XP computers.  I want to run it within LabVIEW, not LV RT, and not compiled programs.  But I want the two VIs on the two computers to communicate by shared variables.  Running within LabVIEW has some obvious advantages.  Specifically in on-going development of the code and debugging.  Prior to trying this, I also assumed it would also provide benefits in regards to simplicity of deploying shared variables...

 

Cheers,

   DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 6 of 14
(6,300 Views)
I believe I know exactly what's going on. A few of my colleagues went through this sometime back. Assuming you are using LabVIEW 2009, when you create a new variable in your project on Machine B, you need to select Bind to: PSP URL and then click on Browse. At that point, all computers on the same network, that are running the shared variable engine process should come up which should inculde Machine A. In LabVIEW 8.6, you have to select Networked Items in the drop down menu and that should expose Machine A. Let me know if that helps.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 7 of 14
(6,291 Views)

Adnan,

    We may be getting closer here.

    If I understand your suggestion, on Machine B, I create a new project.  Add the VI.  Create a new library and new variables.  Convince the VI to use those variables.  Then use the Binding to convince the variables to talk to Machine A.

    I found hints of this before, but wasn't able to navigate from the Binding properties to Machine A.  Unfortunately, perhaps, I am using LV 8.5.  As you mentioned, this changed a bit between 8.6 and 2009.  Is it even possible with 8.5?  I'll try again, but I can't get to it until this evening.

Dave

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 8 of 14
(6,279 Views)

  Oh... it gets worse...

  I may need to go to Data Sockets.  I haven't tried that yet, but I think that even in 8.5 (???) I can connect to a shared variable via data sockets. That should mean that the Shared Variable doesn't have to reside in the project file.  I hope???
  The issue is that to start a VI inside LV that uses a SV, one needs to first open the project, then open the VI.  If the VI is opened outside of the project, it is broken since it doesn't know about the SVs.  But in the long run, I need the VI on Machine B to launch automatically at boot up.  I think LV would open a project if I put a shortcut to the project in the Start menu, but I don't know how to then make it automatically open and run a VI as well.  I could probably use VI Server to open the project, then open the VI, then run the VI.  Again, this seems unnecessarily complicated.

   Does anyone know a way to get a VI to open within LV automatically at boot, even when it uses SV's?

Thanks,

   DaveT
-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 9 of 14
(6,264 Views)

To get a VI that uses shared varibales to run on boot, you just need to make sure that the variables are deployed at start up. You can create a helper VI that deploys your library then starts your VI. If you set the "Run When Opened" option in VI properties (File»VI Properties»Execution), then put the helper VI in the Start Up folder in windows, and I will open and run automaticly when you log in to your computer.

 

0 Kudos
Message 10 of 14
(6,250 Views)