feat(heidenhain): Part 9 condition class from alarm class/group, ALARM: selectors in the browse picker, unclaimed alarms counted + logged (#839)
- Core: optional AlarmEventArgs.ConditionClass (AlarmConditionClass Base/Process/Maintenance/System/Safety) carried by NativeAlarmProjector on AlarmConditionSnapshot and written to ConditionClassId/Name by OtOpcUaNodeManager (kept across class-less events, carried across a #641 rebuild). - Heidenhain: HeidenhainAlarmClasses — HEIDENHAIN DNC-interface class/group names (corroborated by the captured iTNC 530 record); class 5 => Safety, group 1/2 => Process, 4/5 => System, else Base. - DiscoverAsync offers AlarmConditions/ selector leaves (IsAlarm Boolean); browse-commit seeds the alarm object. - Alarms no selector claims: otopcua.driver.alarms.unmatched counter, /hosts diagnostics, rate-limited Warning. Refs #839
This commit is contained in:
@@ -12,7 +12,7 @@ namespace ZB.MOM.WW.OtOpcUa.Runtime.Drivers;
|
||||
/// </summary>
|
||||
public sealed class NativeAlarmProjector
|
||||
{
|
||||
private readonly Dictionary<string, (bool Active, bool Acked, string? Message, ushort Severity, uint StatusCode)> _prior =
|
||||
private readonly Dictionary<string, (bool Active, bool Acked, string? Message, ushort Severity, uint StatusCode, AlarmConditionClass? Class)> _prior =
|
||||
new(StringComparer.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
@@ -82,7 +82,7 @@ public sealed class NativeAlarmProjector
|
||||
// driver's word, so a late ack failure must not rewrite it.
|
||||
_pendingLocalAck.Remove(nodeId);
|
||||
var prev = _prior.TryGetValue(nodeId, out var p)
|
||||
? p : (Active: false, Acked: true, Message: (string?)null, Severity: (ushort)0, StatusCode: OpcUaStatus.Good);
|
||||
? p : (Active: false, Acked: true, Message: (string?)null, Severity: (ushort)0, StatusCode: OpcUaStatus.Good, Class: (AlarmConditionClass?)null);
|
||||
// A source with a finer scale than the four buckets supplies the exact Part 9 severity.
|
||||
var sev = e.OpcUaSeverity is { } exact ? (ushort)Math.Clamp(exact, 1, 1000) : MapSeverity(e.Severity);
|
||||
// Only a statement saying the SAME thing the condition already shows is a re-statement.
|
||||
@@ -154,14 +154,18 @@ public sealed class NativeAlarmProjector
|
||||
}
|
||||
|
||||
var statusCode = e.QualityStatusCode ?? OpcUaStatus.Good;
|
||||
_prior[nodeId] = (active, acked, e.Message, sev, statusCode);
|
||||
// A source that classifies its conditions (#839) states the class on its transitions; one that does not (or a
|
||||
// quality-only annotation) keeps whatever the condition last carried.
|
||||
var conditionClass = e.ConditionClass ?? prev.Class;
|
||||
_prior[nodeId] = (active, acked, e.Message, sev, statusCode, conditionClass);
|
||||
return new AlarmConditionSnapshot(
|
||||
Active: active, Acknowledged: acked, Confirmed: true, Enabled: true,
|
||||
Shelving: AlarmShelvingKind.Unshelved, Severity: sev, Message: e.Message,
|
||||
// A per-condition source quality (MTConnect Unavailable) when the driver reports one. Absent
|
||||
// (every earlier source) ⇒ Good, as before — driver-wide comms loss stays the host's
|
||||
// out-of-band WriteAlarmQuality annotation, not something the projector infers.
|
||||
StatusCode: statusCode);
|
||||
StatusCode: statusCode,
|
||||
ConditionClass: conditionClass);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -195,7 +199,7 @@ public sealed class NativeAlarmProjector
|
||||
snapshot = new AlarmConditionSnapshot(
|
||||
Active: p.Active, Acknowledged: false, Confirmed: true, Enabled: true,
|
||||
Shelving: AlarmShelvingKind.Unshelved, Severity: p.Severity, Message: p.Message ?? string.Empty,
|
||||
StatusCode: p.StatusCode);
|
||||
StatusCode: p.StatusCode, ConditionClass: p.Class);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user