![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
04/14/2020
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
04/14/2020
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Randy, the SourceState objects I'm referring to are in the project you linked to at this path:
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
04/14/2020
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
04/14/2020
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
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.
1 Guest(s)