Compare commits
2 Commits
a47aa53d17
...
ddf2b07424
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddf2b07424 | ||
|
|
c982c9bef7 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { BaseDomain, UnitPolicy, POSITIONS, interpolation, convert } = require('generalFunctions');
|
const { BaseDomain, UnitPolicy, POSITIONS, interpolation } = require('generalFunctions');
|
||||||
const GroupOperatingPoint = require('./groupOps/groupOperatingPoint');
|
const GroupOperatingPoint = require('./groupOps/groupOperatingPoint');
|
||||||
const groupCurves = require('./groupOps/groupCurves');
|
const groupCurves = require('./groupOps/groupCurves');
|
||||||
const TotalsCalculator = require('./totals/totalsCalculator');
|
const TotalsCalculator = require('./totals/totalsCalculator');
|
||||||
@@ -383,7 +383,7 @@ class MachineGroup extends BaseDomain {
|
|||||||
v, 0, 100, dt.flow.min, dt.flow.max);
|
v, 0, 100, dt.flow.min, dt.flow.max);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
canonical = convert(v).from(unit).to('m3/s');
|
canonical = this.unitPolicy.convert(v, unit, 'm3/s', 'setDemand absolute flow');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger?.error?.(`setDemand: cannot convert ${v} ${unit} -> m3/s: ${err?.message || err}`);
|
this.logger?.error?.(`setDemand: cannot convert ${v} ${unit} -> m3/s: ${err?.message || err}`);
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -446,10 +446,12 @@ class MachineGroup extends BaseDomain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_canonicalToOutputFlow(value) {
|
_canonicalToOutputFlow(value) {
|
||||||
const from = this.unitPolicy.canonical.flow;
|
return this.unitPolicy.convert(
|
||||||
const to = this.unitPolicy.output.flow;
|
value,
|
||||||
if (!from || !to || from === to) return value;
|
this.unitPolicy.canonical.flow,
|
||||||
return convert(value).from(from).to(to);
|
this.unitPolicy.output.flow,
|
||||||
|
'canonical->output flow',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOutput() { return io.getOutput(this); }
|
getOutput() { return io.getOutput(this); }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const assert = require('node:assert/strict');
|
|||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
const flow = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../examples/basic.flow.json'), 'utf8'));
|
const flow = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../examples/02-Dashboard.json'), 'utf8'));
|
||||||
|
|
||||||
test('basic example includes node type machineGroupControl', () => {
|
test('basic example includes node type machineGroupControl', () => {
|
||||||
const count = flow.filter((n) => n && n.type === 'machineGroupControl').length;
|
const count = flow.filter((n) => n && n.type === 'machineGroupControl').length;
|
||||||
|
|||||||
Reference in New Issue
Block a user