一次订阅多个 OPC-UA 节点

mus*_*afa 1 opc opc-ua node-opcua

我需要订阅 ~1000 个节点,这些节点是在层次结构中创建的,例如:

ns=2;s=0:Manufacturing.E01.Ambient.Temperature

ns=2;s=0:Manufacturing.E01.Ambient.WindDir

ns=2;s=0:Manufacturing.E01.Commands.AckAllErrors

ns=2;s=0:Manufacturing.E03.Ambient.Temperature

ns=2;s=0:Manufacturing.E03.Ambient.WindDir

ns=2;s=0:Manufacturing.E03.Ambient.WindSpeed

我以相同的方式处理每个更新,因此subscription.monitor()为每个更新调用函数并创建一个新的回调函数对我来说似乎不是最佳方式。

是否可以订阅具有模式的多个节点,例如属于以下所有节点:

ns=2;s=0:制造.E01。

Cam*_* G. 5

No it is not - There is no way to subscribe to a "folder" in OPC UA.

The easiest way to proceed in your case will be to first browse the Folders by using the OPC UA Browse Service.

OPC UA 服务器将从所询问的起始节点返回所有引用(OPC UA 父子引用可能是OrganizesHasComponent、 Has Property,...)。

然后您可以使用 OPC UA CreateSubscription / CreateMonitoredItems服务订阅节点。