2

I'm trying to call TranslateBrowsePathsToNodeIds method (defined on View Service Set of OPC-UA standard) using OPC-UA client against Simatic ProcessHistorian (Simatic PCS 7 version 8.1).

When I browse the server with Sample Client from UA-.NET I can see two nodes under Objects root:

  • Server
  • Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}

For Server node the method works fine but I can't figure out a way how to get nodes down the tree starting from Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd} (which is actually the data model).

The code looks like this (C#):

var startNodeId = new NodeId(Objects.ObjectsFolder);
var browsePaths = new BrowsePathCollection
{
    new BrowsePath
    {
        RelativePath = RelativePath.Parse(relativePath, session.TypeTree, session.NamespaceUris, session.NamespaceUris),
        StartingNode = startNodeId
    }
};

var responseHeader = session.TranslateBrowsePathsToNodeIds(
    null,
    browsePaths,
    out var results,
    out var diagnosticInfos);

The resulting StatusCode is BadNoMatch.

The relativePath parameter is 3:Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd} (the value which Sample Client displays as BrowseName for that node). I tried also without 3: namespaceId prefix with no difference.

If I try to use NodeId of the Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd} node as the startNodeId parameter, the resulting StatusCode is BadNodeIdUnknown.

The same code works well with other OPC-UA servers like KEPServerEX or Aspen InfoPlus21. I'm not sure if the code should be different or if ProcessHistorian just does not support it. Any help appreciated.

EDIT: As @AndrewCullen pointed out there are few ways how to get the RelativePath instance. I examined the code in UA-.NET and tried also creating RelativePath using its constructor, which controls every aspect of the object:

var qn = new QualifiedName("Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}", 3);
var rp = new RelativePath(null, false, true, qn);

browsePaths.AddRange(relativePaths.Select(relativePath => new BrowsePath
{
    RelativePath = rp,
    StartingNode = startNodeId
}));

According to OPC UA Part 04 - Services (chapter 7.26) when the referenceTypeId is not specified (the first argument of the RelativePath's constructor) then all References are included and the parameter includeSubtypes is ignored. So this construct should be the most universal (if I understand it correctly). But neither this approach was successful.

EDIT2:

Attaching View Node Attributes for Process Historian node:

View Node Attributes for Process Historian node

And what I actually need is to translate Browse Path for tags. Attributes of one sample tag follows in the next picture.

So I would need to resolve path like: 3:Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}/3:CMC/3:OSS1/3:OSS1_OSS1/3:ZAKLADAC/POC_VRSTEV.V to its NodeId. There might be another catch - the slash in the name - do I need to escape it somehow?

Tag attributes

Edit3:

Also filed as issue at GitHub of OPCFoundation

eXavier
  • 4,821
  • 4
  • 35
  • 57

2 Answers2

1

I found that RelativePath.Parse follows the string format found in Part 4 - Services Annex A.2.

Try prefixing with forward slash, eg "/3:Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}"

ps. i see that if you leave off the "3:" the server will assume you meant "0:"

pps. Use the version of Parse with only arguments string, ITypeTable. You don't need to translate Namespaces in this case.

ppps: Most browse names i see have no whitespace. I wonder why?

Browse Name

Try reading the server object?

var browsePaths = new [] { new BrowsePath { StartingNode= ObjectIds.ObjectsFolder, RelativePath=RelativePath.Parse("/0:Server/0:ServerStatus", session.TypeTree) } };

session.TranslateBrowsePathsToNodeIds(null, browsePaths, out BrowsePathResultCollection results1, out DiagnosticInfoCollection infos1);

Console.WriteLine($"Expecting 'i=2256', read {results1[0].Targets[0].TargetId}");
Andrew Cullen
  • 838
  • 8
  • 14
  • Tried but prefixing the name with slash did not help. I edited my post with using of RelativePath constructor. – eXavier Feb 05 '18 at 08:47
  • Reading Server properties works fine (as I mentioned in my question) - I verified that all variants: `RelativePath.Parse("/0:Server/0:ServerStatus", session.TypeTree)`, `RelativePath.Parse("0:Server/0:ServerStatus", session.TypeTree)`, `RelativePath.Parse("/0:Server/0:ServerStatus", session.TypeTree, session.NamespaceUris, session.NamespaceUris)` and `RelativePath.Parse("0:Server/0:ServerStatus", session.TypeTree, session.NamespaceUris, session.NamespaceUris)` yields `i=2256`. But neither works for node `/3:Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}` with or without leading slash – eXavier Feb 06 '18 at 07:45
  • I only accidentally noticed your edit, please add comment or mention me so I get a notification. Did you manage it to work? In my case I don't even know why I'm getting `BadNodeIdUnknown` if I use the NodeId for `Process Historian {7a3ea44f-b495-414c-84f9-7498095d43bd}` (copied from View Node Attributes dialog) as `StartingNode` parameter. It looks like all the subtree is somehow not supported for `TranslateBrowsePathsToNodeIds` – eXavier Feb 06 '18 at 07:52
  • Could you post an image of the View Node Attributes dialog for Process Historian? – Andrew Cullen Feb 06 '18 at 19:26
  • I added the picture of the dialog to my post – eXavier Feb 07 '18 at 09:31
  • 2
    The picture looks ok to me. To escape the '/', precede it with the '&' character. “/2:Block&.Output” Follows any forward hierarchical Reference with target BrowseName = “2:Block.Output”. – Andrew Cullen Feb 07 '18 at 13:08
  • You may also wish to post your question here: https://github.com/OPCFoundation/UA-.NETStandard/issues – Andrew Cullen Feb 07 '18 at 13:21
  • Good to know (the escape character), thanks! But first I need to get it work. I tested with the tags not having the slash in the name. I'm starting to think it is limitation of ProcessHistorian (as it works for other servers) – eXavier Feb 07 '18 at 13:23
1

So the final result is that Proces Historian DOES NOT SUPPORT TranslateBrowsePathsToNodeIds (despite of it works for the Server node).

In the end I found documentation (ch 3.9.5) that the Process Historian supports only following functionality from View Service Set:

  • Browse
  • BrowseNext

which conforms to the View Basic ConformanceUnit of View Services, detailed in OPC UA Part 7: Profiles

eXavier
  • 4,821
  • 4
  • 35
  • 57