01-13-2016 06:53 PM
How can you read a list of OPC tag names from an OPC server using .net (measurement studio)?
I've built an application to connect to various tags via the DataSocket object in NationalInstruments.Net.
I've seen a related post but the solution is in labview and I cannot view the VI's as I dont have labview.
01-14-2016 05:02 PM
Hi blamarche,
If you haven't already, I would recommend checking out this manual on the use of the DataSocket library in Measurement Studio. It contains quite a bit of information that may be helpful for your application.
01-14-2016 05:18 PM
Thanks Tom. This is kind of what I was going after but not fully.
The DataSocket.SelectUrl method brings up an interactive browser window that allows a user to select a tag from the tag list. I want a method that returns an IEnumerable<string> or such of tag names, and not defer to an external dialog window. So this gets me about 30% of where I want to be. I did find another library (albeit COM based) a way to extract the names of the tags on a server, so I think I'll use that instead.
But brings up another question: why does Labview (or supplied VI's) provide VI's that can return a list of OPC servers installed on a machine, and their subsequent tags, while measurement studio does not?
01-15-2016 05:39 PM
Hi blamarche,
After reviewing the DataSocket API, I don't believe there is a simple way to grab the names of all the OPC tags with it. It is unfortunate that the API contains a function to allow the user to grab the data, but not the ability to grab all of it programmatically. Alternatives would be either...
1.) Using the NetworkVariable API instead of the DataSocket API. I have attached some more documentation which details how to do this--however, using the API for this example requires the use of the LabVIEW Datalogging and Supervisory Control (DSC) Run-Time System, for which you would need to purchase a license.
2.) Using LabVIEW to build the example you linked as DLL. Again, this would require a LabVIEW license.
Using OPC with the Measurement Studio Network Variable Class Library: http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/networkvariableopc/