Free opc ua server with model import feature

限于喜欢 提交于 2019-12-08 12:39:41

问题


I want to implement OPC UA communication for my application (c#)

I found some OPC UA server simulations (Prosys and Softing OPC UA) I can connect and read data without problem. What I want is to implement euromap 77 standards. http://www.euromap.org/euromap77

As far as I understand I must use model structure when accessing data via OPC. I want to load this model to OPC UA server and work on that data structure is it possible to import this http://www.euromap.org/files/Opc_Ua.EUROMAP77.RC1_00.NodeSet2.xml model to any free OPC UA server ?


回答1:


The OPC Foundation has sample servers with node managers that import NodeStateCollections, aka predefined nodes.

Take a look at this repo on GitHub

You can use the "UaNodeSetHelpers" class to convert from NodeSet2 files to NodeStateCollections.

// First, read a NodeSet2.xml file from a stream.
var nodeSet = UANodeSet.Read(istrm); 

// Then create an empty NodeStateCollection.
var nodes = new NodeStateCollection();

// Update namespace table
if (nodeSet.NamespaceUris != null && context.NamespaceUris != null)
{
   for (int ii = 0; ii < nodeSet.NamespaceUris.Length; ii++)
   {
       context.NamespaceUris.GetIndexOrAppend(nodeSet.NamespaceUris[ii]);
       namespaceUris.Add(nodeSet.NamespaceUris[ii]);
    }
}

// Update server table
if (nodeSet.ServerUris != null && context.ServerUris != null)
{
    for (int ii = 0; ii < nodeSet.ServerUris.Length; ii++)
    {
        context.ServerUris.GetIndexOrAppend(nodeSet.ServerUris[ii]);
    }
}

// Convert the nodeset to nodeState collection, aka predefinedNodes. 
nodeSet.Import(context, nodes);

```

https://github.com/OPCFoundation/UA-.NETStandard/blob/3c1159ec712db4403d2dc9840b3e9525f56610b3/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs#L113

https://github.com/OPCFoundation/UA-.NETStandard/blob/cd4173aa95abd296578b976be67485c299473a70/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs#L113



来源:https://stackoverflow.com/questions/43944903/free-opc-ua-server-with-model-import-feature

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!