From 8f64fbe4e5e97b872871b7643017747d5562b42d Mon Sep 17 00:00:00 2001 From: "p.vanderwilt" Date: Mon, 22 Sep 2025 15:17:25 +0200 Subject: [PATCH] Add time step configuration and input handling in advanced reactor --- advancedReactor.html | 11 +++++++++++ src/nodeClass.js | 3 ++- src/specificClass.js | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/advancedReactor.html b/advancedReactor.html index 161e9d1..d3d9f2c 100644 --- a/advancedReactor.html +++ b/advancedReactor.html @@ -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 @@ +

Simulation parameters

+
+ + +
diff --git a/src/nodeClass.js b/src/nodeClass.js index 8955854..a9e53d3 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -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) } } diff --git a/src/specificClass.js b/src/specificClass.js index 2ba3644..afddc2c 100644 --- a/src/specificClass.js +++ b/src/specificClass.js @@ -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.`);