Refactor, minor changes and remove depreciated functions
This commit is contained in:
15
reactor.html
15
reactor.html
@@ -2,7 +2,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType("reactor", {
|
||||
category: "WWTP",
|
||||
category: "EVOLV",
|
||||
color: "#c4cce0",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
@@ -10,7 +10,6 @@
|
||||
volume: { value: 0., required: true },
|
||||
length: { value: 0.},
|
||||
resolution_L: { value: 0.},
|
||||
alpha: {value: 0},
|
||||
kla: { value: null },
|
||||
|
||||
S_O_init: { value: 0., required: true },
|
||||
@@ -92,10 +91,6 @@
|
||||
$(".PFR").show();
|
||||
}
|
||||
});
|
||||
$("#node-input-alpha").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
})
|
||||
$("#node-input-timeStep").typedInput({
|
||||
type:"num",
|
||||
types:["num"]
|
||||
@@ -149,13 +144,6 @@
|
||||
<label for="node-input-resolution_L"><i class="fa fa-tag"></i> Resolution</label>
|
||||
<input type="text" id="node-input-resolution_L" placeholder="#">
|
||||
</div>
|
||||
<div class="PFR">
|
||||
<p> Inlet boundary condition parameter α (α = 0: Danckwerts BC / α = 1: Dirichlet BC) </p>
|
||||
<div class="form-row">
|
||||
<label for="node-input-alpha"><i class="fa fa-tag"></i>Adjustable parameter BC</label>
|
||||
<input type="text" id="node-input-alpha">
|
||||
</div>
|
||||
</div>
|
||||
<h3> Internal mass transfer calculation (optional) </h3>
|
||||
<div class="form-row">
|
||||
<label for="node-input-kla"><i class="fa fa-tag"></i> kLa [d-1]</label>
|
||||
@@ -227,7 +215,6 @@
|
||||
<!-- Position fields will be injected here -->
|
||||
<div id="position-fields-placeholder"></div>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="reactor">
|
||||
|
||||
@@ -87,7 +87,6 @@ class nodeClass {
|
||||
volume: parseFloat(uiConfig.volume),
|
||||
length: parseFloat(uiConfig.length),
|
||||
resolution_L: parseInt(uiConfig.resolution_L),
|
||||
alpha: parseFloat(uiConfig.alpha),
|
||||
kla: parseFloat(uiConfig.kla),
|
||||
initialState: [
|
||||
parseFloat(uiConfig.S_O_init),
|
||||
|
||||
@@ -25,7 +25,6 @@ class Reactor {
|
||||
this.logger = new logger(this.config.general.logging.enabled, this.config.general.logging.logLevel, config.general.name);
|
||||
this.emitter = new EventEmitter();
|
||||
this.measurements = new MeasurementContainer();
|
||||
this.upstreamReactor = null;
|
||||
this.childRegistrationUtils = new childRegistrationUtils(this); // Child registration utility
|
||||
|
||||
this.upstreamReactor = null;
|
||||
@@ -74,9 +73,9 @@ class Reactor {
|
||||
|
||||
/**
|
||||
* Getter for effluent data.
|
||||
* @returns {object} Effluent data object (msg), defaults to inlet 0.
|
||||
* @returns {object} Effluent data object (msg).
|
||||
*/
|
||||
get getEffluent() { // getter for Effluent, defaults to inlet 0
|
||||
get getEffluent() {
|
||||
const Cs = isArray(this.state.at(-1)) ? this.state.at(-1) : this.state;
|
||||
const effluent = [{ topic: "Fluent", payload: { inlet: 0, F: math.sum(this.Fs), C: Cs }, timestamp: this.currentTime }];
|
||||
if (this.returnPump) {
|
||||
@@ -268,8 +267,6 @@ class Reactor_PFR extends Reactor {
|
||||
this.d_x = this.length / this.n_x;
|
||||
this.A = this.volume / this.length; // crosssectional area [m2]
|
||||
|
||||
this.alpha = config.alpha;
|
||||
|
||||
this.state = Array.from(Array(this.n_x), () => config.initialState.slice());
|
||||
this.extendedState = Array.from(Array(this.n_x + 2*BC_PADDING), () => new Array(ASM_CONSTANTS.NUM_SPECIES).fill(0));
|
||||
|
||||
@@ -375,7 +372,7 @@ class Reactor_PFR extends Reactor {
|
||||
} else {
|
||||
if (math.sum(this.Fs) > 0) { // Danckwerts BC
|
||||
const BC_C_in = math.multiply(1 / math.sum(this.Fs), [this.Fs], this.Cs_in)[0];
|
||||
const BC_dispersion_term = (1-this.alpha)*this.D*this.A/(math.sum(this.Fs)*this.d_x);
|
||||
const BC_dispersion_term = this.D*this.A/(math.sum(this.Fs)*this.d_x);
|
||||
this.extendedState[BC_PADDING] = math.multiply(1/(1+BC_dispersion_term), math.add(BC_C_in, math.multiply(BC_dispersion_term, this.extendedState[BC_PADDING+1])));
|
||||
this.extendedState[BC_PADDING-1] = math.add(math.multiply(2, this.extendedState[BC_PADDING]), math.multiply(-2, this.extendedState[BC_PADDING+2]), this.extendedState[BC_PADDING+3]);
|
||||
} else {
|
||||
@@ -438,17 +435,4 @@ class Reactor_PFR extends Reactor {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Reactor_CSTR, Reactor_PFR };
|
||||
|
||||
// DEBUG
|
||||
// state: S_O, S_I, S_S, S_NH, S_N2, S_NO, S_HCO, X_I, X_S, X_H, X_STO, X_A, X_TS
|
||||
// let initial_state = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1];
|
||||
// const Reactor = new Reactor_PFR(200, 10, 10, 1, 100, initial_state);
|
||||
// Reactor.Cs_in[0] = [0.0, 30., 100., 16., 0., 0., 5., 25., 75., 30., 0., 0., 125.];
|
||||
// Reactor.Fs[0] = 10;
|
||||
// Reactor.D = 0.01;
|
||||
// let N = 0;
|
||||
// while (N < 5000) {
|
||||
// console.log(Reactor.tick(0.001));
|
||||
// N += 1;
|
||||
// }
|
||||
module.exports = { Reactor_CSTR, Reactor_PFR };
|
||||
Reference in New Issue
Block a user