fix(dashboard): use correct basin capacity for fill % + clamp to 0-100
Some checks failed
CI / lint-and-test (push) Has been cancelled
Some checks failed
CI / lint-and-test (push) Has been cancelled
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) <noreply@anthropic.com>
This commit is contained in:
@@ -612,8 +612,10 @@ def build_process_tab():
|
|||||||
"const qIn = find('flow.measured.upstream.') || find('flow.measured.in.');\n"
|
"const qIn = find('flow.measured.upstream.') || find('flow.measured.in.');\n"
|
||||||
"const qOut = find('flow.measured.downstream.') || find('flow.measured.out.');\n"
|
"const qOut = find('flow.measured.downstream.') || find('flow.measured.out.');\n"
|
||||||
"// Compute derived metrics\n"
|
"// Compute derived metrics\n"
|
||||||
"const maxVol = 9.33; // must match basinVolume * basinHeight / basinHeight = basinVolume / surfaceArea * height\n"
|
"// Basin capacity = basinVolume (config). Don't hardcode — read it once.\n"
|
||||||
"const fillPct = vol != null ? Math.round(Number(vol) / maxVol * 100) : null;\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 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 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"
|
"const timeStr = seconds != null ? (seconds > 60 ? Math.round(seconds/60) + ' min' : Math.round(seconds) + ' s') : 'n/a';\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user