diff --git a/src/nodeClass.js b/src/nodeClass.js index d0e82b6..17aa9a0 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -218,12 +218,12 @@ class nodeClass { this.source.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent); break; case 'calibratePredictedVolume': - const calibratedVolume = this.source.measurements - .type('volume') - .variant('measured') - .position('atequipment') - .getCurrentValue('m3'); - this.source.calibratePredictedVolume(calibratedVolume); + const injectedVol = isFinite(toFloat(msg.payload)); + this.source.calibratePredictedVolume(injectedVol); + break; + case 'calibratePredictedLevel': + const injectedLevel = isFinite(toFloat(msg.payload)); + this.source.calibratePredictedLevel(injectedLevel); break; case 'q_in': { // payload can be number or { value, unit, timestamp } diff --git a/src/specificClass.js b/src/specificClass.js index ed4372b..d59a12f 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -212,6 +212,19 @@ class PumpingStation { ); } + changeMode(newMode){ + if ( this.config.control.allowedModes.has(newMode) ){ + const currentMode = this.mode; + this.logger.info(`Control mode changing from ${currentMode} to ${newMode}`); + this.mode = newMode; + } + else{ + this.logger.warn(`Attempted to change to unsupported control mode: ${newMode}`); + } + + } + + _controlLogic(direction) { switch (this.mode) { case 'levelbased':