Multiple, identical node id's

162 views
Skip to first unread message

adl...@gmail.com

unread,
Aug 1, 2016, 2:46:31 PM8/1/16
to open62541
Hi,
I've been trying to improve my understanding of OPC-UA and open62541. And so I tried to create the namespace structure like this:

Modbus
|___PLC1
| |___var1
| |___var2
|
|___PLC2
|___var1
|___var2


but when adding var1 (and var2) under PLC2 by invoking UA_Server_addDataSourceVariableNode() it returns with the error code: UA_STATUSCODE_BADNODEIDEXISTS 0x805e0000 

1) So, just been wondering what should be the most proper solution in such case? Does OPC-UA allow to define the structures like the one above? Is it allowed to have the variables with the same nodeID ( UA_NODEID_STRING( 0, ( char* )"var1" ) ) under multiple objects?

To make it more visible I made a simple OPC-UA server demo and added the code responsible for building such structure in this commit: https://github.com/adliner/OPCServerDemo/commit/4b564079f147cac903c2d2bceedf6932e046a5c2


2) Also, UA_Server_addDataSourceVariableNode() takes const UA_NodeId referenceTypeId as an input parameter - what is it actually? I pass UA_NODEID_NUMERIC( 0, UA_NS0ID_ORGANIZES ) in its place but I'm not really sure what it is.



Thanks,
Adam


Julius Pfrommer

unread,
Aug 1, 2016, 3:07:11 PM8/1/16
to open62541, adl...@gmail.com
Hello Adam,

an OPC UA information model can be seen as a graph of nodes.
Every node can be an object, a variable, a method, and so on.
And the edges between the nodes (references) describe their relationships.
For example containment, type/instance relationships, inheritance, and also custom relations (referencetypes).

1) The identifier of the nodes must be unique. This is why you get an error.
However, the displayed name of the nodes can be set independent from the identifier.
You can have a look at the '/examples/server_variable.c' for an example.

2) Every node needs at least one relation (reference) to a parent. So the graph of nodes is always connected.
For that, you need to supply the identifier of the parent and the identifier of the relation type.

Best regards,
Julius

adl...@gmail.com

unread,
Aug 15, 2016, 12:58:45 PM8/15/16
to open62541, adl...@gmail.com
Thank you Julius. That brings reasonable clarification.

So, basically my answer is that I should create nodes with always-unique idntifiers across all model structure and go along with display names. That could be included somwhere in the docs :)

BTW: Are the identifiers expected to be unique across all (OPC-UA)namespaces? Will do some experiments later on.

Thanks,
Adam
Reply all
Reply to author
Forward
0 new messages