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
OPC UA Java Client SDK - Need Help
November 23, 2018
7:55, EET
Avatar
sachin.sony
Member
Members
Forum Posts: 6
Member Since:
June 29, 2018
sp_UserOfflineSmall Offline

We are using Prosys OPC UA Java Client SDK (Evalution) in one of our prototype project to subscribe and read OPC AE data. Wherein we are facing one issue – we are not getting “Alarm Acknowledgement (AckedState/ID)” field for the AE Node. We are not sure if we are doing something wrong here. Hence, request you to please guide us on same. Thanks.

November 23, 2018
9:20, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

Thank you for contacting us. At least one potential source of error is that the event fields are case sensitive.

Please start by changing the event field name to “AckedState/Id”. Meaning that change the uppercase D to lowercase d.

November 23, 2018
11:13, EET
Avatar
sachin.sony
Member
Members
Forum Posts: 6
Member Since:
June 29, 2018
sp_UserOfflineSmall Offline

Heikki Tahvanainen said
Hello,

Thank you for contacting us. At least one potential source of error is that the event fields are case sensitive.

Please start by changing the event field name to “AckedState/Id”. Meaning that change the uppercase D to lowercase d.  

Hi,

Thanks for your reply. Well, we are not getting “AckedState/Id” attribute for the event node in MonitoredEventItem Method. Is there anyway we get this attribute. Thanks.

November 23, 2018
11:47, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

How are you defining the EventFilter? Please post for example a code snippet showing the relevant parts of the initialization showing how the event fields are defined.

You can also check the SampleConsoleClient.createEventFilter method for one basic example.

As a second point: have you verified that you can see the AckedState/Id values correctly with some generic testing client such as Prosys OPC UA Client?

November 23, 2018
13:12, EET
Avatar
sachin.sony
Member
Members
Forum Posts: 6
Member Since:
June 29, 2018
sp_UserOfflineSmall Offline

Please find Event Filter:

protected final QualifiedName[] eventFieldNames = { new QualifiedName(“EventType”), new QualifiedName(“Message”),
new QualifiedName(“SourceName”), new QualifiedName(“Time”), new QualifiedName(“Severity”),
new QualifiedName(“ActiveState/Id”), new QualifiedName(“ConditionName”),
new QualifiedName(“ActiveState/EffectiveDisplayName”), new QualifiedName(“AckedState/Id”) };

Additionally, please let me know how I can read the values of various Alarm Conditions to determine the user actions like – Ack/UnAck, Shelve/UnShelve, Lock/Unlock, Silence/UnSilence, Inservice/OutService, Reset, Respond, UserComment, etc.

November 23, 2018
13:47, EET
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

The above listing of eventFieldNames is correct. How have you tested that the server application is actually sending values for the AckedState?

You can test the alarm condition handling for example with Prosys OPC UA Simulation Server which sends ExclusiveLevelAlarmTypes.

The AckedState/Id can exactly be used to follow actions for the alarm. When user acknowledges the alarm, the AckedState/Id will change to true.

November 26, 2018
8:02, EET
Avatar
sachin.sony
Member
Members
Forum Posts: 6
Member Since:
June 29, 2018
sp_UserOfflineSmall Offline

Heikki Tahvanainen said
Hi,

The above listing of eventFieldNames is correct. How have you tested that the server application is actually sending values for the AckedState?

You can test the alarm condition handling for example with Prosys OPC UA Simulation Server which sends ExclusiveLevelAlarmTypes.

The AckedState/Id can exactly be used to follow actions for the alarm. When user acknowledges the alarm, the AckedState/Id will change to true.  

Hi,

Appreciate if you share sample code for reading the Server Side Alarm Condition Events to read the various alarm states like Ack/UnAck, Shelve/UnShelve etc. Thanks.

November 26, 2018
16:58, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 994
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Alarms and Events (Alarms are a subtype of Events) are basically (only) a snapshot of a alarms/event node’s Properties state of a certain time. When a node fires an event (or a “virtual node” in case of “one-shot” events), it takes a snapshopt of all it’s Properties. This data is then compared vs. the WhereClause of the EventFilter of the Monitored event item. IF the event passes the clause, then the array of SelectClauses are evaluated vs. the data and the results are (in same order) what the MonitoredEventItemListener.onEvent(item, Variant[]) set on the item will give out on the client side. If the given event did not have that Property, it will get a null value (because the indexies are 1:1 for the SelectClauses of the filter). Please read UA Specification Part 9 for more info.

On the client side please see MyMonitoredEventItemListener and SampleConsoleClient.createEventFilter method. It is quite simplified; for more complex EventFilters at the moment you will need to read the Part 9 (and the server must support those filters as well).

On the server side, get the Properties of the node (UaNode.getProperty) and values of those Properties, or use codegen classes; see MyNodeManager.createAlarmNode.

On the server side, the SDK contains a base implementations of handling the state within the alarm nodes (e.g. AcknowledgeableConditionTypeNode). This follows the same logic as implementing methods on codegenerated types. Please see the server tutorial chapter “13.2.5. Implementing Methods in Generated Types”. You can e.g. override the complete current “Acknowledge” Method implementation by calling (static)

AcknowledgeableConditionTypeNode.setAcknowledgeMethodImplementation(AcknowledgeableConditionTypeAcknowledgeMethod acknowledgeMethodImplementationNewValue)

Alternatively you can react to the call the similar way as MyMethodManagerListener sample does.

P.S.
Unless you make your WhereClause to ignore certain events, you will get all events from the ‘Server’ node (assuming you subscribed there). Therefore it is possible that the original issue (assuming there was not a typo with the casing) was just another event type, which does not contain that Property.

February 21, 2022
12:44, EET
Avatar
Oleksandr
Member
Members
Forum Posts: 34
Member Since:
February 14, 2020
sp_UserOfflineSmall Offline

Hello Team ,
I have a question about defining the EventFilter.
Is it possible to select all fields of event? How to recognize fields belonging to enents?
Thank you
Oleksandr

February 21, 2022
15:58, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 994
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

In general please do not resurrect old threads.

In short, it is not possible to “select all fields” in OPC UA. You can only get what you select, in that order (selecting nothing would get nothing).

The Variant array you get as data has the Variants in the same order the selectClauses of the event Filter. This is to say, like with the Read service call, the results have “no key” and it is the request that defines the order and kind of the data. With events it is the creation of the monitored item that fixes the fields and their order.

Technically you can loop all componets and properties of all event types and make the EventFilter like that, though you will get a lot of extra null values when that field doesn’t apply to the event.

IF the server also supports Event History, you could make a basic filter and then make a more specific history read for the event to get extra details(since you can make the event filter “again” when you make the history call, i.e. the server could store all fields for the event, though depends on the server implementation).

Alternatively if you control all information models and event types, you could make a generic “Data” Property to have a Structure that would contain all data of the event, though this would be a non-general solution.

February 24, 2022
10:02, EET
Avatar
Oleksandr
Member
Members
Forum Posts: 34
Member Since:
February 14, 2020
sp_UserOfflineSmall Offline

Thank you.
Can you give some hints how to do it:
“Technically you can loop all componets and properties of all event types and make the EventFilter like that”?

February 25, 2022
10:53, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 994
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

If possible can you explain why exactly would you need this?

Anyway, either via UaNodes (UaClient.getAddressSpace().getNode) or UaClient.getAddressSpace().browseXXX:

Start from the BaseEventType and recursively Browse and get the referecens (you can do this form UaNode instances directly) and find all subtypes and keep track of their Components and Properties and then build the EventFilter with all paths.

That being said, I would not recommend doing this. Like, that is the only way as far as I’m aware, yes, but clearly the intention of OPC UA is not to do it like this (like I could be wrong as well).

There are limits on how much data can be sent back in a single message. The exact limits are negotiated by the client and the server. Most likely you cannot affect the server.

This “trick” might only work upto the point where all the data fits a single PublishResponse. Since it is a notification for single monitored item, it cannot be split. But if we take this “crazy way” even further beyond, maybe the EventFilter can be split into multiple items. You would want to be sure to include the EventId in all of them to sync up later. Then you could limit the subscription to only report a single change per notification. That would scale (upto allowed items per subscription, which probably is high enough of a limit).

But, the server will transmit quite a lot of unneeded data and will also put a burden on the server to always encode and send the data.There could be 100s or 1000s or 10000s of event fields, at least theoretically. And you will always get _all of them_ (as null values, that does take up space on the wire, at least a bit), even though the actual event might take like 10 of them. It will be the worse the more there are event types on the server.

June 17, 2024
13:48, EEST
Avatar
Oleksandr
Member
Members
Forum Posts: 34
Member Since:
February 14, 2020
sp_UserOfflineSmall Offline

Hi.
What is the correct entry for the filter field if it is shown in UAExpert as “3:AssociatedValue_01”?
Unfortunately I don’t get any Value for this field when the event occurs.
in UA Expert it works.
Thank you
Oleksandr

June 17, 2024
15:09, EEST
Avatar
Matti Siponen
Moderator
Members

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

Hello,

Have you taken a look at the createEventFilter method of SampleConsoleClient sample Client application? You can modify its eventFieldNames field to add your custom Event Fields to the EventFilter.

In this case, you could try adding new QualifiedName(3, “AssociatedValue_01”) to the list so that values would be provided for that Event Field. Have you tried doing this or something similar?

June 17, 2024
15:20, EEST
Avatar
Oleksandr
Member
Members
Forum Posts: 34
Member Since:
February 14, 2020
sp_UserOfflineSmall Offline

Thank you.
Yes, I did it, i have to set “QualifiedName: Id:3”. as new QualifiedName(3, “AssociatedValue_01”).

June 17, 2024
16:06, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1015
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

The sample has hard coded every field to be connected to BaseEventType (with eventTypeId). Try changing that for this field to the type that actually defines that field.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
8 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 142

pramanj: 86

Francesco Zambon: 83

rocket science: 82

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 704

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1482

Posts: 6316

Newest Members:

samui, TommyDab, wross, Jeremyknock, Pedromon, DonaldEdism, Miguelplese, Scotanine, katesalas95, Petertum

Moderators: Jouni Aro: 1015, Pyry: 1, Petri: 0, Bjarne Boström: 994, Jimmy Ni: 26, Matti Siponen: 330, Lusetti: 0

Administrators: admin: 1