bug fixes
This commit is contained in:
@@ -218,11 +218,11 @@ 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 injectedVol = isFinite(toFloat(msg.payload));
|
const injectedVol = parseFloat(msg.payload);
|
||||||
this.source.calibratePredictedVolume(injectedVol);
|
this.source.calibratePredictedVolume(injectedVol);
|
||||||
break;
|
break;
|
||||||
case 'calibratePredictedLevel':
|
case 'calibratePredictedLevel':
|
||||||
const injectedLevel = isFinite(toFloat(msg.payload));
|
const injectedLevel = parseFloat(msg.payload);
|
||||||
this.source.calibratePredictedLevel(injectedLevel);
|
this.source.calibratePredictedLevel(injectedLevel);
|
||||||
break;
|
break;
|
||||||
case 'q_in': {
|
case 'q_in': {
|
||||||
|
|||||||
@@ -137,23 +137,21 @@ class PumpingStation {
|
|||||||
/* --------------------------- Calibration --------------------------- */
|
/* --------------------------- Calibration --------------------------- */
|
||||||
|
|
||||||
calibratePredictedVolume(calibratedVol, timestamp = Date.now()) {
|
calibratePredictedVolume(calibratedVol, timestamp = Date.now()) {
|
||||||
const volumeChain = this.measurements.type('volume').variant('predicted').position('atequipment');
|
const volume = this.measurements.type('volume').variant('predicted').position('atequipment').get();
|
||||||
const levelChain = this.measurements.type('level').variant('predicted').position('atequipment');
|
const level = this.measurements.type('level').variant('predicted').position('atequipment').get();
|
||||||
|
|
||||||
const volumeMeasurement = volumeChain.exists() ? volumeChain.get() : null;
|
if (volume) {
|
||||||
if (volumeMeasurement) {
|
volume.values = [];
|
||||||
volumeMeasurement.values = [];
|
volume.timestamps = [];
|
||||||
volumeMeasurement.timestamps = [];
|
}
|
||||||
|
|
||||||
|
if (level) {
|
||||||
|
level.values = [];
|
||||||
|
level.timestamps = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const levelMeasurement = levelChain.exists() ? levelChain.get() : null;
|
this.measurements.type('volume').variant('predicted').position('atequipment').value(calibratedVol, timestamp, 'm3').unit('m3');
|
||||||
if (levelMeasurement) {
|
this.measurements.type('level').variant('predicted').position('atequipment').value(this._calcLevelFromVolume(calibratedVol), timestamp, 'm');
|
||||||
levelMeasurement.values = [];
|
|
||||||
levelMeasurement.timestamps = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
volumeChain.value(calibratedVol, timestamp, 'm3').unit('m3');
|
|
||||||
levelChain.value(this._calcLevelFromVolume(calibratedVol), timestamp, 'm');
|
|
||||||
|
|
||||||
this._predictedFlowState = { inflow: 0, outflow: 0, lastTimestamp: timestamp };
|
this._predictedFlowState = { inflow: 0, outflow: 0, lastTimestamp: timestamp };
|
||||||
}
|
}
|
||||||
@@ -373,6 +371,7 @@ class PumpingStation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//scaled for robin min 2039 - 2960 max 53.04
|
||||||
_scaleLevelToFlowPercent(level) {
|
_scaleLevelToFlowPercent(level) {
|
||||||
const { minFlowLevel, maxFlowLevel } = this.config.control.levelbased;
|
const { minFlowLevel, maxFlowLevel } = this.config.control.levelbased;
|
||||||
this.logger.debug(`Scaling minflow level : ${minFlowLevel} and maxflowLevel : ${maxFlowLevel}`);
|
this.logger.debug(`Scaling minflow level : ${minFlowLevel} and maxflowLevel : ${maxFlowLevel}`);
|
||||||
@@ -628,7 +627,7 @@ module.exports = PumpingStation;
|
|||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/* Example usage */
|
/* Example usage */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
/*
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
const Measurement = require('../../measurement/src/specificClass');
|
const Measurement = require('../../measurement/src/specificClass');
|
||||||
const RotatingMachine = require('../../rotatingMachine/src/specificClass');
|
const RotatingMachine = require('../../rotatingMachine/src/specificClass');
|
||||||
@@ -786,7 +785,7 @@ if (require.main === module) {
|
|||||||
|
|
||||||
console.log('Initial state:', station.state);
|
console.log('Initial state:', station.state);
|
||||||
station.setManualInflow(300,Date.now(),'l/s');
|
station.setManualInflow(300,Date.now(),'l/s');
|
||||||
|
station.calibratePredictedVolume(3.4);
|
||||||
//await pump1.handleInput('parent', 'execSequence', 'startup');
|
//await pump1.handleInput('parent', 'execSequence', 'startup');
|
||||||
//await pump1.handleInput('parent', 'execMovement', 10);
|
//await pump1.handleInput('parent', 'execMovement', 10);
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user