Auto: s7-c4 — deadband / on-change with thresholds

Closes #297
This commit is contained in:
Joseph Doherty
2026-04-26 01:14:59 -04:00
parent 8909302929
commit 06b39a28fa
5 changed files with 555 additions and 4 deletions
@@ -253,6 +253,21 @@ public sealed class S7ProbeOptions
/// (legacy single-rate behaviour). Group names are matched case-insensitively. See
/// <c>docs/v2/s7.md</c> "Per-tag scan groups" section.
/// </param>
/// <param name="DeadbandAbsolute">
/// PR-S7-C4 — optional absolute change threshold for numeric tags. When set the driver
/// suppresses <c>OnDataChange</c> publishes whose <c>|new - prev|</c> is strictly less
/// than this value. Ignored for non-numeric types (string, bool, byte[]) which keep
/// exact-equality semantics. NaN / ±Infinity samples bypass the filter and always
/// publish. See <c>docs/v2/s7.md</c> "Deadband / on-change" section.
/// </param>
/// <param name="DeadbandPercent">
/// PR-S7-C4 — optional percent-of-baseline change threshold for numeric tags
/// (0..100; e.g. <c>10</c> = "publish when |delta| ≥ 10% of |prev|"). Falls back to
/// <see cref="DeadbandAbsolute"/> when <c>|prev| &lt; 1e-6</c> (near-zero baseline rule)
/// to avoid div-by-zero / divergence; if no absolute is configured the sample publishes.
/// When both deadbands are set the filters are OR'd — the value publishes if EITHER
/// threshold says publish (Kepware-style semantics). See <c>docs/v2/s7.md</c>.
/// </param>
public sealed record S7TagDefinition(
string Name,
string Address,
@@ -261,7 +276,9 @@ public sealed record S7TagDefinition(
int StringLength = 254,
bool WriteIdempotent = false,
int? ElementCount = null,
string? ScanGroup = null);
string? ScanGroup = null,
double? DeadbandAbsolute = null,
double? DeadbandPercent = null);
public enum S7DataType
{