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: 349
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: 1919

Currently Online:
48 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1