LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on labview global variables shared by TS sequence and LV Operator Interface

Hello, I have a problem about labview global variables creating executable of my Vi:

 

I have a main VI that has several choices, on of that is another vi that acts as Operator Interface (OI) calling TS sequence. The OI has a lot of controls and indicators, some of that are managed directly by the event structure of the OI, others are managed inside TS seq. through User MSG Callback, others are managed through labview global variable used like data exchange, TS calls a Vi that write some LV global variables and than with User msg callback that variable are read and displayed on OI. There are also some OI controls that permits to write some LV globals Variables then read inside TS sequence by calling a Vi.

 

All this chain is working OK when the Vi (Main.vi) is executed directly from LV environment, customer ask me to have the executable so I create a project e and the .exe. Here I have the problem:  LV global Variable don't work between LV and TS, it's seems that each one have their own copy and the data are not shared between the two environments.

Problem is the same both using LV Runtime engine or Development system inside TS.

 

Is there any way?

I know that there are LV shared variable but now I developed with global variables that are more simple to use.

 

Thank you

Massimo Ponte.

0 Kudos
Message 1 of 5
(169 Views)

Instead of using Global Variables, you could just use UI Messages to pass data from TestStand to LabVIEW, or you can also use them to pass data from LabVIEW to TestStand. This solution works whether you are doing development, runtime, or version independence so its a good solution. Your global variables are not being shared because they aren't the same global variable. Your loose VI's in TestStand are referencing one version, and your exe is referencing another. Even if you get TestStand to share the same application space, my guess is it still won't work because the global variables are no longer the same.

 

You could create a layer in between with PPLs where you have all your global variables and vi's in there. The main.vi code uses the PPL, and TestStand uses the same PPL. Then if you set the LabVIEW Adapter in TestStand to runtime, and version independent, and also set the exe to "Allow future versions..", when they run they will use the same copy of the PPL in memory and share the same global variable in that PPL. 

0 Kudos
Message 2 of 5
(149 Views)

Thank you for the answer, I used LV global var because of the complexity of the data to exchange, array of cluster and so on.

I never used PPL, I don't have any ideas about that.

 

regards.

0 Kudos
Message 3 of 5
(141 Views)

You could consider switching all the code that uses Globals to using the Shared Variable Engine instead:

 

https://www.ni.com/en/support/documentation/supplemental/06/using-the-labview-shared-variable.html

 

It's not a perfect solution as you need to re-code things and it's slower than a native Global variable is, so if you call it in a loop thousands of times you may notice a performance hit.  I don't use it myself to know how much of one it is.

 

Edit:  Just now I see in your post that you mentioned you already knew this existed.

Still, I think it's likely the easiest way to proceed.  Each instance of LabVIEW, each LabVIEW-based EXE, and each PPL all get their own "space" for global variables that doesn't cross over unless you force it to happen, I don't think there's a simpler way.  It's either this or convert to using something else manually, I don't think you will find a magic "make globals work" button to press.

0 Kudos
Message 4 of 5
(99 Views)

Hello, I definitively switched to Shared Variable, I said someone tell that they are more efficient, not in term of refresh speed, I had to insert a little wait between setting and usage.

0 Kudos
Message 5 of 5
(42 Views)