ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing a shared network variable between two PC's connected to a network

Sharing a shared network variable between two PC's connected to a network Surely this shouldn’t be so difficult! I have a little LabVIEW program running in the background of PC1. The exe’s task is to collect and send OPC variables held on a SCADA system and convert them to shared network variables (as I thought that they would be easy to share over a network, easier than the nasty OPC and DCOM issues). I have PC2 which runs measurement studio and I have created a nice test VB program which either writes or reads the network variables which are on PC1. The PC1 collection software is working perfectly and when I change the values on the SCADA system I can see the network variable change on ‘NI Distributed System Manager’. I When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the list and when I use the basic measurement studio code below to read the network variable it times out at the TestVariable.connect() line. Ok so what do I need to do to read a shared network variable sat on PC1 from PC2 on the network Public Class Form1 Private WithEvents TestVariable As NetworkVariableSubscriber(Of Double) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load TestVariable = New NetworkVariableSubscriber(Of Double)("\\192.168.58.139\Test\TestVariable") TestVariable.Connect() End Sub Private Sub TestVariable_Data_Updated(ByVal sender As System.Object, ByVal e As NationalInstruments.NetworkVariable.DataUpdatedEventArgs(Of Double)) Handles TestVariable.DataUpdated TextBox1.Text = e.Data.GetValue End Sub End Class
0 Kudos
Message 1 of 5
(5,603 Views)

Sorry lost all the formatting

 

Surely this shouldn’t be so difficult! I have a little LabVIEW program running in the background of PC1. The exe’s task is to collect and send OPC variables held on a SCADA system and convert them to shared network variables (as I thought that they would be easy to share over a network, easier than the nasty OPC and DCOM issues). I have PC2 which runs measurement studio and I have created a nice test VB program which either writes or reads the network variables which are on PC1. The PC1 collection software is working perfectly and when I change the values on the SCADA system I can see the network variable change on ‘NI Distributed System Manager’. I When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the list and when I use the basic measurement studio code below to read the network variable it times out at the TestVariable.connect() line.

 

Ok so what do I need to do to read a shared network variable sat on PC1 from PC2 on the network

 

Public Class Form1

    Private WithEvents TestVariable As NetworkVariableSubscriber(Of Double)

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TestVariable = New NetworkVariableSubscriber(Of Double)("\\192.168.58.139\Test\TestVariable")

        TestVariable.Connect()

End Sub

 

Private Sub TestVariable_Data_Updated(ByVal sender As System.Object, ByVal e As NationalInstruments.NetworkVariable.DataUpdatedEventArgs(Of Double)) Handles TestVariable.DataUpdated

TextBox1.Text = e.Data.GetValue

End Sub

End Class 

0 Kudos
Message 2 of 5
(5,596 Views)

You should probably post this on the Measurement Studio forum since it sounds like the problem is in the Meas. Studio/Shared Variable communication rather than LabVIEW/Shared Variable.

0 Kudos
Message 3 of 5
(5,574 Views)

Could do although its not about Measurement Studio either, if I built an LabVIEW exe to look for a shared variable which was on another PC I am pretty sure I wouldn't see it either. The problem I am having is the ability to pass a shared variable between two PC's. When talking about shared variable's, NI always talk's about putting it on a RT device I wonder if it not only to do with performance but with the ability to connect a PC to those shared variables is easier between a PC and RT device than it is between two PC's?

 

 

0 Kudos
Message 4 of 5
(5,559 Views)

Actually just found this

Using the LabVIEW Shared Variable

 

and even more relevant

How Do I Set Up Shared Variables to Communicate Between Two PCs?


Neither PC has development version of LabVIEW. Does anyone know what the PSP URL format is if I had a library in a project called Test and in that it had a Shared Variable called TestVariable would the PSP URL be \\192.168.1.1\Test\TestVariable??

0 Kudos
Message 5 of 5
(5,551 Views)