c# - 具有模型导入功能的免费 opc ua 服务器

标签 c# xml opc opc-ua

我想为我的应用程序实现 OPC UA 通信 (c#)

我发现一些 OPC UA 服务器模拟(Prosys 和 Softing OPC UA)我可以毫无问题地连接和读取数据。我想要的是实现 Euromap 77 标准。 http://www.euromap.org/euromap77

据我了解,通过 OPC 访问数据时必须使用模型结构。 我想将此模型加载到 OPC UA 服务器并处理该数据结构是否可以导入此 http://www.euromap.org/files/Opc_Ua.EUROMAP77.RC1_00.NodeSet2.xml任何免费 OPC UA 服务器的模型?

最佳答案

OPC 基金会拥有带有导入 NodeStateCollections(也称为预定义节点)的节点管理器的示例服务器。

看看this repo on GitHub

您可以使用“UaNodeSetHelpers”类将 NodeSet2 文件转换为 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

关于c# - 具有模型导入功能的免费 opc ua 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43944903/

相关文章:

c# - 如何删除空段落元素?

php - 保护服务器上的 xml 文件

java - 使用 Jaxb 生成 xml 的无限 try-catch block ?

C# OPC 客户端获取服务器列表失败

java - 浏览服务器命名空间并访问自定义引用

c# - 让用户不属于任何角色的更好方法?

c# - 为什么 TripleDES.Create().Key 不是该算法的有效大小?

c# - 如何允许 SignalR 使用 EF6 将更新从数据库推送到浏览器

c++ - GDBus 自省(introspection) xml 中的多个完整类型

java - OPC UA 测试堆栈示例