hydraulic efficiency η = (Q·ΔP)/P + asset registry rename
The pre-existing efficiency formula `η = flow/power` produced tiny SI-unit
values (m³/J ≈ 1e-5), was monotonic in ctrl for centrifugal-pump curves
(no interior peak), and made NCog collapse to 0 — which cascaded into MGC
reporting BEP-position 0.0% always. Replaced with hydraulic efficiency
η = (Q·ΔP)/P_shaft, the dimensionless 0..1 ratio that has a real BEP and
matches the form MGC's group-level math uses.
- prediction/efficiencyMath.js:
* calcEfficiencyCurve takes pressureDiffPa; η = 0 when dP missing
* calcCog guards (yMax > yMin) before computing NCog (was unguarded /0)
* calcEfficiency falls back to predictFlow.currentF when measured ΔP is
missing, so predicted-variant calls still produce a meaningful η before
the differential measurement settles
- specificClass.js:
* Asset-registry lookup renamed: 'machine' → 'rotatingmachine' (matches
the datasets/assetData/ rename in generalFunctions). The error path
quotes the new filename so operators can find it.
* Two-call-site fix: with default-param stateConfig={}, the single-arg
constructor path (BaseNodeAdapter calls `new Machine(this.config)`
after pre-setting Machine._pendingExtras) was silently clobbering the
pre-set extras. Only overwrite when the caller explicitly passes them.
* Push port 0 deltas (notifyOutputChanged) after prediction updates so
dashboards see state + predicted-flow changes as they happen.
- pressure/pressureRouter.js: routing + fallback hardening (the trigger
for the bep-distance-cascade reproduction).
- display/workingCurves.js: Q-H curve generator extended.
- New tests:
* test/integration/qh-curve.integration.test.js — Q-H curve shape
* test/integration/bep-distance-cascade.integration.test.js — reproduces
the dashboard report (absDistFromPeak=0, NCog=0, efficiency=0 after a
setpoint move) at the unit level so future regressions fail loudly.
Full suite: 214/214 pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const nameOfNode = 'rotatingMachine';
|
||||
const nodeClass = require('./src/nodeClass.js');
|
||||
const { MenuManager, configManager } = require('generalFunctions');
|
||||
const { buildQHCurve } = require('./src/display/workingCurves');
|
||||
|
||||
module.exports = function(RED) {
|
||||
// 1) Register the node type and delegate to your class
|
||||
@@ -32,4 +33,20 @@ module.exports = function(RED) {
|
||||
res.status(500).send(`// Error generating configData: ${err.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Q-H curve sampler — served on RED.httpNode (the dashboard/runtime
|
||||
// router) so dashboard function nodes can fetch without admin auth.
|
||||
// GET /rotatingMachine/:id/qh-curve?ctrl=<percent>
|
||||
// Returns { ctrlPct, points: [{ Q (m³/h), H (m), dpPa }, ...] }
|
||||
RED.httpNode.get(`/${nameOfNode}/:id/qh-curve`, (req, res) => {
|
||||
const node = RED.nodes.getNode(req.params.id);
|
||||
const source = node?.source;
|
||||
if (!source) {
|
||||
res.status(404).json({ error: `No rotatingMachine with id ${req.params.id}` });
|
||||
return;
|
||||
}
|
||||
const ctrl = Number(req.query.ctrl);
|
||||
const result = buildQHCurve(source, Number.isFinite(ctrl) ? ctrl : source.state?.getCurrentPosition?.() ?? 0);
|
||||
res.json(result);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user