LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading/Writing Shared Variable paralley from two PCs

Hi,

 

I have an application where I am trying to read/write a cRIO 9074 parallely from two different PCs, PC1 and PC2.

 

Of these, one of the PCs, PC1 acts as a publisher of shared variables. The cRIO and PC2 will be subscribers to the shared variables published on PC1.

 

The PC2 has only an exe of a VI running on it. This VI reads/writes to a shared variable.

 

But when I run the exe, I am unable to read the shared variable. I have tried to programmatically deploy the shared variables library in the exe on the PC2.

 

Have I done the correct thing?

 

How do I read write the shared variables in this case?

 

Has any one faced a similar situation?

 

Any help would be appreciated......

 

Thanks in advance....

 

Regards

 

0 Kudos
Message 1 of 10
(4,486 Views)

I would recommend you go through the following article:

Using Shared Variables in Executables

 

Post back if you have any questions after reading through.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 10
(4,475 Views)

Hi,

 

I have gone thru the document mentioned and some more. Based on it I created a code for programmatically deploying the shared variables (pls refer attachement).

 

When I run the exe of this VI in the project hosting the shared variables library (PC#1), the VI runs fine. But when I use the same executable to run on the remote PC, PC#2, it doesnt work!

 

Where have I made mistakes?

 

Regards....

0 Kudos
Message 3 of 10
(4,459 Views)

The library containing the shared variables in use by an application must be deployed on any and every machine that is using them for communication. So, remove the IP address input from your Deploy Library invoke node and just deploy the library on PC2 as well. I think that should resolve the issue.

 

Just to be sure, add all libraries that contain network shared variables to the Always Include (previously Support Files) list.  Also, make sure to set the Destination of the library(s) to be Support Directory in the Source File Settings category. Use the Path input of the Deploy Library invoke node to point to the library(s) containing your shared variables. If the library(s) were included in the executable's Support Directory,  as directed above, the library(s) will copied to the executable's data folder.  Point the Path input to these library(s). 

 

 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 4 of 10
(4,444 Views)

I discovered the following:

 

1: The firewall of the PC was on


2: The path pointing to the Shared variables library was incorrect

 

I solved all these issues, even then my original problem persists!


I am still unable to programmatically deploy the Shared variables library on the remote computer(PC#2)!

 

As of now I am using the evaluation version to create my exe. Could this be a probelm for deploying the shared variables? (Altough I did try to create an exe on a licensed version, problem is still the same)

0 Kudos
Message 5 of 10
(4,425 Views)
Have you tried the example code provided in the links that I have mentioned above? If so, be sure to create a whole new project with minimal code and post it here so we can test what you are doing.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 10
(4,421 Views)

Hi,

 

First of all, sorry for posting so late. I had got caught up in other issues of my project. Since I had some time to experiment, this is what I have done:

 

In my current project, I have created and deployed all the shared variables in the cRIO instead on PC#1. 

 

Then I created an installer for the exe to be used on PC#2.

 

For the exe on PC#2, I created the exe using all the VIs that I run on PC#1.

 

I then ran the exe on PC#2. This worked! I have now been able to read/write to the shared variables parallely from two different PCs!

 

However, I have not programmatically deployed any library to PC#2 or in the VIs in PC#1, yet the read/write works and herein lies my problem!!

Am I correct in my approach here? I dont want the project to malfunction in future coz I missed something again.

 

I need advice on my approach here....

 

Thanks in advance...

 

Regards.

 

 

 

0 Kudos
Message 7 of 10
(4,309 Views)
Well, it seems like your library is already deployed on the network isn't it? There is no need to redeploy it when that's the case. Let me know if I am not understanding the issue.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 8 of 10
(4,298 Views)

Hi,

 

Coming back after a long time!

 

The deployed shared variables are working fine, but now I am facing a new situation.

 

Currently we have establised a network among the PLCs and PCs by assigning static IP addresses to the devices and using a switch in between.

 

Now the end user is thinking of having the system on their plant/corporate network. This means we need to have IP addresses assigned automatically to each of the PCs and the PLC(DHCP?).

 

The cRIO 9074 can have dynamically assigned IP addresses, but if I were to switch from static IP address to dynamic IP address, in my current situation, what will happen to the shared variables already deployed?

 

What precuations do I need to take? Any surprises?

 

I havent tried doing this yet (scared!!). Just wanted to know if any one has done this before.

 

Thanks in advance,

 

Regards.

0 Kudos
Message 9 of 10
(4,252 Views)

Hi,

 

I recently finished the commisioning of the system I started to work upon. Hence the delay to come back to this thread.

 

During the commissioning of the system, I was concentrating on finalizing the system functionality and was using only the PC#1. Now when all the system functions were finalized, we duplicated the changes to PC#2 and started the operation.

 

What we observed when the PC#2 was started, was that if we were to open the same HMI page as in PC#1, the operation of the HMI was very sluggish. When we selected a different page for both PC#1 and PC#2, the HMI operation was good,  all operations seemed to happen in real time!!

 

To give a background of the HMI, we have a subpanel to which the desired HMI page/screen is loaded. This loads a VI related to the HMI page.

 

Here, I am guessing that when I load the same page in both the PCs, the read/write operations to the shared variable(it is the same in both PC, and is deployed in a library on the cRIO) are some how hindered due both PCs trying to access the same network resource from different locations.

 

Is this guess correct? Any work arounds or solutions? Do I need to post any more information?

 

Thanks in advance,

 

Regards

0 Kudos
Message 10 of 10
(4,130 Views)