Gateway historian: native TimeAverage/Total rows — leading pre-window row passed through, Uncertain rows lose their value #685
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the live AVEVA gate (2026-10-12, VPN) for #681/#679/#677. Native
TimeAverage/Totalon the Gateway backend are also broken by gateway bug historiangw#27 (interval sent 10,000× too large); these two are OtOpcUa's own:D1 — leading pre-window row.
GatewayHistorianDataSource.cs:139-147+SampleMapper.ToAggregateSnapshots(SampleMapper.cs:96-102) map every row. AVEVA always returns one extra row for the interval BEFORE the window,[start − interval, start). Since #681 stamps rows with the interval start, clients get N+1 values and the first is stamped before StartTime — with a real value when data exists before the window (TimeAverage [18:06:20, 18:07:20)⇒ first value18:06:00 22.5 Good), BadNoData otherwise. Part 11/13 expects one result per interval in[Start, End). Fix: drop rows whose interval start is outside the requested window (both directions).D2 — Uncertain rows lose their value.
SampleMapper.cs:85hasData = OpcQuality >= 192. AVEVA marks an interval containing a NULL/Bad sampleopc=64(Uncertain) and still supplies a value (TWA 3, Integral 30). OtOpcUa maps it toBadNoData, null. Fix:>= 64⇒ value with Uncertain (+ Calculated) status.Also record (docs): AVEVA's TimeWeightedAverage excludes NULL-gap time from numerator and denominator (interval 06:40: 3, Integral 30), while the SQL backends bridge the gap (6.08 Uncertain); extrapolation past the last sample is Good on AVEVA, Uncertain on SQL. Magnitude on all-Good spans matches the SQL backends exactly (sloped). Gate record evidence available on request.
Live re-check needs the VPN and the gateway fix.
Fixed on master
1f5d3100.[min(start,end), max)are dropped after draining the stream.Live AVEVA gate PASS for both OtOpcUa fixes: pre-window row gone, Uncertain rows keep 13 / 650 (were BadNoData); an all-NULL interval arrives as quality 1 / value 0 ⇒ BadNoData. Per-interval values remain wrong end to end until historiangw#27 lands — re-check tracked in #691.