Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Related to TranslateBrowsePathToNodeID method
June 13, 2019
19:59, EEST
Avatar
Rakshan
Member
Members
Forum Posts: 10
Member Since:
June 2, 2019
sp_UserOfflineSmall Offline

Hi,
Went through the tutorials of OPCUA. Not very clear with the above method and its outcome.

If i have a tree of Root>Objects>Crane>XX>YY, , with YY being the final leaf node, what will TranslateBrowsePathToNodeID give me if i put it in a below mentioned way?

BrowsePath [] results = client.getAddressSpace().translateBrowsePathToNodeId(Identifiers.ObjectsFolder,
new RelativePathElement(Identifiers.HierarchicalReferences,false,true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url),”XX”)),
new RelativePathElement(
Identifiers.HierarchicalReferences,
false, true, new QualifiedName(
client.getAddressSpace().getNamespaceTable().getIndex(url), “YY”)));
Looking forward for a supportive response

June 14, 2019
14:11, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 402
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

It will give the NodeIds that matched the request. You can look at the extact logic given in the OPC UA Specification 1.04 Part 4 section 5.8.4 TranslateBrowsePathsToNodeIds (https://opcfoundation.org/developer-tools/specifications-unified-architecture).

June 14, 2019
15:55, EEST
Avatar
Rakshan
Member
Members
Forum Posts: 10
Member Since:
June 2, 2019
sp_UserOfflineSmall Offline

Just to add on, Is the sequence given above correct? I am not able to figure out what will the return be?
The nodeid’s of Objects,crane,XX,YY?

I am not clear with the understanding. Even the material provided has not made it clear for me. Sorry

June 17, 2019
10:03, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 402
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Exactly like that it would not compile as the return type would be BrowsePathTarget[]. Also you are missing the “Crane” step so you would not get results.

Assuming you’ll fix it to something like this, and the url is the equivalent namespaceuri for the QualifiedNames of the nodes, it will return all possible targets having that path (assuming you have only a single YY node below XX, it would return one result):

BrowsePathTarget[] results = client.getAddressSpace().translateBrowsePathToNodeId(Identifiers.ObjectsFolder,

new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "Crane")),

new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "XX")),

new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "YY")));
ExpandedNodeId target = results[0].getTargetId();

Most of the time working with the JavaSDK, you shouldn’t need to use that method often. Most likely normally you would know the NodeId of the Crane node in this case, and you could use e.g. (Assuming XX is attached via HasComponent Reference to the Crane node and YY via HasProperty to the XX, and the idx would be the correct namespaceindex for the namespace in which they are):

UaNode objects = client.getAddressSpace().getNode(craneNodeId);
UaNode xx = objects.getComponent(new QualifiedName(idx, "XX"));
UaNode yy = objects.getProperty(new QualifiedName(idx, "YY"));

And then operate on the UaNode objects.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 78

Currently Online:
9 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 91

pramanj: 86

ibrahim: 68

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

peterrob45: 25

Member Stats:

Guest Posters: 0

Members: 880

Moderators: 12

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 892

Posts: 3744

Newest Members:

Fervic1991, ivfa, tplbev1272761848, vinwin, ancyss, dj, Thomas, Viral, nedumarans, Dhruvil Dhanani

Moderators: Jouni Aro: 833, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 402, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 16, Markus Johansson: 1

Administrators: admin: 0