06/02/2020
Hello,
I would like to get some clarifications about the expected behavior of the BrowseName when creating an instance of an object.
Suppose I have multiple namespaces:
- 0: OPC foundation
- 1: My server namespace
- 2: Another namespace with type definitions
Instances are created into the namespace with index 1.
Suppose I create an object from a type definition from namespace with index 2.
The created object will have a node ID where the namespace index will be 1. What should be the namespace index in the BrowseName of that object instance:
- Should it be also the index of the namespace where the instance is created (1 in the example)?
- Should it be the index of the namespace where the type is defined (2 in the example)?
- It does not matter?
Thanks
05/30/2017
If you create a standalone instance of an object or variable the you give it a new BrowseName with an index in any namespace that is appropriate (i.e. if you create an instance of PropertyType to represent the well-known Property "NodeVersion" on a Node then the namespace index is 0).
You should use the NodeId namespace the the BrowseName is not defined in another model.
If you create an instance while instantiating the tree under a new object or variable the BrowseName namespace is exactly the same as the InstanceDeclaration in the ObjectType or VariableType.
06/02/2020
Hi Randy,
Regarding your last statement about instantiating the tree under a new object, I would like to take an example to illustrate.
Suppose I defined an object type MyObjectType in the namespace with index 2. This object type has:
- a child variable MyVariable
- and a child object MyOtherObject with object type MyOtherObjectType defined into the namespace index say 3.
In addition, the object type MyOtherObjectType has a child variable MyOtherVariable.
Now I create an object instance MyObject into the namespace with index 1 from the object type MyObjectType. The resulting BrowseName in the instance object tree would be:
- MyObject has BrowseName "1:MyObject" (node ID being "ns=1;something)
- MyVariable has BrowseName "2:MyVariable" (node ID being "ns=1;something else) since the corresponding InstanceDeclaration is in namespace 2
- MyOtherObject has BrowseName "2:MyOtherObject" (node ID being "ns=1;something else) since the corresponding InstanceDeclaration is in namespace 2
- MyOtherVariable has BrowseName "3:MyOtherVariable" (node ID being "ns=1;something else) since the corresponding InstanceDeclaration is in namespace 3
Is this what you meant with your last statement?
Thanks
04/27/2021
This means the index of the BrowseName should always correspond to the NamespaceIndex of the node at the end of the hasTypeDefinition-reference, right?
Does the same hold true for the text-section of the QualifiedName? If yes, that would mean that the only way to differentiate between Instance and Type from a BrowsePath would be to check whether a node is in the "Objects" or "Types" folder.
05/30/2017
The UA type model depends on being able to construct paths from the BrowseNames of nodes in the tree under the types.
So it is a requirement that the BrowseName (index and text) be identical.
The only way to identify an InstanceDeclaration is to look for the HasModellingRule reference.
Instances should not have them but I do not believe that is specifically required in the specification.
You can also follow inverse hierarchical references. If a path leads to a type and each Node in the path has a ModellingRule then it is an InstanceDeclaration.
Note that it is allowed for an instance to reference the types InstanceDeclaration instead of creating a copy.
This allows instances to have "static" properties that are shared among all instances of the type.
1 Guest(s)