From b6d268659a9d2d5b9e42dd922c24eaf63f80321a Mon Sep 17 00:00:00 2001
From: "p.vanderwilt"
Date: Thu, 6 Nov 2025 14:50:40 +0100
Subject: [PATCH] Refactor flow handling: rename reactor references to source
and sink and fix config minor bug
---
rotatingMachine.html | 4 ++--
src/nodeClass.js | 3 ++-
src/specificClass.js | 16 ++++++++--------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/rotatingMachine.html b/rotatingMachine.html
index e2a0a69..93473b4 100644
--- a/rotatingMachine.html
+++ b/rotatingMachine.html
@@ -24,8 +24,8 @@
warmup: { value: 0 },
shutdown: { value: 0 },
cooldown: { value: 0 },
- machineCurve : { value: {}},
- flowNumber : { value: 1, required: true },
+ machineCurve: { value: {}},
+ flowNumber: { value: 1, required: true },
//define asset properties
uuid: { value: "" },
diff --git a/src/nodeClass.js b/src/nodeClass.js
index 6d20326..7bb504e 100644
--- a/src/nodeClass.js
+++ b/src/nodeClass.js
@@ -63,7 +63,8 @@ class nodeClass {
},
functionality: {
positionVsParent: uiConfig.positionVsParent
- }
+ },
+ flowNumber: uiConfig.flowNumber
};
// Utility for formatting outputs
diff --git a/src/specificClass.js b/src/specificClass.js
index 1579611..55a4b32 100644
--- a/src/specificClass.js
+++ b/src/specificClass.js
@@ -69,8 +69,8 @@ class Machine {
});
// used for holding the source and sink unit operations or other object with setInfluent / getEffluent method for e.g. recirculation.
- this.upstreamReactor = null;
- this.downstreamReactor = null;
+ this.upstreamSource = null;
+ this.downstreamSink = null;
this.child = {}; // object to hold child information so we know on what to subscribe
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
@@ -93,7 +93,6 @@ class Machine {
this.logger.debug(`Registering reactor child...`);
this._connectReactor(child);
break;
-
default:
this.logger.error(`Unrecognized softwareType: ${softwareType}`);
}
@@ -137,7 +136,7 @@ class Machine {
}
_connectReactor(reactorChild) {
- this.downstreamReactor = reactorChild; // downstream from the pumps perpective
+ this.downstreamSink = reactorChild; // downstream from the pumps perpective
}
//---------------- END child stuff -------------//
@@ -509,8 +508,8 @@ class Machine {
this.logger.debug(`Flow update: ${value} at ${position} from ${context.childName || 'child'}`);
- if (this.upstreamReactor && this.downstreamReactor){
- this._updateConnectedReactor();
+ if (this.upstreamSource && this.downstreamSink) {
+ this._updateSourceSink();
}
// Store in parent's measurement container
@@ -522,9 +521,10 @@ class Machine {
}
}
- _updateConnectedReactor() {
+ _updateSourceSink() {
// Handles flow according to the configured "flow number"
- this.downstreamReactor.setInfluent = this.upstreamReactor.getEffluent[this.config.flowNumber];
+ this.logger.debug(`Updating source-sink pair: ${this.upstreamSource.config.functionality.softwareType} - ${this.downstreamSink.config.functionality.softwareType}`);
+ this.downstreamSink.setInfluent = this.upstreamSource.getEffluent[this.config.flowNumber];
}
// Helper method for operational state check