39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
const { childRegistrationUtils, logger } = require('generalFunctions');
|
|
|
|
|
|
class liquidFlowHandler {
|
|
constructor(config) {
|
|
this.config = config;
|
|
|
|
this.logger = new logger(this.config.general.logging.enabled, this.config.general.logging.logLevel, config.general.name);
|
|
this.reactors = Array(2);
|
|
this.machines = {};
|
|
this.debit = 0;
|
|
this.childRegistrationUtils = new childRegistrationUtils(this);
|
|
}
|
|
|
|
updateState(timeStamp) {
|
|
effluent = this.reactors[1].getEffluent();
|
|
effluent.payload.F = this.debit;
|
|
this.reactors[0].setInfluent = effluent;
|
|
}
|
|
|
|
handleChildChange() {
|
|
return;
|
|
}
|
|
|
|
handlePressureChange(machine) {
|
|
this.debit = machine.measurements.type("flow").variant("predicted").position("downstream").getCurrentValue();
|
|
}
|
|
|
|
getOutput() {
|
|
mainEffluent = this.reactors[1].getEffluent();
|
|
sideStream = structuredClone(mainEffluent);
|
|
mainEffluent.payload.F -= this.debit;
|
|
sideStream.payload.F = this.debit;
|
|
sideStream.payload.inlet = 1;
|
|
return {payload: [mainEffluent.payload, sideStream.payload]};
|
|
}
|
|
}
|
|
|
|
module.exports = { liquidFlowHandler }; |