Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the significance of "ns=2;s=" in an OPC node path?

Tags:

opc

opc-ua

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.


Research:

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.

like image 397
Kyle Williamson Avatar asked Aug 19 '19 19:08

Kyle Williamson


People also ask

What are nodes in OPC UA?

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.

Why do we assume NS=1 for Kepware's nodes?

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.

What does the s in the prefix ns=2 and s= Foo mean?

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?

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.


2 Answers

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:

  1. Numeric (value is a UInteger)
  2. String (value is a String)
  3. Guid (value is a Guid/UUID)
  4. Opaque (value is ByteString)

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.

like image 50
Kevin Herron Avatar answered Oct 16 '22 00:10

Kevin Herron


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

like image 39
Camille G. Avatar answered Oct 15 '22 23:10

Camille G.