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
search nodes with filter condition using SDK client and server
October 19, 2020
13:13, EEST
Avatar
jonghwi kwon
New Member
Members
Forum Posts: 2
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline

First, sorry for poor my English.
I am a newbie in using SDK client and server.
I want to know to search nodes with filter condition such as “node class=variable and data type=double”.
How can I implement this function both client and server ?
Please let me know in sample code.
Thanks in advance.

October 19, 2020
15:01, EEST
Avatar
admin
Admin
Forum Posts: 1
Member Since:
December 19, 2011
sp_UserOfflineSmall Offline

Hi,

Good Question (in both meanings). If possible, I would like to ask why would you like to do that?

Yes, in the OPC UA Specification, there is the Query Service (Set): https://reference.opcfoundation.org/v104/Core/docs/Part4/5.9.1/ (and relevant here is the QueryFirst only, https://reference.opcfoundation.org/v104/Core/docs/Part4/5.9.3/#5.9.3.1, since the QueryNext is just a continuation of the operation the same way a HistoryRead would work). However, I have been doing OPC UA for years now, and I have never seen an UA Server to actually implement support for the Query service (including our own applications as well, they do not support it).

In our Prosys OPC UA SDK for Java, you can make the server to support Query, but you basically need to handle the implementation yourself, by adding a NodeManagerTableListener to the NodeManagerTable.setListener(…) returned by UaServer.getAddressSpace(). Or alternatively by using a subtyped NodeManagerTable, but I would recommend to use the listener instead where possible. However, at the moment that is it, you get the raw QueryFirstRequest and must fill the given QueryFirstResponse fields manually. Doing the actual implementation might be anything ranging from easy to impossible, depends what is your underlying data source.

In general the problem is that the Query only makes sense if all your data comes directly from a database (or equivalent), which can do the given Query operation itself. There might be e.g. more nodes in the server that you can fit to memory at once. Also this is sort of a those problems that since no one kind has this feature, no one can kinda use it, and because no-one uses it, there is no incentive to build support (as long as there are more features etc. to be implemented that are requested).

As an alternative I guess it is also possible to try to Browse the entire address space, but we do not recommend that, it is not how a typical client application would work. In theory there can be infinite number of nodes on the server (and/or more you can ever fit to memory). Also depending on the server, you could try to find the inverse HasTypeDefinition references from an ObjectType or VariableType type node. It is upto to the server does it have those.

In reality, in most cases, there is either a known-before-out-of-bound-knowledge configuration file on the client side so it will know what to look for or alternatively there is some ruleset to follow from a well known entry node (e.g. Devices folder for the DI spec). Typically those are made by a human looking at the server via a generic graphical client or reading the companion specification document.

Thus it basically boils down to what your actual use-case?

October 19, 2020
15:03, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

And seems I failed to use correct forum account, but anyway, my answer.

October 20, 2020
4:43, EEST
Avatar
jonghwi kwon
New Member
Members
Forum Posts: 2
Member Since:
December 20, 2019
sp_UserOfflineSmall Offline

Thank you for the quick and kind reply !.

=> Good Question (in both meanings). If possible, I would like to ask why would you like to do that?

In my case, the OPC UA client would like to receive variable lists with one read call to the OPC UA server using filter condition.
In OPC UA server, variable lists are connected to the cache such as hash table of key and value pair.
And I guess the search result nodes will be about 1,000 or less.
If search function does not exist, the client must use many read call or browse next to receive the variable lists.
I want to know if Prosys SDK handle this function in both client and server.
Thanks in advance.

October 20, 2020
12:39, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

If you have not yet looked/used https://www.prosysopc.com/products/opc-ua-simulation-server/, https://www.prosysopc.com/products/opc-ua-browser/, https://www.unified-automation.com/products/development-tools/uaexpert.html plus checked the samples that come with the SDK plus read the tutorials, I would recommend to do so.

In general it all depends what you want to do, but please note that the “solution-space” for OPC UA is basically anything you can do with an object oriented programming/modeling language (i.e. “basically anything”), thus it is hard to condense basics in a single post (typically explaining those takes 3 full workshop days: theory+client+server and that is just to get started). And it also means that there are numerous things that can influence how I will answer depending how the “big picture” looks.

Yes, you can do basically any service call in the client side. On the server side, assuming you use UaNodes to build the address space, Read/Browse will work out-of-the-box. If you do not want to use UaNodes, you will need to do similar construct that the MyBigNodeManager class does in the sampleconsoleserver example, which is basically providing the data when the SDK ask for it. Based on your answer, the MyBigNodeManager way might be easier to implement, but it is basically a bit lower-level API SDK-wise, since most of the advanced features sort of are done on top of the UaNodes currently.

Since interoperability is one of the main points of OPC UA, there is always the question that how a 3rd party client could operate on a Server. If you are doing both the Client and the Server and never ever intend to have any other Client connecting to the Server, you can do things that would not otherwise be recommended (still, in general, it is best to do things the “OPC UA way” where possible). This means you can e.g. do OPC UA Method (see e.g. MyMethodManagerListener in the sampleconsoleserver example) that you would call from the client side to return e.g. a NodeId array per the filter conditions that you would set as input arguments. You can also try implementing the Query like explained in prev post, but it might be a bit too .. complicated for this use-case.

Typically in an OPC UA Server a Variable will be part of a larger modeled Object type that has a lot of metadata. But in this case you could also have the (simple) Variables just inside a simple FolderType instance. Not sure of how many data points you have in total though, it might not be the best of ideas to put e.g. 100k-1million of more references under a single node. Like you can, but a Client doing a Browse on the node might do it some time (e.g. SDK defaults are to ask 1k references at a time per service call). However note that the nodes should still be Browse-able via hierarchical references from the Root/Objects/ FolderType instance (this is one the well known NodeIds a Client can use), but if 3rd party clients are not a thing, then it would not matter (though, then it is more like using OPC UA in a custom solution as an internal implementation detail, not actually “doing” OPC UA so to say).

This is getting somewhat long, so I’ll wait for your answer/opinions before continuing..

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
24 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, biancacraft16

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

Administrators: admin: 1