56bb4855bb
M1: the time-weighted family (incl. Total, formerly a pushed-down SUM) streams raw window rows into the C# evaluator. New shared knob ServerHistorian:MaxTimeWeightedRawRows (default 1,000,000; <=0 unbounded with a Validate warning) flows through HistorianBackendRegistry into both providers. The window query is capped at cap+1 (SQL Server TOP (@maxRows), QuestDB LIMIT $4); one row past the cap throws the new Core.Abstractions HistoryReadLimitExceededException, which the node manager maps to BadTooManyOperations for that node. Not counted as a backend health failure; bound rows are not counted; per-sample aggregates are not capped. M2: reverse Interpolative is anchored at the later time (Part 13): points at End - i*interval, emitted latest first. 10:00->09:00 @1h yields 10:00. L1: Partial bit (0x4, = Opc.Ua.AggregateBits.Partial) on non-Bad results of a truncated last interval (time-weighted family; per-sample family is a follow-up). L2/L3: aligned with the SDK AggregateCalculator.GetTimeBasedStatusCode (decompiled from Opc.Ua.Server 1.5.378.106): TreatUncertainAsBad=false counts Uncertain time (Uncertain samples, held-into-outage, extrapolation) as Good time; data but no non-Bad time => generic Bad (0x80000000); BadNoData only when there is no data at all. Consequence: a live tag's latest interval reads Good (documented). L5: release note no longer claims Total matches the Gateway Integral exactly (AVEVA's divisor is unverified); it notes Total is now evaluated in C# and subject to the cap. Tests: unit (reverse Interpolative x3, Partial, Bad vs BadNoData incl. an open-ended outage, cap helpers, SDK bit oracles); conformance (reverse Interpolative, raw-row cap at/over/0, bounds not counted, health unaffected); node manager BadTooManyOperations; options default + warning. Each new behaviour falsified by mutation (aggregator x9, data-source cap checks on both backends against the real DBs, node-manager catch).
39 lines
1.8 KiB
C#
39 lines
1.8 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Sql.Common;
|
|
|
|
/// <summary>Part 4 §7.39 historian info bits OR-ed onto a status code.</summary>
|
|
public static class HistorianInfoBits
|
|
{
|
|
/// <summary>InfoType = DataValue.</summary>
|
|
public const uint InfoTypeDataValue = 0x00000400u;
|
|
|
|
/// <summary>The value was produced by an aggregate calculation.</summary>
|
|
public const uint HistorianCalculated = 0x1u;
|
|
|
|
/// <summary>The value was interpolated.</summary>
|
|
public const uint HistorianInterpolated = 0x2u;
|
|
|
|
/// <summary>
|
|
/// Partial (Part 4 §7.39 / <c>Opc.Ua.AggregateBits.Partial</c>): the calculated value covers an interval shorter
|
|
/// than the processing interval (the truncated last interval of a processed read).
|
|
/// </summary>
|
|
public const uint HistorianPartial = 0x4u;
|
|
|
|
/// <summary>
|
|
/// Marks <paramref name="status"/> as a Calculated data value. Any historian bits the status already carries
|
|
/// (e.g. a stored Interpolated sample) are cleared first, so the result is never both.
|
|
/// </summary>
|
|
/// <param name="status">Base status code.</param>
|
|
/// <returns>Status with InfoType and Calculated bits set.</returns>
|
|
public static uint WithCalculated(uint status) =>
|
|
(status & ~StatusBits.HistorianBitsMask) | InfoTypeDataValue | HistorianCalculated;
|
|
|
|
/// <summary>
|
|
/// Marks <paramref name="status"/> as an Interpolated data value. Any historian bits the status already
|
|
/// carries (e.g. a stored Calculated sample) are cleared first, so the result is never both.
|
|
/// </summary>
|
|
/// <param name="status">Base status code.</param>
|
|
/// <returns>Status with InfoType and Interpolated bits set.</returns>
|
|
public static uint WithInterpolated(uint status) =>
|
|
(status & ~StatusBits.HistorianBitsMask) | InfoTypeDataValue | HistorianInterpolated;
|
|
}
|