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# - 使用 lambda 重新排列 List<T>

c# - 利用浏览器缓存不缓存 Javascript 和 CSS 文件

python ElementTree解码错误

ruby-on-rails - Nokogiri 从 Nokogiri::XML::Element 获取 xpath

open-source - 好的开源OPC软件

c# - 在 Code First Entity Framework (C# ASP.NET MVC 3) 中指定除 dbo 之外的 SQL 用户名

c# - 如何在双击文件后立即附加调试器?

javascript - 如何获取XML子节点的长度

OPC UA 历史数据访问 - 事件历史

iphone - 用于 Objective-C 的 OPC DA 客户端库