B1.3: isStable real threshold (config-driven, replaces tautology)
The legacy stdDev < stdDev*2 was always true. New behaviour: stdDev <= config.calibration.stabilityThreshold OR stdDev === 0. Default threshold 0.01 in scaling-units. Schema field + editor UI added. 4 BUG-PRESERVED tests rewritten + 4 new edge tests. 101/101 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
simulator: { value: false },
|
||||
smooth_method: { value: "" },
|
||||
count: { value: "10", required: true },
|
||||
stabilityThreshold: { value: 0.01 },
|
||||
processOutputFormat: { value: "process" },
|
||||
dbaseOutputFormat: { value: "influxdb" },
|
||||
|
||||
@@ -227,6 +228,12 @@
|
||||
(field) => (node[field] = parseFloat(document.getElementById(`node-input-${field}`).value) || 0)
|
||||
);
|
||||
|
||||
// Calibration stability threshold: 0 is a valid (very strict) value, so
|
||||
// fall back to the default 0.01 only when the field is empty / NaN.
|
||||
const stRaw = document.getElementById('node-input-stabilityThreshold').value;
|
||||
const stParsed = parseFloat(stRaw);
|
||||
node.stabilityThreshold = Number.isFinite(stParsed) ? stParsed : 0.01;
|
||||
|
||||
// Mode-dependent validation. In digital mode we don't care about
|
||||
// scaling completeness (the channels have their own per-channel
|
||||
// scaling); in analog mode we still warn about half-filled ranges.
|
||||
@@ -329,6 +336,14 @@
|
||||
<input type="number" id="node-input-count" placeholder="10" style="width:60px;"/>
|
||||
<div class="form-tips">Number of samples for smoothing</div>
|
||||
</div>
|
||||
|
||||
<!-- Calibration Stability Threshold -->
|
||||
<div class="form-row">
|
||||
<label for="node-input-stabilityThreshold"><i class="fa fa-balance-scale"></i> Stability Threshold</label>
|
||||
<input type="number" id="node-input-stabilityThreshold" placeholder="0.01" step="any" style="width:100px;"/>
|
||||
<span style="margin-left:6px; color:#666;">(scaling-units)</span>
|
||||
<div class="form-tips">Maximum stdDev of the rolling window for calibrate() and evaluateRepeatability() to accept the buffer as stable. Default 0.01.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user