Add support for multiple reactor types (CSTR and PFR) with corresponding properties (Dichelet BC for now)
This commit is contained in:
@@ -7,26 +7,60 @@ module.exports = function(RED) {
|
||||
|
||||
const Reactor = require('./dependencies/reactor_class');
|
||||
|
||||
const reactor = new Reactor(
|
||||
parseFloat(config.volume),
|
||||
parseInt(config.n_inlets),
|
||||
parseFloat(config.kla),
|
||||
[
|
||||
parseFloat(config.S_O_init),
|
||||
parseFloat(config.S_I_init),
|
||||
parseFloat(config.S_S_init),
|
||||
parseFloat(config.S_NH_init),
|
||||
parseFloat(config.S_N2_init),
|
||||
parseFloat(config.S_NO_init),
|
||||
parseFloat(config.S_HCO_init),
|
||||
parseFloat(config.X_I_init),
|
||||
parseFloat(config.X_S_init),
|
||||
parseFloat(config.X_H_init),
|
||||
parseFloat(config.X_STO_init),
|
||||
parseFloat(config.X_A_init),
|
||||
parseFloat(config.X_TS_init)
|
||||
]
|
||||
);
|
||||
let new_reactor;
|
||||
|
||||
switch (config.reactor_type) {
|
||||
case "CSTR":
|
||||
new_reactor = new Reactor(
|
||||
parseFloat(config.volume),
|
||||
parseInt(config.n_inlets),
|
||||
parseFloat(config.kla),
|
||||
[
|
||||
parseFloat(config.S_O_init),
|
||||
parseFloat(config.S_I_init),
|
||||
parseFloat(config.S_S_init),
|
||||
parseFloat(config.S_NH_init),
|
||||
parseFloat(config.S_N2_init),
|
||||
parseFloat(config.S_NO_init),
|
||||
parseFloat(config.S_HCO_init),
|
||||
parseFloat(config.X_I_init),
|
||||
parseFloat(config.X_S_init),
|
||||
parseFloat(config.X_H_init),
|
||||
parseFloat(config.X_STO_init),
|
||||
parseFloat(config.X_A_init),
|
||||
parseFloat(config.X_TS_init)
|
||||
]
|
||||
);
|
||||
break;
|
||||
case "PFR":
|
||||
new_reactor = new Reactor(
|
||||
parseFloat(config.volume),
|
||||
parseFloat(config.L),
|
||||
parseInt(config.resolution_L),
|
||||
parseInt(config.n_inlets),
|
||||
parseFloat(config.kla),
|
||||
[
|
||||
parseFloat(config.S_O_init),
|
||||
parseFloat(config.S_I_init),
|
||||
parseFloat(config.S_S_init),
|
||||
parseFloat(config.S_NH_init),
|
||||
parseFloat(config.S_N2_init),
|
||||
parseFloat(config.S_NO_init),
|
||||
parseFloat(config.S_HCO_init),
|
||||
parseFloat(config.X_I_init),
|
||||
parseFloat(config.X_S_init),
|
||||
parseFloat(config.X_H_init),
|
||||
parseFloat(config.X_STO_init),
|
||||
parseFloat(config.X_A_init),
|
||||
parseFloat(config.X_TS_init)
|
||||
]
|
||||
);
|
||||
break;
|
||||
default:
|
||||
console.warn("Unknown reactor type: " + config.reactor_type);
|
||||
}
|
||||
|
||||
const reactor = new_reactor; // protect from reassignment
|
||||
|
||||
node.on('input', function(msg, send, done) {
|
||||
let toggleUpdate = false;
|
||||
|
||||
Reference in New Issue
Block a user