Compare commits
1 Commits
6e89e4916f
...
2c7fe1792f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c7fe1792f |
@@ -88,9 +88,14 @@ exports.setOutflow = (source, msg) => {
|
|||||||
|
|
||||||
exports.setDemand = (source, msg, ctx) => {
|
exports.setDemand = (source, msg, ctx) => {
|
||||||
const log = _logger(source, ctx);
|
const log = _logger(source, ctx);
|
||||||
const demand = Number(msg.payload);
|
// generalFunctions/commandRegistry's _normaliseUnits has already converted
|
||||||
|
// msg.payload to m3/h (the descriptor's units.default — see
|
||||||
|
// commands/index.js). Accepts {value, unit} objects upstream; we just read
|
||||||
|
// the normalized number here. _manualDemand is stored in m3/h, no further
|
||||||
|
// conversion needed.
|
||||||
|
const demand = Number(msg?.payload);
|
||||||
if (!Number.isFinite(demand)) {
|
if (!Number.isFinite(demand)) {
|
||||||
log?.warn?.(`set.demand: invalid Qd value '${msg.payload}'`);
|
log?.warn?.(`set.demand: invalid Qd value '${JSON.stringify(msg?.payload)}'`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (source.mode !== 'manual') {
|
if (source.mode !== 'manual') {
|
||||||
|
|||||||
Reference in New Issue
Block a user