4

I'm trying to build a OPC UA client application.
I'd like to be able to identify a UA node uniquely in the OPC tree.
I know that in OPC DA, a standard node id is a string with a '.' as a delimeter that I can use in order to identify a node.

In OPC UA, the node ID doesn't have to be a string, but I'd still like to be able to build a unique string that maps to a particular node.
I'm thinking about basing it on the the nodes names. e.g.: Demo.MyNode.MyValue.
but I'm afraid that the node name can contain characters such as "." and this will make my IDs not unique.

Is there a character I can use as a delimeter?
Is there a better way to represent the node ID as a string (including its path)?

Idov
  • 5,006
  • 17
  • 69
  • 106
  • 1
    If you are writing an OPC client application, you do not have any choice of creating the syntax for item IDs or node IDs. They are specified by the OPC server you are connecting to, and the best you can do is write your OPC client in such a way that it works well with them. Also, a small correction, OPC DA does not prescribe "." as a delimiter; it is up to the server how it constructs the item IDs, and while "." seems to be quite common, there are many servers that do not use it. – ZbynekZ Jan 15 '16 at 09:36

3 Answers3

6

OPC-UA offers the concept of a unique "BrowsePath" for each and every node, and a client could opt to store BrowsePaths instead of NodeIds, and then upon startup call the TranslateBrowsePathsToNodeIds service.

In fact, I believe this may be the intended behavior, as there's no requirement that a server use the same NodeId for any given Node after restarting, even if in practice that's how it's done.

I was wrong about NodeId being allowed to change. The spec says: "A Server shall persist the NodeId of a Node, that is, it shall not generate new NodeIds when rebooting."

I now believe its best to store NodeIds and only use BrowsePaths to aid in programming against type definitions.

Kevin Herron
  • 6,500
  • 3
  • 26
  • 35
4

One of the features of OPC UA is that the server can offer different menu trees to different users. It may not matter for your client, since any given user will only see the one tree, and the BrowsePath will be unique for that user.

In v1.03 of Part 3 of the OPC UA spec, "OPC UA Part 3 - Address Space Model 1.03 Specification.pdf", section 5.2.2 says a server should not change a node's NodeId when it reboots. (The spec is available from the OPC Foundation at https://opcfoundation.org. You can register and download it for free.)

Of course, some UA servers might not maintain their NodeIDs across a reboot. Which is another reason to use Kevin's suggestion to use the BrowsePath to make a unique string for each node. The string can make it clearer to the user which node they're accessing. Good idea!

J Cumming
  • 41
  • 2
0

The OPC Foundation announced their “OPC UA Open Shared Source” Strategy (04/14/2015).

The stack for .NET including lots of samples for DA, Historie... clients and servers can freely be downloaded here OPCFoundation/UA-.NET on GitHub.

Also Build OPC UA .NET applications using C#, VB.NET

You can take a look at the samples in the "SampleApplications" directory and see how they do things...

A.J.Bauer
  • 2,803
  • 1
  • 26
  • 35