【发布时间】:2026-01-27 23:55:01
【问题描述】:
这是我在 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 连续调用两次)。 但如果我确实改变了采样率,它只会被调用一次。
【问题讨论】: