- Update all submodule URLs from gitea.centraal.wbd-rd.nl to gitea.wbd-rd.nl - Add settler as proper submodule in .gitmodules - Add agent skills, function anchors, decisions, and improvements - Add Docker configuration and scripts - Add manuals and third_party docs - Update .gitignore with secrets and build artifacts - Remove stale .tgz build artifact Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
73 lines
2.9 KiB
JavaScript
73 lines
2.9 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Fix downstream pressure simulator ranges and add a monitoring debug node.
|
|
*
|
|
* Problems found:
|
|
* 1. Downstream pressure simulator range 0-5000 mbar is unrealistic.
|
|
* Real WWTP system backpressure: 800-1500 mbar (0.8-1.5 bar).
|
|
* The pump curve operates in 700-3900 mbar. With upstream ~300 mbar
|
|
* (hydrostatic from 3m basin) and downstream at 5000 mbar, the
|
|
* pressure differential pushes the curve to extreme predictions.
|
|
*
|
|
* 2. No way to see runtime state visually. We'll leave visual monitoring
|
|
* to the Grafana/dashboard layer, but fix the root cause here.
|
|
*
|
|
* Fix: Set downstream pressure simulators to realistic ranges:
|
|
* - West: o_min=800, o_max=1500, i_min=800, i_max=1500
|
|
* - North: o_min=600, o_max=1200, i_min=600, i_max=1200
|
|
* - South: o_min=500, o_max=1000, i_min=500, i_max=1000
|
|
*
|
|
* This keeps pressure differential in ~500-1200 mbar range,
|
|
* well within the pump curve (700-3900 mbar).
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const flowPath = path.join(__dirname, '..', 'docker', 'demo-flow.json');
|
|
const flow = JSON.parse(fs.readFileSync(flowPath, 'utf8'));
|
|
|
|
let changes = 0;
|
|
|
|
// Fix downstream pressure simulator ranges
|
|
const pressureFixes = {
|
|
'demo_meas_pt_w_down': { i_min: 800, i_max: 1500, o_min: 800, o_max: 1500 },
|
|
'demo_meas_pt_n_down': { i_min: 600, i_max: 1200, o_min: 600, o_max: 1200 },
|
|
'demo_meas_pt_s_down': { i_min: 500, i_max: 1000, o_min: 500, o_max: 1000 },
|
|
};
|
|
|
|
flow.forEach(node => {
|
|
const fix = pressureFixes[node.id];
|
|
if (fix) {
|
|
const old = { i_min: node.i_min, i_max: node.i_max, o_min: node.o_min, o_max: node.o_max };
|
|
Object.assign(node, fix);
|
|
console.log(`Fixed ${node.id} "${node.name}":`);
|
|
console.log(` Was: i=[${old.i_min},${old.i_max}] o=[${old.o_min},${old.o_max}]`);
|
|
console.log(` Now: i=[${fix.i_min},${fix.i_max}] o=[${fix.o_min},${fix.o_max}]`);
|
|
changes++;
|
|
}
|
|
});
|
|
|
|
// Also fix upstream pressure ranges to match realistic hydrostatic range
|
|
// Basin level 0-4m → hydrostatic 0-392 mbar → use 0-500 mbar range
|
|
const upstreamFixes = {
|
|
'demo_meas_pt_w_up': { i_min: 0, i_max: 500, o_min: 0, o_max: 500 },
|
|
'demo_meas_pt_n_up': { i_min: 0, i_max: 400, o_min: 0, o_max: 400 },
|
|
'demo_meas_pt_s_up': { i_min: 0, i_max: 300, o_min: 0, o_max: 300 },
|
|
};
|
|
|
|
flow.forEach(node => {
|
|
const fix = upstreamFixes[node.id];
|
|
if (fix) {
|
|
const old = { i_min: node.i_min, i_max: node.i_max, o_min: node.o_min, o_max: node.o_max };
|
|
Object.assign(node, fix);
|
|
console.log(`Fixed ${node.id} "${node.name}":`);
|
|
console.log(` Was: i=[${old.i_min},${old.i_max}] o=[${old.o_min},${old.o_max}]`);
|
|
console.log(` Now: i=[${fix.i_min},${fix.i_max}] o=[${fix.o_min},${fix.o_max}]`);
|
|
changes++;
|
|
}
|
|
});
|
|
|
|
fs.writeFileSync(flowPath, JSON.stringify(flow, null, 2) + '\n');
|
|
console.log(`\nDone. ${changes} node(s) updated.`);
|