NodeId 的实时/唯一性(如何管理动态节点的 NodeIds)
Livetime / uniqueness of NodeId (How to manage NodeIds for dynamic nodes)
OPC UA 规范(第 3 部分:地址 Space 模型)说
5.2.2 NodeId
... A Server shall persist the NodeId of a Node, that is, it shall not
generate new NodeIds when rebooting.
但这怎么可能?
NodeId 是 NamespceIndex 和标识符的组合。 NamespceIndex 可以在服务器重新启动时更改。见:
http://documentation.unified-automation.com/uasdkhp/1.0.0/html/_l2_ua_node_ids.html
For this reason, a Client should not persist the namespace index without storing the namespace URI as well, because a namespace URI represented by index “2” during one session could be represented by index “5” during the next session
还可以使用 FolderType,例如"Files" 作为 Items 再次说明这一点,还是服务器应该存储它用于 File-X 的 NodeId,以便在重启后再次正确分配它?
如果不能创建NodeId,"GenericModelChangeEventType"是干嘛的?
Client: 我想使用 BrowsePath-Path(例如 "Objects.Server.ServerStatus.CurrentTime" (* ) )来寻址 NodeId,然后在 clinet 会话访问节点时使用 NodeId是一个好方法。还因为配套规范定义了浏览名称,所以我可能会保存。这是一个好主意吗? ( *需要注意不同命名空间引起的冲突)
服务器: 服务器在需要 generate/create 新 NodeId 时应该如何表现。需要 NodeIds 始终明确或仅针对服务器运行时。我知道一些服务器正在使用带有字符串类型标识符的 NodeId,而这个字符串标识符是由 BrowsePath 制成的,例如"ns=1;s=Server.ServerStatus.CurrentTime"。但是我不喜欢这样...
我认为 Unified Automation SDK 在技术上违反了这方面的规范。无论哪种方式,它建议的建议对于客户端实现都是很好的做法,但正如您所指出的,严格来说不应该是必要的。
Also the use of FolderType with e.g. "Files" as Items speak again this, or should the server store the NodeId it uses for File-X to assign it right again after restart?
我不确定你在这里问什么。
What for is "GenericModelChangeEventType" if no NodeId can be created?
这不是这里所说的。可以创建和删除节点,并且可以更改对象和变量的结构。所有规范都在说,给定节点 "Foo" 和 NodeId "ns=1;s=Foo" 如果服务器重新启动,它应该具有相同的 NodeId。
I thought useing BrowsePath-Path (e.g. "Objects.Server.ServerStatus.CurrentTime" (* ) ) for addressing NodeIds and then using the NodeId while the clinet session to access the nodes is a good approach.
浏览路径用于针对类型进行编程。 Unified Automation SDK 文档建议的方法是在您的客户端中持久保存 NodeId 的安全方法。
How should the Server behave when it needs to generate/create new NodeIds. Need the NodeIds to be unambiguous all the time or just for the Server runtime. I know some Servers are using NodeIds with String-Typed Identifiers and this String-Identifiers are made from the BrowsePath e.g. "ns=1;s=Server.ServerStatus.CurrentTime". But I don't like this...
在您控制的命名空间中以您喜欢的方式创建它们,由您决定。不过,使用基于字符串的 NodeId 可以让您轻松 "derive" 来自某些其他来源的 NodeId,例如来自 PLC 中变量的地址或类似的东西。
OPC UA 规范说“服务器应保留节点的 NodeId,即重启时不应生成新的 NodeId”是什么意思。如下所示:当被视为 命名空间 URI 和标识符的组合时,NodeIds 不得更改。服务器在重启后可能会也可能不会重新分配名称空间索引 - 但结果 namespaceURI/Identifier 不得更改。因此,如果在第一个 运行 上我有一个标识符为 1234 且命名空间索引为 7 的节点,并且该命名空间索引对应于“http://mynamespace.mycompany.com" in the namespace table, on the second run the same node may have Identifier 1234, but the namespace index 8, as long as in the new NamespaceTable index 8 now corresponds to "http://mynamespace.mycompany.com”。
OPC UA 规范(第 3 部分:地址 Space 模型)说
5.2.2 NodeId
... A Server shall persist the NodeId of a Node, that is, it shall not generate new NodeIds when rebooting.
但这怎么可能?
NodeId 是 NamespceIndex 和标识符的组合。 NamespceIndex 可以在服务器重新启动时更改。见:
http://documentation.unified-automation.com/uasdkhp/1.0.0/html/_l2_ua_node_ids.html
For this reason, a Client should not persist the namespace index without storing the namespace URI as well, because a namespace URI represented by index “2” during one session could be represented by index “5” during the next session
还可以使用 FolderType,例如"Files" 作为 Items 再次说明这一点,还是服务器应该存储它用于 File-X 的 NodeId,以便在重启后再次正确分配它?
如果不能创建NodeId,"GenericModelChangeEventType"是干嘛的?
Client: 我想使用 BrowsePath-Path(例如 "Objects.Server.ServerStatus.CurrentTime" (* ) )来寻址 NodeId,然后在 clinet 会话访问节点时使用 NodeId是一个好方法。还因为配套规范定义了浏览名称,所以我可能会保存。这是一个好主意吗? ( *需要注意不同命名空间引起的冲突)
服务器: 服务器在需要 generate/create 新 NodeId 时应该如何表现。需要 NodeIds 始终明确或仅针对服务器运行时。我知道一些服务器正在使用带有字符串类型标识符的 NodeId,而这个字符串标识符是由 BrowsePath 制成的,例如"ns=1;s=Server.ServerStatus.CurrentTime"。但是我不喜欢这样...
我认为 Unified Automation SDK 在技术上违反了这方面的规范。无论哪种方式,它建议的建议对于客户端实现都是很好的做法,但正如您所指出的,严格来说不应该是必要的。
Also the use of FolderType with e.g. "Files" as Items speak again this, or should the server store the NodeId it uses for File-X to assign it right again after restart?
我不确定你在这里问什么。
What for is "GenericModelChangeEventType" if no NodeId can be created?
这不是这里所说的。可以创建和删除节点,并且可以更改对象和变量的结构。所有规范都在说,给定节点 "Foo" 和 NodeId "ns=1;s=Foo" 如果服务器重新启动,它应该具有相同的 NodeId。
I thought useing BrowsePath-Path (e.g. "Objects.Server.ServerStatus.CurrentTime" (* ) ) for addressing NodeIds and then using the NodeId while the clinet session to access the nodes is a good approach.
浏览路径用于针对类型进行编程。 Unified Automation SDK 文档建议的方法是在您的客户端中持久保存 NodeId 的安全方法。
How should the Server behave when it needs to generate/create new NodeIds. Need the NodeIds to be unambiguous all the time or just for the Server runtime. I know some Servers are using NodeIds with String-Typed Identifiers and this String-Identifiers are made from the BrowsePath e.g. "ns=1;s=Server.ServerStatus.CurrentTime". But I don't like this...
在您控制的命名空间中以您喜欢的方式创建它们,由您决定。不过,使用基于字符串的 NodeId 可以让您轻松 "derive" 来自某些其他来源的 NodeId,例如来自 PLC 中变量的地址或类似的东西。
OPC UA 规范说“服务器应保留节点的 NodeId,即重启时不应生成新的 NodeId”是什么意思。如下所示:当被视为 命名空间 URI 和标识符的组合时,NodeIds 不得更改。服务器在重启后可能会也可能不会重新分配名称空间索引 - 但结果 namespaceURI/Identifier 不得更改。因此,如果在第一个 运行 上我有一个标识符为 1234 且命名空间索引为 7 的节点,并且该命名空间索引对应于“http://mynamespace.mycompany.com" in the namespace table, on the second run the same node may have Identifier 1234, but the namespace index 8, as long as in the new NamespaceTable index 8 now corresponds to "http://mynamespace.mycompany.com”。