fixed change mode and control logic method
This commit is contained in:
@@ -218,12 +218,12 @@ class nodeClass {
|
|||||||
this.source.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
this.source.childRegistrationUtils.registerChild(childObj.source ,msg.positionVsParent);
|
||||||
break;
|
break;
|
||||||
case 'calibratePredictedVolume':
|
case 'calibratePredictedVolume':
|
||||||
const calibratedVolume = this.source.measurements
|
const injectedVol = isFinite(toFloat(msg.payload));
|
||||||
.type('volume')
|
this.source.calibratePredictedVolume(injectedVol);
|
||||||
.variant('measured')
|
break;
|
||||||
.position('atequipment')
|
case 'calibratePredictedLevel':
|
||||||
.getCurrentValue('m3');
|
const injectedLevel = isFinite(toFloat(msg.payload));
|
||||||
this.source.calibratePredictedVolume(calibratedVolume);
|
this.source.calibratePredictedLevel(injectedLevel);
|
||||||
break;
|
break;
|
||||||
case 'q_in': {
|
case 'q_in': {
|
||||||
// payload can be number or { value, unit, timestamp }
|
// payload can be number or { value, unit, timestamp }
|
||||||
|
|||||||
@@ -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) {
|
_controlLogic(direction) {
|
||||||
switch (this.mode) {
|
switch (this.mode) {
|
||||||
case 'levelbased':
|
case 'levelbased':
|
||||||
|
|||||||
Reference in New Issue
Block a user