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
Getting specific nodes from the server
January 19, 2022
20:35, EET
Avatar
erminovski1
New Member
Members
Forum Posts: 2
Member Since:
January 19, 2022
sp_UserOfflineSmall Offline

Hello,

I am quite new to this topic, so I will try to explain it as best as I can the issue that I am facing.

Currently, I have a custom information model, which I have loaded in addition to Robotics and DI model, meaning have created all the necessary types with codegen, and now I would like to implement some functionality for the server. Just to be more precise, the loaded model has already defined objects, in a following hierarchy:

Objects
– SetOfDevices
– ArbitrarySytemType
– FolderType Folder f1 (containing an a node of some ArbitraryType i.e ControllerType) and inside of it a
– FolderType Folder f2 (containing another node of i.e TemperatureController)
– ParameterSet node (of BaseObjectType)
– Temperature (AnalogUnitType variables)
– Fan speed ( same)

And for me, such a structure repeats several time throughout the server, meaning that, w.r.t the example above, I would have 4 Temperature and 4 Fan speed variables.
My idea is just to implement a functionality to these nodes, say by simulating some values on them, for the purpose of exploring this SDK and to learn how server implementation works 🙂

I managed to set a value to a particular node, using the specific nodeId (which I looked up) i.e:

ExtendedNodeId id = …
((UaVariableNode) server.getAddressSpace().getNode(id)).setValue(20); —> and this was checked in UaExpert so I know it works.

However, if I would like to get assign the values to all the nodes to which I want, is there a way to obtain, using server SDK, the list of nodes based on their References, or some other parameter (like Browsname or something similar) so that I can do this more easily and quicker?

I hope I was clear enough! 🙂

January 20, 2022
9:50, EET
Avatar
Matti Siponen
Moderator
Members

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

Hello,

The Server SDK doesn’t have a “search” method that would allow you to select Nodes based on search parameters. You will have to get the Nodes by either using server.getAddressSpace().getNode(id) based on their NodeIds or using UaNode API.

UaNode API can be used to access information on the Node including its BrowseName, NodeClass and References. That way you could navigate from a Node to Nodes it targets with different types of References. You can use this API to perform a recursive search that would select Nodes based on your parameters.

For example, you can call server.getAddressSpace().getNode(new NodeId(0, 85)) to get the Objects Node and then use UaNode API to navigate to your Nodes. If you know the path to your Node based on ReferenceTypes and BrowseNames, you don’t need to know the NodeIds of your Nodes.

January 20, 2022
10:35, EET
Avatar
erminovski1
New Member
Members
Forum Posts: 2
Member Since:
January 19, 2022
sp_UserOfflineSmall Offline

Thank you for your swift response first of all!

My current goal is to set some values to various nodes, to which I do know browse paths. What you are referring to in your response reminds me quite a lot about the translateBrowsePathsToNodeIds(starting node, path), from the AddressSpace class, which returns NodeIds for the nodes that are references from the startingNode using paths. Is this what was implied by your answer or my understanding was completely wrong?

Yet another question, is whether the relative path from the starting node would simply be something like “Objects/SetOfDevices/Folder1/ArbitrarySystemType/ControllerType/Folder2/MyNode” or the relative paths are specified in another way.

Best regards,
Ermin

January 20, 2022
11:16, EET
Avatar
Matti Siponen
Moderator
Members

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

Hello,

I would personally say that translateBrowsePathsToNodeIds is needlessly complicated, but you can use it if you wish. A RelativePath given to the method is essentially a collection of RelativePathElements. See https://reference.opcfoundation.org/v104/Core/docs/Part4/7.26/ for more information on them.

If you don’t want to use translateBrowsePathsToNodeIds, you could do a simple recursion where you start from a UaNode and call getReferences() to get all References of the UaNode or getReferences(NodeId referenceTypeId, boolean isInverse) to get the References of selected ReferenceType and only forward References and the repeat this for the targets of those References until you find the UaNodes your looking for based on their BrowseNames for example.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
15 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: 728

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7

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

Administrators: admin: 1