AC — Alarms & Conditions
Alarms & Conditions (A&C) Defines the alarm and condition mechanisms OPC UA for. It goes beyond simply "an alarm being triggered" to include comprehensive state management (acknowledgment / suppression / comment / escalation / shelving / history).
Further Reading
- Quick Start — Event Subscriptions — The Simplest Event Subscription Code
- Basics — Subscription Models — Subscription / MonitoredItem Concept
- Basics — Historical Models — ReadEvents History
Key Concepts
- Condition — Persistent "state conditions" (can be in states such as enabled/disabled, active/inactive, etc.)
- Alarm — A special Condition indicating an exception that requires the operator's attention
- Acknowledge — Operator Confirmation (Alarm Reviewed)
- Confirm — The operator confirmed that the issue has been resolved
- Shelving — Temporarily Mute Alarms (Timer / One-Time / Permanent)
Main EventType Inheritance Tree
BaseEventType (i=2041)
└── ConditionType
└── AcknowledgeableConditionType
└── AlarmConditionType
├── DiscreteAlarmType ← discrete alarm (switch trip)
│ ├── OffNormalAlarmType
│ │ ├── SystemOffNormalAlarmType
│ │ └── TripAlarmType
├── LimitAlarmType ← limit alarm (over-temperature)
│ ├── ExclusiveLimitAlarmType
│ └── NonExclusiveLimitAlarmType
└── DialogConditionType
Client Subscription Alarms
using var evSub = ua.SubscribeEvents(); // Default Server Node
evSub.EventArrived += (s, e) =>
{
Console.WriteLine($"[Severity={e.Severity}] {e.SourceName}: {e.Message}");
Console.WriteLine($" EventType = {e.EventType}");
Console.WriteLine($" Time = {e.Time}");
};
Severity
OPC UA severity 1-1000; the higher the number, the more severe:
| Severity | Level | Example |
|---|---|---|
| 1-200 | Low | Information |
| 201-400 | Medium | Warning |
| 401-600 | MediumHigh | Malfunction |
| 601-800 | High | Serious Malfunction |
| 801-1000 | Critical | Urgent / Equipment Downtime |
Acknowledge
If your application is an "operator HMI" that allows operators to acknowledge alarms upon receipt, then call the server's Acknowledge Method:
// conditionId = Example of an alarm condition NodeId; eventId = Event for this alarm ID (ByteString)
var rc = ua.Acknowledge(conditionId, eventId, "操作员已知");
ReadHistoryEvents History
The history of A&C alarms can be retrieved:
var events = ua.ReadHistoryEvents("i=2253",
start: now.AddDays(-7), end: now);
foreach (var e in events) Console.WriteLine($"{e.Time}: {e.Message}");
Key Points for Real-World Application
- Alarm subscriptions are subscribed to the default Server node (i=2253), which is the default EventNotifier.
- If an Object is itself an EventNotifier (Attribute 12 ≠ 0), it can subscribe to that node on its own.
- EventFilter You can SelectClauses specify which fields to capture; WhereClause filter expressions are not currently supported, and the server will fall back to the default fields if it does not accept custom fields.