小编Vid*_*uri的帖子

OPC UA-.net 标准 C# 简单控制台客户端

我正在尝试 OPC UA 基金会 GitHub 页面OPC-UA.net Standard中的 SampleApplication NetCoreConsoleClient ,在此过程中我遇到了几个问题。

我想使用这个库来简单地读取服务器发送的数据(我正在使用 Prosys OPC UA 服务器)并将其写在控制台中。我一直在努力获取与服务器发送的实际数据变量。我设法连接到它并订阅,但无法使用该方法写出所需的 MonitoredItem 值onNotification

Console.WriteLine("6 - Add a list of items (server current time and status) to the subscription.");
exitCode = ExitCode.ErrorMonitoredItem;
var list = new List<MonitoredItem> 
{
    new MonitoredItem(subscription.DefaultItem)
    {
        DisplayName = "ServerStatusCurrentTime", StartNodeId = "i="+Variables.Server_ServerStatus_CurrentTime.ToString()
    }
};
list.ForEach(i => i.Notification += OnNotification);
subscription.AddItems(list);
Run Code Online (Sandbox Code Playgroud)

此处示例将一个新的 MonitoredItem 添加到列表中。当我尝试添加自己的项目时,即使服务器始终发送更改的值,我也从未收到任何响应,因此它应该触发该onNotification方法。

我从这部分获取所需值的 DisplayName 和 StartNodeId:

foreach (var rd in references)
{
    Console.WriteLine(" {0}, {1}, {2}", …
Run Code Online (Sandbox Code Playgroud)

.net c# opc opc-ua

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net ×1

c# ×1

opc ×1

opc-ua ×1