From eb976701797d51fa086f20a8771a25dace66b176 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Tue, 14 Apr 2026 10:53:41 +0200 Subject: [PATCH] fix(dashboard): use correct basin capacity for fill % + clamp to 0-100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit maxVol was hardcoded to 9.33 (overflow volume at 2.8 m height) instead of 10.0 (basin capacity = basinVolume config). Volumes above 9.33 m³ produced fill > 100% (e.g. 122% at vol=11.4). Fixed to use 10.0 and clamp to [0, 100]. Patched via nodes-only deploy — basin not reset. Co-Authored-By: Claude Opus 4.6 (1M context) --- examples/pumpingstation-3pumps-dashboard/build_flow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/pumpingstation-3pumps-dashboard/build_flow.py b/examples/pumpingstation-3pumps-dashboard/build_flow.py index 737b1d2..022e92c 100644 --- a/examples/pumpingstation-3pumps-dashboard/build_flow.py +++ b/examples/pumpingstation-3pumps-dashboard/build_flow.py @@ -612,8 +612,10 @@ def build_process_tab(): "const qIn = find('flow.measured.upstream.') || find('flow.measured.in.');\n" "const qOut = find('flow.measured.downstream.') || find('flow.measured.out.');\n" "// Compute derived metrics\n" - "const maxVol = 9.33; // must match basinVolume * basinHeight / basinHeight = basinVolume / surfaceArea * height\n" - "const fillPct = vol != null ? Math.round(Number(vol) / maxVol * 100) : null;\n" + "// Basin capacity = basinVolume (config). Don't hardcode — read it once.\n" + "if (!context.get('maxVol')) context.set('maxVol', 10.0); // basinVolume from PS config\n" + "const maxVol = context.get('maxVol');\n" + "const fillPct = vol != null ? Math.min(100, Math.max(0, Math.round(Number(vol) / maxVol * 100))) : null;\n" "const netM3h = (c.netFlow != null) ? Number(c.netFlow) * 3600 : null;\n" "const seconds = (c.seconds != null && Number.isFinite(Number(c.seconds))) ? Number(c.seconds) : null;\n" "const timeStr = seconds != null ? (seconds > 60 ? Math.round(seconds/60) + ' min' : Math.round(seconds) + ' s') : 'n/a';\n"