Events, alarms and history
Values tell you what is happening now; events and history tell you what happened and why. This course covers the Part 9 alarm hierarchy, event filters that return only what you need, condition classes as machine-readable reason codes, and server-side aggregates.
| Lessons | 10 |
|---|---|
| Time | about 72 minutes |
| Prerequisites | A4 |
| Cost | Free: written lessons open, video and labs need a free account |
What you will be able to do
- You can subscribe to events with a select and where clause you wrote yourself.
- You can use ConditionClassId as a portable downtime reason code.
- You can read history without pulling more than you need.
- You can ask the server for a time-weighted average instead of computing it downstream.
Syllabus
-
1
Subscribe to events, not values8 min
The event notifier, the event type hierarchy, and why a downtime reason should arrive as a timestamped event rather than be inferred from a sampled boolean.
Asset An event subscription printing real events from the Milo demo server
-
2
Write a select clause8 min
Choosing the fields you want: Time, SourceNode, Severity, Message, ConditionClassId. The default selection is rarely what you need.
Asset The same events with a default and a hand-written select clause, both outputs shown
-
3
Write a where clause8 min
Filtering server-side so the noise never reaches you. Operators, operands and the errors a malformed filter produces.
Asset Three where clauses, one of which fails, with the status code it returns
-
4
Navigate the Part 9 hierarchy7 min
BaseEventType down through ConditionType, AcknowledgeableConditionType and AlarmConditionType. What a condition is that an event is not.
Asset The event type tree browsed from a live server, with the inherited fields at each level
-
5
Handle acknowledge and confirm6 min
Two-stage alarm handling, who is allowed to do it, and what the state machine does in between.
Asset An alarm acknowledged and confirmed over OPC UA, with the state transitions logged
-
6
Refresh conditions after a reconnect6 min
ConditionRefresh and why a client that reconnects without it believes the plant is healthy.
Asset A reconnect with and without ConditionRefresh, showing the missed active alarms
-
7
Use ConditionClassId as a reason code7 min
The mechanism that makes downtime reasons portable between machines and vendors, and how MachineTool's condition classes plug into it.
Asset A table of MachineTool condition classes mapped to a downtime reason taxonomy
-
8
Read raw history7 min
HistoryReadRawModified, bounding values, continuation points, and what a gap in history means.
Asset A raw history read across a gap, with the bounding values returned
-
9
Ask for aggregates instead8 min
TimeAverage, DurationGood, PercentGood and Count computed server-side. Far cheaper than streaming raw data and aggregating downstream.
Asset The same shift summarised by server-side aggregate and by client-side computation, with both costs
-
10
Check the server can do any of this7 min
The HistoricalRawData2022 and AggregateHistorical2022 facets, and how to find out before you design around them.
Asset ServerProfileArray from three servers, showing which history facets each claims
Lab
Free account required
Subscribe to events on opc.tcp://milo.digitalpetri.com:62541/milo with a where clause that returns only severity above 500, then read one hour of history for a node and ask the server for its time-weighted average.
Unlock the lab →Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.