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
Traverse through all the tags starting from root
March 17, 2024
11:07, EET
Avatar
farhanmemon94
Member
Members
Forum Posts: 6
Member Since:
February 15, 2024
sp_UserOfflineSmall Offline

How to get values of all the tags starting from root and also for a specific parent if it is mentioned using prosys SDK in java. For example, I want values of all the tags on OPC UA server or I want all tags just under the specific channel or specific Device.

March 18, 2024
8:27, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 321
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

You can use the browse methods of the AddressSpace instance accessible via the getAddressSpace method of UaClient instance. You can start browsing from the Root (i=84) or a specific Node by using the NodeId of that Node as a parameter of the browse method. You can then repeat this process for all the results of the browse to recursively traverse the entire AddressSpace.

The ReferenceDescriptions returned by the browse methods include the NodeClasses of the Nodes, so you can use that information to read Values of Variable Nodes you encounter while browsing. You use the com.prosysopc.ua.client.UaClient.readValue(NodeId) method to do this.

There are three things to consider when browsing the AddressSpace recursively:

First, the number of Nodes in the AddressSpace can be very large so traversing through all of them can take a long time. In general, I wouldn’t recommend starting from the Root as that would mean you’d also browse all the TypeDefinition Nodes. If you don’t need to browse the TypeDefinition Nodes, I would recommend starting from the Objects (i=85) instead. It is possible for the Objects to also contain hundreds or thousands of Nodes so it would be better to start from a specific Node that has a reasonable amount of “child” Nodes.

Second, you should limit the types of References returned by browse by using the overloads of the method that allow specifying a ReferenceType such as com.prosysopc.ua.client.AddressSpace.browse(NodeId, BrowseDirection, NodeId). Generally a good idea would be to limit the browse to HierarchicalReferences (i=33) unless you would need metadata such as TypeDefinitions of Nodes. Alternatively, you can get all References and choose to follow only some of them in the recursive browses.

Third, it is possible for the AddressSpace to contain loops where browsing from a Node would eventually lead to the same Node. Thus, you must keep track of the NodeIds of the Nodes you’ve already browsed to avoid getting stuck in an infinite loop.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1