opcua - 设置采样率后未获取队列中的所有值

opcua - not getting all values in the queue after setting sample rate

这是我在 python 中的代码:

client = Client('opc.tcp://DESKTOP-D1B43P9.mshome.net:53530/OPCUA/SimulationServer')
client.connect()
counter = client.get_node("ns=3;i=1001")
handler = SubHandler()
sub = client.create_subscription(10000, handler)
handle = sub.subscribe_data_change(counter, queuesize=2)
sub.modify_monitored_item(handle, 500)

如果我不更改采样率(删除最后一行),我每 10 秒会得到两个值(datachange_notification 连续调用两次)。 但是如果我确实改变了采样率,它只会被调用一次。

looks like 当你调用 modify_monitored_item 并且没有指定 new_queuesize 它默认为 0,这告诉服务器将它设置为“默认”队列大小,这根据规范为 1。