updates visual

This commit is contained in:
znetsixe
2025-11-03 09:17:22 +01:00
parent f243761f00
commit d44cbc978b
2 changed files with 10 additions and 6 deletions

View File

@@ -114,12 +114,12 @@ class nodeClass {
const vol = pickVariant('volume', ['measured', 'predicted'], 'atEquipment', 'm3');
const volPercent = pickVariant('volumePercent', ['measured','predicted'], 'atEquipment'); // already unitless
const level = pickVariant('level', ['measured', 'predicted'], 'atEquipment', 'm');
const netFlow = pickVariant('netFlowRate', ['measured', 'predicted'], 'atEquipment', 'm3/s');
const netFlow = pickVariant('netFlowRate', ['measured', 'predicted'], 'atEquipment', 'm3/h');
const maxVolBeforeOverflow = ps.basin?.maxVolOverflow ?? ps.basin?.maxVol ?? 0;
const currentVolume = vol.value ?? 0;
const currentvolPercent = volPercent.value ?? 0;
const netFlowM3h = (netFlow.value ?? 0) * 3600;
const netFlowM3h = netFlow.value ?? 0;
const direction = ps.state?.direction ?? 'unknown';
const secondsRemaining = ps.state?.seconds ?? null;
@@ -128,9 +128,9 @@ class nodeClass {
const badgePieces = [];
badgePieces.push(`${currentvolPercent.toFixed(1)}% `);
badgePieces.push(
`V=${currentVolume.toFixed(2)} / ${maxVolBeforeOverflow.toFixed(2)} (${'n/a'})`
`V=${currentVolume.toFixed(2)} / ${maxVolBeforeOverflow.toFixed(2)}`
);
badgePieces.push(`net=${netFlowM3h.toFixed(1)} m³/h (${'n/a'})`);
badgePieces.push(`net: ${netFlowM3h.toFixed(0)} m³/h`);
if (timeRemainingMinutes != null) {
badgePieces.push(`t≈${timeRemainingMinutes} min)`);
}

View File

@@ -12,6 +12,7 @@ class PumpingStation {
this.measurements = new MeasurementContainer({ autoConvert: true });
this.measurements.setPreferredUnit('flow', 'm3/s');
this.measurements.setPreferredUnit('netFlowRate', 'm3/s');
this.measurements.setPreferredUnit('level', 'm');
this.measurements.setPreferredUnit('volume', 'm3');
this.childRegistrationUtils = new childRegistrationUtils(this);
@@ -19,7 +20,6 @@ class PumpingStation {
this.stations = {};
//variants in determining what gets priority
this.flowVariants = ['measured', 'predicted'];
this.levelVariants = ['measured', 'predicted'];
@@ -64,7 +64,7 @@ class PumpingStation {
const netFlow = this._selectBestNetFlow(snapshot);
//write netflow in measurment container
//this.measurements()
const remaining = this._computeRemainingTime(snapshot, netFlow);
this.state = {
@@ -301,12 +301,16 @@ class PumpingStation {
_selectBestNetFlow(snapshot) {
for (const variant of this.flowVariants) {
const flow = snapshot.flows[variant];
if (!flow.inflow.exists && !flow.outflow.exists) continue;
const inflow = flow.inflow.current?.value ?? 0;
const outflow = flow.outflow.current?.value ?? 0;
const net = inflow - outflow; // positive => filling
this.measurements.type('netFlowRate').variant(variant).position('atequipment').value(net).unit('m3/s');
this.logger.debug(`inflow : ${inflow} - outflow : ${outflow}`);
return { value: net,source: variant,direction: this._deriveDirection(net) };
}