You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
Sometimes (in practice) situations occur when some OPC UA servers contain variable nodes of abstract types. For example, these nodes have a HasTypeDefinition reference type for nodeId i=2372. <Reference ReferenceType="HasTypeDefinition">i=2372</Reference>
But in the open62541 library you can add nodes of this type only if you apply some rules:
We can use it and import that nodeset with this xml.
For example:
If I try to add it using Python's nodeset_compiler - everything is fine.
But if I try to add xml using nodesetloader - I can’t do this, because processing of additional references occurs after adding all the nodes, but without these references - the library will not be able to add such nodes and will throw an error.
But I found a quick solution using the "second chance algorithm".
We can add a cycle of adding additional references before the "second chance algorithm", if unadded nodes are found, after cycle then this algorithm will add problematic nodes, and after that the cycle of adding additional references "addNonHierachicalRefs" will run again and it will add references to those already nodes that were added after the "second chance algorithm" was worked out.
In code it looks like this:
I tried this and it works. Perhaps there is another way...
What do you think of this solution?
The text was updated successfully, but these errors were encountered:
Hi!
Sometimes (in practice) situations occur when some OPC UA servers contain variable nodes of abstract types. For example, these nodes have a HasTypeDefinition reference type for nodeId i=2372.
<Reference ReferenceType="HasTypeDefinition">i=2372</Reference>
But in the open62541 library you can add nodes of this type only if you apply some rules:
We can use it and import that nodeset with this xml.
For example:
All we need is to add two references to the parent node (ns=2;s=Some.Node):
And we can add it to the node space.
If I try to add it using Python's nodeset_compiler - everything is fine.
But if I try to add xml using nodesetloader - I can’t do this, because processing of additional references occurs after adding all the nodes, but without these references - the library will not be able to add such nodes and will throw an error.
But I found a quick solution using the "second chance algorithm".
We can add a cycle of adding additional references before the "second chance algorithm", if unadded nodes are found, after cycle then this algorithm will add problematic nodes, and after that the cycle of adding additional references "addNonHierachicalRefs" will run again and it will add references to those already nodes that were added after the "second chance algorithm" was worked out.
In code it looks like this:
I tried this and it works. Perhaps there is another way...
What do you think of this solution?
The text was updated successfully, but these errors were encountered: