Alarms in OPCUA reference implementation|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Alarms in OPCUA reference implementation
Avatar
Peter Franklin
Member
Members
Forum Posts: 24
Member Since:
04/14/2020
sp_UserOfflineSmall Offline
1
03/05/2021 - 18:07
sp_Permalink sp_Print sp_EditHistory

Trying to implement alarms in our OCPUA server, and have a few questions. I'm reading the spec and looking at the AlarmCondition Server Quickstart sample.

1) SourceState - in the sample, are SourceState objects specific to Alarms, or in a real world use case would they be any normal node in your address space that you want to generate alarms for? For example, in our address space we have nodes that contain realtime values from our backend system. I want to be able to report alarms if that value is outside of a specified range. Would that realtime value node be my "SourceState" object?

2) In the SourceState, I'm surprised that the EventNotifier is set to None. Why is it not SubscribeToEvents?

3) I'm trying to understand what is needed only to support the bare minimum of reporting an alarm on a value, and acknowledge alarm? Without supporting the areas, branch, dialog, confirm, comment, enable/disable or shelve features that I see in the sample.

I'm guessing that I'd need to:

 - implement ConditionRefresh(), and OnAcknowledge()

 - call ClearChangeMasks(), and ReportEvent() when alarm state changes

Is that it?

Can someone provide a small code example or describe what is necessary to implement just the minimum to report an alarm and acknowledge an alarm for a value?

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
03/05/2021 - 20:04
sp_Permalink sp_Print

The Quickstart Alarms Server should be pretty basic.

Even if you do not make the nodes visible in the address space you need to report the event which means filling in all of the fields.

The sample creates an abstraction layer for the alarm subsystem to separate out the logic needed for implement alarms:

https://github.com/OPCFoundati.....yingSystem

I don't see the 'SourceState' objects you refer to. Only SouthMotor, WestTank, etc.

Avatar
Peter Franklin
Member
Members
Forum Posts: 24
Member Since:
04/14/2020
sp_UserOfflineSmall Offline
3
03/09/2021 - 11:34
sp_Permalink sp_Print

Randy, the SourceState objects I'm referring to are in the project you linked to at this path:

https://github.com/OPCFoundati.....ceState.cs

Avatar
Peter Franklin
Member
Members
Forum Posts: 24
Member Since:
04/14/2020
sp_UserOfflineSmall Offline
4
03/09/2021 - 11:40
sp_Permalink sp_Print

Randy Armstrong said
 

Even if you do not make the nodes visible in the address space you need to report the event which means filling in all of the fields.

  

I'm not sure what context you are referring to when you say "filling in all of the fields". Can you explain what fields on what nodes you are referring to in the sample code?

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
5
03/09/2021 - 21:57
sp_Permalink sp_Print

The SourceState is used to represent an event source in the sample.

The sample made the decision to make the object an EventSource rather than a Notifier.

You could do it differently.

When I say 'all the fields', I am referring all of the condition fields such as ActiveState, Severity, EnableState, etc...

Avatar
Peter Franklin
Member
Members
Forum Posts: 24
Member Since:
04/14/2020
sp_UserOfflineSmall Offline
6
03/10/2021 - 17:37
sp_Permalink sp_Print

Randy Armstrong said
The SourceState is used to represent an event source in the sample.

The sample made the decision to make the object an EventSource rather than a Notifier.  

Okay, so it sounds like in answer to my question #1 in my original post, the answer is yes, that realtime value node in my address space can act in the role of the EventSource (as the SourceState is in the sample).

In question #2 from my original post, I am still confused about the EventNotifier property on the SourceState being set to 'None' as it is the EventSource. But I probably just don't understand the semantics of what that EventNotifier property means.

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
7
03/10/2021 - 21:02
sp_Permalink sp_Print

Only targets of HasNotifier can have the SubscribeToEvents bit set (with the exception of the Server Object).

The SourceNodeId and SourceName is in each event so a subscribers that only wants events from a single source can filter on the SourceNodeId. There is no need to subscribe to the Sources hence the bit is None.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 24
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855