|
|
|
@@ -5,11 +5,11 @@
|
|
|
|
// msg: the Node-RED input message.
|
|
|
|
// msg: the Node-RED input message.
|
|
|
|
// ctx: { node, RED, send, logger } — provided by BaseNodeAdapter.
|
|
|
|
// ctx: { node, RED, send, logger } — provided by BaseNodeAdapter.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Settler currently accepts no behavioural commands — the legacy
|
|
|
|
// Settler accepts `child.register` (alias `registerChild`) on Port 0 input
|
|
|
|
// `registerChild` topic is handled by the BaseNodeAdapter input dispatch
|
|
|
|
// to register measurement / reactor children, plus `data.influent` for
|
|
|
|
// via the generalFunctions registry (`child.register` canonical) and the
|
|
|
|
// manual override. BaseNodeAdapter dispatches msg.topic through the
|
|
|
|
// node never had a public set/cmd surface beyond that. Future
|
|
|
|
// per-node registry — there is no implicit `child.register` handler in
|
|
|
|
// influent-injection or operator-override topics will land here.
|
|
|
|
// the base, so it must be listed explicitly here.
|
|
|
|
|
|
|
|
|
|
|
|
function _logger(source, ctx) {
|
|
|
|
function _logger(source, ctx) {
|
|
|
|
return ctx?.logger || source?.logger || null;
|
|
|
|
return ctx?.logger || source?.logger || null;
|
|
|
|
@@ -30,3 +30,16 @@ exports.dataInfluent = (source, msg, ctx) => {
|
|
|
|
if (Array.isArray(p.C)) source.Cs_in = [...p.C];
|
|
|
|
if (Array.isArray(p.C)) source.Cs_in = [...p.C];
|
|
|
|
source.notifyOutputChanged();
|
|
|
|
source.notifyOutputChanged();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Inbound child registration from a measurement (or reactor) child.
|
|
|
|
|
|
|
|
// Ported from the legacy `case 'registerChild'` branch in nodeClass.
|
|
|
|
|
|
|
|
exports.childRegister = (source, msg, ctx) => {
|
|
|
|
|
|
|
|
const log = _logger(source, ctx);
|
|
|
|
|
|
|
|
const childId = msg.payload;
|
|
|
|
|
|
|
|
const childObj = ctx?.RED?.nodes?.getNode?.(childId);
|
|
|
|
|
|
|
|
if (!childObj?.source) {
|
|
|
|
|
|
|
|
log?.warn?.(`child.register skipped: missing child/source for id=${childId}`);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent, msg.distance);
|
|
|
|
|
|
|
|
};
|
|
|
|
|