20:35, EET
January 19, 2022
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! 🙂
9:50, EET
Moderators
February 11, 2020
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.
10:35, EET
January 19, 2022
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
11:16, EET
Moderators
February 11, 2020
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.
Most Users Ever Online: 1919
Currently Online:
19 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: 735
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1