LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variables not updating in exe

Hi,

 

I've created a project with 2 vi's, they share data via Networked Shared Variables, one vi writes while the other reads.

The data is passed between the 2 vi's whilst running in the Labview 2009 SP1 development environment, but when I create an exe, the screen values in the reader vi do not update at all.

 

In the build specification I've tried both including the vi's which reference the shared variables and the

option to list the shared variable libaries for deployment at run time, as methods to overcome the problem.

 

Please, any clues why the exe should fail to allow shared variables to pass data ?

 

 

 

 thanks,

 

 

Gary. 

0 Kudos
Message 1 of 12
(2,639 Views)

Edit: I missed the "Network" part of your question

=====================
LabVIEW 2012


0 Kudos
Message 2 of 12
(2,637 Views)

@Gary H. wrote:

Hi,

 

I've created a project with 2 vi's, they share data via Networked Shared Variables, one vi writes while the other reads.

The data is passed between the 2 vi's whilst running in the Labview 2009 SP1 development environment, but when I create an exe, the screen values in the reader vi do not update at all.

 

In the build specification I've tried both including the vi's which reference the shared variables and the

option to list the shared variable libaries for deployment at run time, as methods to overcome the problem.

 

Please, any clues why the exe should fail to allow shared variables to pass data ?

 

 

 

 thanks,

 

 

Gary. 


Hi Gary,

 

Are you building two different .EXEs that are referencing these Network Shared Variables? You have to ensure that only one PC deploys and hosts the Shared Variable Library and the other just references the variables through the palette if you're having trouble communicating the data across a network; this will prevent any mismatched references from occuring.

 

You're saying that the Reader VI is not reading any newly updated values, but are you confirming that the Writer VI is updating it? You can check a variables current value by going to Start > All Programs > National Instruments > Distributed System Manager and finding the variable underneath your host IP directory. Does the value change when you make use of the Writer VI?

 

Regards,


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 3 of 12
(2,611 Views)

Hi Alex,

 

I've created just 1 exe. This contains 2 pairs of vi's, i.e. 4 vi's.

One pair, a writer.vi and reader.vi comunicate via one variable library file, and the other pair of vi's

which are also a writer.vi and reader.vi communicate via another variable library.

 

Both variable libary files are in the single project which defines the vi's and the exe build specification.

 

To start the vi execution, I use a fifth top level.vi, which calls the other 4 vi's. Only the 2 reader vi's are displayed.

The 2 writer.vi's read hardware status and update the network shared variables.

 

In the Labview 2009 SP1 development, running the top level.vi gives the expected result, i.e. the reader.vi's

are displayed and constantly updated.

 

However, having created an exe via the project, when the exe is run the 2 reader vi's are displayed but not updated.

Because the structure works in the development environment, I believe the problem lies with the Build Specification for the exe. 

 

In my previous post I mention 2 ways of trying to deploy the share variables but neither seems to work. 

 

The network is not currently involved at the moment, i.e. single project as defined above, on a single PC.

 

 

regards,

 

Gary. 

 

 

0 Kudos
Message 4 of 12
(2,601 Views)

Be sure that there's the *.aliases file beside your *.exe. The *.exe uses this file to know where the SVE is resided in the network (here localhost). The exe and aliases file are named equal except the extension.

 

Hope it helps

Christian

0 Kudos
Message 5 of 12
(2,592 Views)

Hey Gary,

 

I've just created a project to replicate the issue you are having and indeed when I built the application, the Shared Variables were no longer working. This is because I hadn't deployed the Shared Variables in code; which I think may be the problem that you're having at the moment. When create a Network Published Shared Variable library in LabVIEW, it auto-deploys itself for the development environment; but this is definitely not the case for when you build an executable. Instead, you must deploy the library yourself in code.

 

In the attached zip folder, please follow the following instructions and hopefully you'll be able to fix your VI:

  • Unzip the folder and extract the files.
  • Open up the project.
  • Look at the project layout. Notice the SharedVariableLibrary.lvlib and inspect the Shared_Double variable.
  • Look at how the Reader.vi and the Writer.vi interact with the variable.
  • Go into the Main.vi. See that I make an Open Application Reference VI and Invoke Node to manually deploy the library in code. You'll have to change the path to this library to match the directory structure of your own computer, so just make sure it navigates to the library in the extracted folder.
  • Check out the Build Specifications. I've done nothing here except ensure I only include the Main VI. Finally build the VI and run the executable. 

You should see that this will give you a working Shared Variable setup. The Machine Name input for the Open Application Reference is blank because you only want to communicate with the localhost i.e. Your computer. Therefore by explicitly deploying all libraries you require, your VIs should be able to communicate effectively.

 

Does this solve your problem?

 

DeployLibrary.png


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Message 6 of 12
(2,585 Views)

Christian,

 

Thank you for the reply.

The 'alias' file is along side the exe and reads:

 

[My Computer]
My Computer = "localhost"

 

Gary.

0 Kudos
Message 7 of 12
(2,573 Views)

It should be no problem with the deployment. Once the process is deployed to the local SVE is stays permanent even after a reboot.

 

I have no other idea than there's maybe a problem with the execution of your described 4 VI's. In the IDE you start them probably one by one and in runtime you have to start them via the VI server. Try to use different execution systems for reader and writer VI's.

 

Hope it helps

Christian

0 Kudos
Message 8 of 12
(2,566 Views)

Alex,

 

Thank you for your detailed reply.

 

I extracted the error messages and the result was along the lines of your earlier suggestion: the writer.vi was

not running.

 

To summarise, the error messages state that the vi's I'm trying to open/run are broken, suggesting missing files.

I now realise why: the broken files rely on dependencies to run, in the build specification these are included if referenced .

In my top level.vi I use Invoke Node - Run Vi  to set the writer.vi's executing, along with others.

Hence there are no writer.vi nodes in the block diagram of the top level.vi, only file paths, so no reference,

no dependencies and so not included as part of the build.

 

I'm now in the process of trying to configure the exe build specification so that the files referenced by the vi's above are included in the build. 

 

 

regards,

 

Gary.

 

 

Message 9 of 12
(2,564 Views)

Hi Gary

 

Check attached project file for communication between two exe using shared variables.

 

Check it and give me feedback.

 

Prashant

CLAD

KUDOS ARE WELCOMED

PBP
Labview 6.1 - 2015
Message 10 of 12
(2,544 Views)