forked from RnD/pumpingStation
updates visual
This commit is contained in:
@@ -12,12 +12,12 @@ 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);
|
||||
this.machines = {};
|
||||
this.stations = {};
|
||||
|
||||
|
||||
|
||||
//variants in determining what gets priority
|
||||
@@ -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) };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user