【问题标题】:Write integer to OPC UA server - “not of the same type” error将整数写入 OPC UA 服务器 - “类型不同”错误
【发布时间】:2021-04-01 03:08:49
【问题描述】:

我已经定义了一个 OPC UA 客户端

 var client = new OpcClient("opc.tcp://localhost:4840");
 client.Connect();

这可以正常工作并连接到我也编写的服务器。 客户端也可以阅读

var status = client.WriteNode("ns=2;s=Temperature", 999);

当我想向服务器写入一个值时,问题就出来了:

var status = client.WriteNode("ns=2;s=Temperature", 999);

我得到了错误:

“为属性提供的值与属性值的类型不同。”

那个链接 Write Boolean to OPC UA server - "not of the same type" error 没有帮助。

我使用了 Opc.UaFx 实现。

提前致谢

帕特里克

【问题讨论】:

  • 您的“读取”代码示例包含另一个写入示例

标签: c# node.js wpf opc-ua write


【解决方案1】:

只需添加关键字double:

var status = client.WriteNode("ns=2;s=Temperature", (double)999);

【讨论】:

    猜你喜欢
    • 2016-11-26
    • 1970-01-01
    • 2017-03-06
    • 1970-01-01
    • 2021-07-26
    • 2017-03-08
    • 2017-06-14
    • 1970-01-01
    • 2020-03-08
    相关资源
    最近更新 更多