I have noticed that all OPC tag Ids are prefixed with ns=2;s=
.
Some examples of possible NodeId values would be:
ns=2;s=AcquisitionTimeRemaining
ns=2;s=Status
ns=2;s=Time
I am wondering what the significance of this prefix is.
Someone else asked this question on a forum. The answer given was that ns prefix specifies the namespace index a NodeId belongs to. The answer-er goes on to state:
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.
I am not using "Kepware's Nodes" and my namespace is still set to 2... Will this always be 2? I could not find any information on what the s in the prefix represents.
Some Nodes are Variables, DataType, References, Object, Methods... depending of what they are used for. By reading the OPC UA Specification you will get a good overview here - Specially Part 1: Overview and Concepts and Part 3: Address Space Model (you need to create a free account first) NodeOPCUA, which is a Node.js implementation of OPC UA.
The answer-er goes on to state: 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. I am not using "Kepware's Nodes" and my namespace is still set to 2... Will this always be 2? I could not find any information on what the s in the prefix represents.
I could not find any information on what the s in the prefix represents. ns=2 is indicating namespace index 2. s=foo is indicating it's a String type NodeId with value "foo". This syntax is borrowed from the syntax used to encode a NodeId in the OPC UA XML encoding:
What exactly are namespaces and why it is always appended with NodeID? YOu can consider namespace as a distinguisher Nodes from Different Sources, As a server can have nodes from multiple sources so namespaces are one which exposes which node belongs, under which tree. A namespace in OPC UA is like a container for node ids.
ns=2
is indicating namespace index 2.
s=foo
is indicating it's a String type NodeId with value "foo".
There are 4 types of NodeId
:
This syntax is borrowed from the syntax used to encode a NodeId in the OPC UA XML encoding:
ns=<namespaceindex>;<type>=<value>
What namespace nodes appear in and how many namespaces there are depends on the server you are connected to.
The namespace values are only depending of your OPC UA Server and its configuration. What is mandatory is that 0 is reserved for OPC UA default namespace.
You can read/subscribe to the OPC UA Node which value describe your OPC UA Server Namespace configuration at "ns=0;i=2255" (Server_NamespaceArray). The Node value is an array of all the Namespace available at this Server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With