Compare commits
2 Commits
8216480950
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a83a85e958 | ||
|
|
e041877ae4 |
@@ -11,10 +11,13 @@
|
||||
return Number.isFinite(v) ? v : null;
|
||||
};
|
||||
|
||||
// Set a numeric input's value, or blank if not finite.
|
||||
// Set a numeric input's value, or blank if not finite. Accepts numeric
|
||||
// strings (Node-RED's auto-form-binding stores form values as strings).
|
||||
ns.setNumberField = (id, val) => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.value = Number.isFinite(val) ? val : '';
|
||||
if (!el) return;
|
||||
const num = typeof val === 'number' ? val : parseFloat(val);
|
||||
el.value = Number.isFinite(num) ? num : '';
|
||||
};
|
||||
|
||||
// Add input + change listeners to a list of node-input-* ids.
|
||||
|
||||
@@ -68,11 +68,14 @@
|
||||
ns.setNumberField('node-input-stopLevel', node.stopLevel);
|
||||
// holdLevel defaults to startLevel when omitted (no hold band). Show
|
||||
// the saved value if there is one; otherwise mirror startLevel so the
|
||||
// user immediately sees the "no hold band" baseline.
|
||||
// user immediately sees the "no hold band" baseline. Coerce to Number
|
||||
// because Node-RED form-bind stores numeric inputs as strings.
|
||||
const holdNum = parseFloat(node.holdLevel);
|
||||
ns.setNumberField('node-input-holdLevel',
|
||||
Number.isFinite(node.holdLevel) ? node.holdLevel : node.startLevel);
|
||||
Number.isFinite(holdNum) ? holdNum : node.startLevel);
|
||||
const deadZoneNum = parseFloat(node.deadZoneKeepAlivePercent);
|
||||
ns.setNumberField('node-input-deadZoneKeepAlivePercent',
|
||||
Number.isFinite(node.deadZoneKeepAlivePercent) ? node.deadZoneKeepAlivePercent : 1);
|
||||
Number.isFinite(deadZoneNum) ? deadZoneNum : 1);
|
||||
ns.setNumberField('node-input-maxLevel', node.maxLevel);
|
||||
ns.setNumberField('node-input-logCurveFactor', node.logCurveFactor);
|
||||
ns.setNumberField('node-input-shiftLevel', node.shiftLevel);
|
||||
|
||||
@@ -50,6 +50,15 @@
|
||||
node.logCurveFactor = parseNum('node-input-logCurveFactor');
|
||||
node.startLevel = parseNum('node-input-startLevel');
|
||||
node.maxLevel = parseNum('node-input-maxLevel');
|
||||
// Persist as numbers — Node-RED's auto-form-binding would store these as
|
||||
// strings, and oneditprepare's setNumberField rejects non-Number values,
|
||||
// so the input would blank out on reopen.
|
||||
const stopLevelVal = parseNum('node-input-stopLevel');
|
||||
node.stopLevel = Number.isFinite(stopLevelVal) ? stopLevelVal : null;
|
||||
const holdLevelVal = parseNum('node-input-holdLevel');
|
||||
if (Number.isFinite(holdLevelVal)) node.holdLevel = holdLevelVal;
|
||||
const deadZoneVal = parseNum('node-input-deadZoneKeepAlivePercent');
|
||||
if (Number.isFinite(deadZoneVal)) node.deadZoneKeepAlivePercent = deadZoneVal;
|
||||
// minLevel is no longer a user input — it's the derived dryRunLevel
|
||||
// (outflowLevel × (1 + dryRunThresholdPercent/100)). The runtime still
|
||||
// uses node.minLevel as the unconditional STOP threshold; we set it
|
||||
|
||||
@@ -18,13 +18,19 @@ class PumpingStation extends BaseDomain {
|
||||
static name = 'pumpingStation';
|
||||
|
||||
// Internal math runs in m3/s for flow and m for level so the volume
|
||||
// integrator (flow × dt) is unit-consistent. Strict canonicals make
|
||||
// unit drift in child-fed measurements an explicit error.
|
||||
// integrator (flow × dt) is unit-consistent — canonical stays m3/s, the
|
||||
// platform-wide convention every cross-node consumer (MGC demand math,
|
||||
// physics-sanity) assumes. Strict canonicals make unit drift in child-fed
|
||||
// measurements an explicit error.
|
||||
// Output flow / netFlowRate are emitted in m3/h so telemetry/dashboard
|
||||
// series land on the same axis as the rest of the pump group (verified
|
||||
// slice #47); the m3/s→m3/h presentation conversion happens at the output
|
||||
// boundary only — it never touches the canonical integrator basis.
|
||||
// overflowVolume / underflowVolume are listed in output so the
|
||||
// MeasurementContainer keeps the integrator's m³ unit on those streams
|
||||
// (FlowAggregator writes spill / underflow per tick).
|
||||
static unitPolicy = UnitPolicy.declare({
|
||||
canonical: { flow: 'm3/h', pressure: 'Pa', power: 'W', temperature: 'K' },
|
||||
canonical: { flow: 'm3/s', pressure: 'Pa', power: 'W', temperature: 'K' },
|
||||
output: {
|
||||
flow: 'm3/h', netFlowRate: 'm3/h', level: 'm', volume: 'm3',
|
||||
overflowVolume: 'm3', underflowVolume: 'm3',
|
||||
|
||||
Reference in New Issue
Block a user