LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lv 8 Shared Variables

I've been using the LV8 evaluation version for a little while, and am slightly intrigued by the idea of shared variables. They may be a way for me to eliminate some problems I've been having communicating over an OPC over ethernet network with datasocket in LV 6.1.
 
My question is if I can use this to decouple the OPC communication from my actual LabVIEW application. In other words, my application would only see a shared variable, while the shared variable engine writes information out to the OPC tags on the server from the shared variables and reads in information from other OPC tags into shared variables that would be within my program. It looks like it is possible to do this if I am reading the help about 'binding' correctly, but I've also noticed that the shared variable example uses (PSP?) to communicate over the network.
0 Kudos
Message 1 of 8
(6,127 Views)

Your understanding of shared variables seems correct. For a network scoped shared variable, PSP (Publish and Subscribe Protocol) is used. This protocol is the new NI network protocol replacing the functionality of DataSocket, although it works in a similar way. You can think of the Shared Variable Engine as a behind-the-scenes, 3rd party entity that manages shared variables. Clients can then publish new values to these shared variables or subscribe to these variables to read values from them. A client can also be both a publisher and subscriber. It easiest just to think of it as writing and reading values to/from memory.

Kind Regards,

E. Sulzer
Applications Engineer
National Instruments
Message 2 of 8
(6,088 Views)
That sounds pretty neat; as it also means that I can decouple any network interface I might have into a separate program and share the values with my main program via PSP.
0 Kudos
Message 3 of 8
(6,055 Views)
I attempted making a program to do what I described, but it does not seem to work; so maybe I was not right in the way I described what I wanted to do.
 
What I did is made a new project and created two new variables; I clicked 'Bind to source' on both of them, and put in the path as the path to the OPC variable that I wanted to read or write to. Then I added a small VI to the project that just wrote to one of the variables and read from the other using a boolean control and a boolean indicator.
 
When I ran the project, it showed as having two errors (one from each global) stating that they did not exist. (error code -1967362041)
 
Is it not possible to bind these shared variables to OPC tags? I'm going to include the files I was using (I'm sure that the pathnames are correct for the OPC variables.) just in case they are a help. If I could remove the datasocket VIs from my programs it would be a big plus to argue for migrating to LabVIEW 8 from 6.1, as we have had issues with datasocket's performance with OPC in the past.
0 Kudos
Message 4 of 8
(6,036 Views)
 

OPC is really not my area of expertise, and it seems that that has been exposed here 🙂 I did some more research on this topic, and you actually need the LabVIEW Datalogging and Supervisory Control (DSC) Module 8.0 in order to do direct data binding with OPC data items. LabVIEW DSC lets you expose these data items to shared variables through an I/O Server and allows you to sidestep using DataSocket. My apologies for the initial misguided advice, but I am sure that this bit is the correct information!

 
Kind Regards,

Message Edited by AESulzer on 11-09-2005 02:14 PM

E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 5 of 8
(6,007 Views)

So, if I understood this correctly, the only way to communicate with OPC Servers from pure-LabVIEW 8.0 (i.e., no DSC module), is to use the old DataSocket approach? 

-Khalid

 

0 Kudos
Message 6 of 8
(5,999 Views)
No problem, just got me a little excited is all. 🙂
 
I was hoping to avoid the DSC Module, because for the amount of OPC we do it is cost prohibitive to use it for those projects (especially since we would need to buy a separate copy for every installation of our application); but if that functionality would have been included in the LV8 base package it would have been pretty useful. Although (on a positive side), with the shared variable system it does make it easier if we ever need to pass information over the network between two or more of our own LabVIEW applications.
Message 7 of 8
(5,994 Views)

Khalid,

That is correct -- the only way to communicate with OPC servers from "pure" LabVIEW 8.0 is to use DataSocket. Keep in mind, though, that there is data binding for front panel objects within the DataSocket API, and you can set that up pretty easily from the front panel. In LabVIEW 8.0, you need to right-click the numeric control/indicator, select properties, and select the Data Binding tab to set up the connection. All you have to do is give it your OPC address and the control/indicator is automatically synced up with the OPC data item.

Kind Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 8 of 8
(5,976 Views)