upgrades
This commit is contained in:
@@ -318,16 +318,20 @@ class Monster{
|
|||||||
const flowRate = Number(this.q) || 0;
|
const flowRate = Number(this.q) || 0;
|
||||||
const m3PerPulse = Number(this.m3PerPuls) || 0;
|
const m3PerPulse = Number(this.m3PerPuls) || 0;
|
||||||
const pulseFraction = Number(this.temp_pulse) || 0;
|
const pulseFraction = Number(this.temp_pulse) || 0;
|
||||||
const targetVolumeM3 = Number(this.targetVolume) > 0 ? this.targetVolume / 1000 : 0;
|
const targetVolumeL = Number(this.targetVolume) > 0 ? this.targetVolume : 0;
|
||||||
|
const targetVolumeM3 = targetVolumeL > 0 ? targetVolumeL / 1000 : 0;
|
||||||
const flowToNextPulseM3 = m3PerPulse > 0 ? Math.max(0, (1 - pulseFraction) * m3PerPulse) : 0;
|
const flowToNextPulseM3 = m3PerPulse > 0 ? Math.max(0, (1 - pulseFraction) * m3PerPulse) : 0;
|
||||||
const timeToNextPulseSec = flowRate > 0 && flowToNextPulseM3 > 0
|
const timeToNextPulseSec = flowRate > 0 && flowToNextPulseM3 > 0
|
||||||
? Math.round((flowToNextPulseM3 / (flowRate / 3600)) * 100) / 100
|
? Math.round((flowToNextPulseM3 / (flowRate / 3600)) * 100) / 100
|
||||||
: 0;
|
: 0;
|
||||||
const targetProgressPct = targetVolumeM3 > 0
|
const targetProgressPct = targetVolumeL > 0
|
||||||
? Math.round((this.m3Total / targetVolumeM3) * 10000) / 100
|
? Math.round((this.bucketVol / targetVolumeL) * 10000) / 100
|
||||||
: 0;
|
: 0;
|
||||||
const targetDeltaM3 = targetVolumeM3 > 0
|
const targetDeltaL = targetVolumeL > 0
|
||||||
? Math.round((this.m3Total - targetVolumeM3) * 10000) / 10000
|
? Math.round((this.bucketVol - targetVolumeL) * 100) / 100
|
||||||
|
: 0;
|
||||||
|
const targetDeltaM3 = targetVolumeL > 0
|
||||||
|
? Math.round((targetDeltaL / 1000) * 10000) / 10000
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
output.pulse = this.pulse;
|
output.pulse = this.pulse;
|
||||||
@@ -359,6 +363,7 @@ class Monster{
|
|||||||
output.timeToNextPulseSec = timeToNextPulseSec;
|
output.timeToNextPulseSec = timeToNextPulseSec;
|
||||||
output.targetVolumeM3 = targetVolumeM3;
|
output.targetVolumeM3 = targetVolumeM3;
|
||||||
output.targetProgressPct = targetProgressPct;
|
output.targetProgressPct = targetProgressPct;
|
||||||
|
output.targetDeltaL = targetDeltaL;
|
||||||
output.targetDeltaM3 = targetDeltaM3;
|
output.targetDeltaM3 = targetDeltaM3;
|
||||||
output.predictedRateM3h = this.getPredictedFlowRate();
|
output.predictedRateM3h = this.getPredictedFlowRate();
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ test('output includes pulse and flow fields', () => {
|
|||||||
assert.ok(Object.prototype.hasOwnProperty.call(output, 'timeToNextPulseSec'));
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'timeToNextPulseSec'));
|
||||||
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetVolumeM3'));
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetVolumeM3'));
|
||||||
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetProgressPct'));
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetProgressPct'));
|
||||||
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaL'));
|
||||||
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'targetDeltaM3'));
|
||||||
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
|
assert.ok(Object.prototype.hasOwnProperty.call(output, 'predictedRateM3h'));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user