"ns=2;s=" 在 OPC 节点路径中的意义是什么?
What is the significance of "ns=2;s=" in an OPC node path?
我注意到所有 OPC 标记 ID 都带有前缀 ns=2;s=
。
可能的 NodeId 值的一些示例是:
ns=2;s=AcquisitionTimeRemaining
ns=2;s=Status
ns=2;s=Time
我想知道这个前缀的意义是什么。
研究:
论坛上的其他人 asked this question。给出的答案是 ns 前缀指定了一个 NodeId 所属的命名空间索引。回答者继续说:
For weird historical reasons, we assume ns=1 if it’s not explicitly present. Kepware’s Nodes are all in ns=2, so, it must be specified.
我没有使用“Kepware 的节点”并且我的命名空间仍设置为 2... 总是 是 2 吗?我找不到任何关于前缀中 s 代表什么的信息。
ns=2
表示命名空间索引 2。
s=foo
表示它是一个String类型的NodeId,值为"foo".
有4种NodeId
:
- 数值(值为 UInteger)
- 字符串(值为字符串)
- Guid(值为Guid/UUID)
- 不透明(值为 ByteString)
此语法借用了用于在 OPC UA 中对 NodeId 进行编码的语法 XML 编码:
ns=<namespaceindex>;<type>=<value>
出现哪些命名空间节点以及有多少个命名空间取决于您所连接的服务器。
命名空间值仅取决于您的 OPC UA 服务器及其配置。 强制性的是为 OPC UA 默认命名空间保留 0。
您可以 read/subscribe 在 "ns=0;i=2255" (Server_NamespaceArray) 处配置您的 OPC UA 服务器命名空间。节点值是此服务器上所有可用命名空间的数组