Refactor flow handling: rename reactor references to source and sink and fix config minor bug

This commit is contained in:
2025-11-06 14:50:40 +01:00
parent 303dfc477d
commit b6d268659a
3 changed files with 12 additions and 11 deletions

View File

@@ -24,8 +24,8 @@
warmup: { value: 0 }, warmup: { value: 0 },
shutdown: { value: 0 }, shutdown: { value: 0 },
cooldown: { value: 0 }, cooldown: { value: 0 },
machineCurve : { value: {}}, machineCurve: { value: {}},
flowNumber : { value: 1, required: true }, flowNumber: { value: 1, required: true },
//define asset properties //define asset properties
uuid: { value: "" }, uuid: { value: "" },

View File

@@ -63,7 +63,8 @@ class nodeClass {
}, },
functionality: { functionality: {
positionVsParent: uiConfig.positionVsParent positionVsParent: uiConfig.positionVsParent
} },
flowNumber: uiConfig.flowNumber
}; };
// Utility for formatting outputs // Utility for formatting outputs

View File

@@ -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. // used for holding the source and sink unit operations or other object with setInfluent / getEffluent method for e.g. recirculation.
this.upstreamReactor = null; this.upstreamSource = null;
this.downstreamReactor = null; this.downstreamSink = null;
this.child = {}; // object to hold child information so we know on what to subscribe this.child = {}; // object to hold child information so we know on what to subscribe
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
@@ -93,7 +93,6 @@ class Machine {
this.logger.debug(`Registering reactor child...`); this.logger.debug(`Registering reactor child...`);
this._connectReactor(child); this._connectReactor(child);
break; break;
default: default:
this.logger.error(`Unrecognized softwareType: ${softwareType}`); this.logger.error(`Unrecognized softwareType: ${softwareType}`);
} }
@@ -137,7 +136,7 @@ class Machine {
} }
_connectReactor(reactorChild) { _connectReactor(reactorChild) {
this.downstreamReactor = reactorChild; // downstream from the pumps perpective this.downstreamSink = reactorChild; // downstream from the pumps perpective
} }
//---------------- END child stuff -------------// //---------------- END child stuff -------------//
@@ -509,8 +508,8 @@ class Machine {
this.logger.debug(`Flow update: ${value} at ${position} from ${context.childName || 'child'}`); this.logger.debug(`Flow update: ${value} at ${position} from ${context.childName || 'child'}`);
if (this.upstreamReactor && this.downstreamReactor){ if (this.upstreamSource && this.downstreamSink) {
this._updateConnectedReactor(); this._updateSourceSink();
} }
// Store in parent's measurement container // Store in parent's measurement container
@@ -522,9 +521,10 @@ class Machine {
} }
} }
_updateConnectedReactor() { _updateSourceSink() {
// Handles flow according to the configured "flow number" // 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 // Helper method for operational state check