Add time step configuration and input handling in advanced reactor

This commit is contained in:
2025-09-22 15:17:25 +02:00
parent 7a70f60655
commit 8f64fbe4e5
3 changed files with 17 additions and 3 deletions

View File

@@ -28,6 +28,8 @@
X_A_init: { value: 0.001, required: true },
X_TS_init: { value: 125.0009, required: true },
timeStep: { value: 1, required: true },
enableLog: { value: false },
logLevel: { value: "error" },
@@ -99,6 +101,10 @@
type:"num",
types:["num"]
})
$("#node-input-timeStep").typedInput({
type:"num",
types:["num"]
})
// Set initial visibility on dialog open
const initialType = $("#node-input-reactor_type").typedInput("value");
if (initialType === "CSTR") {
@@ -222,6 +228,11 @@
<label for="node-input-X_TS_init"><i class="fa fa-tag"></i> Initial total suspended solids [g TSS m-3]</label>
<input type="text" id="node-input-X_TS_init" class="concentrations">
</div>
<h2> Simulation parameters </h2>
<div class="form-row">
<label for="node-input-timeStep"><i class="fa fa-tag"></i> Time step [s]</label>
<input type="text" id="node-input-timeStep" placeholder="s">
</div>
<!-- Logger fields injected here -->
<div id="logger-fields-placeholder"></div>

View File

@@ -104,7 +104,8 @@ class nodeClass {
parseFloat(uiConfig.X_STO_init),
parseFloat(uiConfig.X_A_init),
parseFloat(uiConfig.X_TS_init)
]
],
timeStep: parseFloat(uiConfig.timeStep)
}
}

View File

@@ -40,7 +40,7 @@ class Reactor {
this.kla = config.kla; // if NaN, use externaly provided OTR [d-1]
this.currentTime = Date.now(); // milliseconds since epoch [ms]
this.timeStep = 1 / (24*60*15); // time step [d]
this.timeStep = 1 / (24*60*60) * this.config.timeStep; // time step [d]
this.speedUpFactor = 60; // speed up factor for simulation, 60 means 1 minute per simulated second
}
@@ -159,7 +159,9 @@ class Reactor {
this.logger.debug(`---------------------- updating ${measurementType} ------------------ `);
switch (measurementType) {
case "temperature":
this.temperature = value;
if (position == "atEquipment") {
this.temperature = value;
}
break;
default:
this.logger.error(`Type '${measurementType}' not recognized for measured update.`);