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