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
Support for SamplingInterval with value 0
August 25, 2022
11:48, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

Hi,
i’m evaluating the support of the library for specific scenario our client requires.
Is it possible to accept a subscription to a variable from a client, that requires a value of 0 for the SamplingInterval value?
I don’t seem to find reference to how i could implement this in the docs.

What this wants to accomplish is to make the variable with sampling set to 0 update in an event-driven way,
basically they don’t want continuous updates for that subscription but only when the value changes.

Hope i’ve made myself clear enough, thanks again for the support.

August 25, 2022
13:14, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

“Yes”, but it must be enabled separately (and I think we only so far have “documented” it in the release notes). In https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_4_Release_Notes.html#version-4-5-2 we added support for this, it must be enabled by calling SubscriptionManager.setMinSamplingInterval(0) for UaServer.getSubscriptionManager().

It does have a limitation (copied from the notes): “No filtering is performed when the interval is 0 (e.g. it is possible to receive values from the past if multiple clients are writing to the node at the same time). Clients that previously used 0 will now see different behavior if enabled, since previously the server would have revised the value.”

August 25, 2022
13:24, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

NOTE! Hmm and as I wrote that I did notice you said ” they don’t want continuous updates for that subscription but only when the value changes.”.

There is some misunderstanding of how the monitoreditems work with subscriptions.

Like it depends on the settings but normally the whole point of OPC UA subscriptions is to exactly only see datachanges when the value changes i.e. you would not get them all the time (unless you literally set new values for the node all the time). SamplingInterval of 0 shouldn’t affect this at all (you would like just get even more data, as now there would be no time-based limit in milliseconds how long apart the values timestamps should be before notifying). There is a filter to also get changed whenever the sourcetimestamp changes, but normally that must be enabled separately via the filter of the item (a null filter does have default meanings too).

See the picture in https://reference.opcfoundation.org/Core/Part4/5.12.1/

August 25, 2022
13:43, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

And as extra-info in the https://reference.opcfoundation.org/Core/Part4/5.12.1/ it does say

“The Server may support data that is collected based on a sampling model or generated based on an exception-based model. The fastest supported sampling interval may be equal to 0, which indicates that the data item is exception-based rather than being sampled at some period. An exception-based model means that the underlying system does not require sampling and reports data changes.”

This is to say, basically the sampling interval just defines how fast the server is looking for the values of the nodes (before the filter!), therefore 0 is the fastest option (and if servers do not support literal 0 they would revise it to the fastest sampling rate).

P.S.
However, I should note that our SDK does this a bit differently: we do not sample, we emulate sampling, because most of the time the data is pushed (by the SDK user) to the UaNodes, so SDK already knows when the values do change. IF you use instead the “MyBigNodeManager” style NodeManager i.e. no UaNodes, you must keep track of the items manually and push changes to the them directly (basically the SDK does that for the UaNodes automatically via an internal listener), then the MonitoredDataItem does the filtering. So basically we are “always” exception-based and just emulate the intervals internally. Though you can listen and keep track of the intervals/items, if you wish to use that as a base to how often look up the true data source (assuming you poll something and the source is also not “exception-based”).

August 25, 2022
14:51, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

It is much clearer now.

We will investigate in the direction you indicated, can you just confirm that if we use MyBigNodeManager it is possible to implement this in some way without having to modify the library itself?

Thank you.

August 25, 2022
18:27, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

My point was that while you could enable samplinginterval 0 it is not a “solution” to the problem “they don’t want continuous updates for that subscription but only when the value changes”. In short, is this an actual observed problem OR a theorized one? Because OPC UA Subscriptions do not work like that. You will only get a notification if something changed (depending on the filter): either the status, value or the sourcetimestamp must change on the server, otherwise receiving a notification would be an error in the server’s implementation.

The ‘MyBigNodeManager “style”‘ in the answer meant that you can look at the ‘sdk_distribution_unzipped_rootfolder/samples/sampleconsoleserver/src/main/java/com/prosysopc/ua/samples/MyBigNodeManager.java’ (i.e. it is a sample of using the SDK; not inside the SDK) to see how it would be done. Though, it is kinda a bit lower-level API sort of as you must do things by hand that the “UaNode”(s) would normally do for you, but sometimes that is not an option. So basically we have kinda 2 major ways to model the address space (per namespace/NodeManager): either UaNodes with an NodeManagerUaNode (e.g. MyNodeManager in the sampleconsoleserver example), or “non-UaNode” implementations build manually on top of the NodeManager (and the MyBigNodeManager is such example e.g. the backend could be a database etc.).

Normally I would recommend going with ‘UaNode’ based implementation unless there is a good reason not to. IMPORTANT (since you asked about Codegen in the other post https://forum.prosysopc.com/forum/opc-ua-java-sdk/issue-with-missing-idscodegenutils-class-in-generated-class): IF you want to use Codegen, then it is hard to use the MyBigNodeManager-style solution. The output of the generation is basically more specific UaNode implementations, which are then used in place of more generic ones. You must also load the model to the server, they do go as UaNodes. Assuming the model models types, you can (and this is recommened) to have a separate namespace for the instances. However do note that SDK can only do “NodeManagerUaNode.createInstance” i.e. the generated output is not very useful if you do not use UaNodes (any custom Structure could be used though). I would basically need to know more of what you are trying to do to give a better answer.

August 26, 2022
10:20, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

Yes the final design of the our application is still being debated but the confirmation that the scenario is implementable
with the available services of the library is the real information i needed.

Thank you for your clear answer.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
14 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

TimK: 41

Member Stats:

Guest Posters: 0

Members: 681

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com

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