Compare commits
8 Commits
da1cff55ba
...
7c8722b324
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c8722b324 | ||
| 442ddc60ed | |||
| 04306d0996 | |||
| 2bc244cae7 | |||
| 254f9eec5a | |||
| 109fd182df | |||
| bf5f265a76 | |||
| 905674ce58 |
20
package-lock.json
generated
20
package-lock.json
generated
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "asm3",
|
||||
"name": "reactor",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "asm3",
|
||||
"name": "reactor",
|
||||
"version": "0.0.1",
|
||||
"license": "SEE LICENSE",
|
||||
"dependencies": {
|
||||
"generalFunctions": "git+https://gitea.centraal.wbd-rd.nl/p.vanderwilt/generalFunctions.git#fix-missing-references",
|
||||
"generalFunctions": "git+https://gitea.centraal.wbd-rd.nl/RnD/generalFunctions.git",
|
||||
"mathjs": "^14.5.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.3.tgz",
|
||||
"integrity": "sha512-9uIQ10o0WGdpP6GDhXcdOJPJuDgFtIDtN/9+ArJQ2NAfAmiuhTQdzkaTGR33v43GYS2UrSA0eX2pPPHoFVvpxA==",
|
||||
"version": "7.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz",
|
||||
"integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -62,7 +62,7 @@
|
||||
},
|
||||
"node_modules/generalFunctions": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "git+https://gitea.centraal.wbd-rd.nl/p.vanderwilt/generalFunctions.git#302e12238745766a679ef11ca6ed5f4ea1548f87",
|
||||
"resolved": "git+https://gitea.centraal.wbd-rd.nl/RnD/generalFunctions.git#efc97d6cd17399391b011298e47e8c1b1599592d",
|
||||
"license": "SEE LICENSE"
|
||||
},
|
||||
"node_modules/javascript-natural-sort": {
|
||||
@@ -72,9 +72,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mathjs": {
|
||||
"version": "14.7.0",
|
||||
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.7.0.tgz",
|
||||
"integrity": "sha512-RaMhb+9MSESjDZNox/FzzuFpIUI+oxGLyOy1t3BMoW53pGWnTzZtlucJ5cvbit0dIMYlCq00gNbW1giZX4/1Rg==",
|
||||
"version": "14.8.0",
|
||||
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-14.8.0.tgz",
|
||||
"integrity": "sha512-DN4wmAjNzFVJ9vHqpAJ3vX0UF306u/1DgGKh7iVPuAFH19JDRd9NAaQS764MsKbSwDB6uBSkQEmgVmKdgYaCoQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.26.10",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "asm3",
|
||||
"name": "reactor",
|
||||
"version": "0.0.1",
|
||||
"description": "Implementation of the asm3 model for Node-Red",
|
||||
"repository": {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"generalFunctions": "git+https://gitea.centraal.wbd-rd.nl/p.vanderwilt/generalFunctions.git#fix-missing-references",
|
||||
"generalFunctions": "git+https://gitea.centraal.wbd-rd.nl/RnD/generalFunctions.git",
|
||||
"mathjs": "^14.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
34
reactor.html
34
reactor.html
@@ -1,9 +1,19 @@
|
||||
<script src="/advancedReactor/menu.js"></script>
|
||||
<!--
|
||||
| S88-niveau | Primair (blokkleur) | Tekstkleur |
|
||||
| ---------------------- | ------------------- | ---------- |
|
||||
| **Area** | `#0f52a5` | wit |
|
||||
| **Process Cell** | `#0c99d9` | wit |
|
||||
| **Unit** | `#50a8d9` | zwart |
|
||||
| **Equipment (Module)** | `#86bbdd` | zwart |
|
||||
| **Control Module** | `#a9daee` | zwart |
|
||||
|
||||
-->
|
||||
<script src="/reactor/menu.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType("advancedReactor", {
|
||||
category: "WWTP",
|
||||
color: "#c4cce0",
|
||||
RED.nodes.registerType("reactor", {
|
||||
category: "EVOLV",
|
||||
color: "#50a8d9",
|
||||
defaults: {
|
||||
name: { value: "" },
|
||||
reactor_type: { value: "CSTR", required: true },
|
||||
@@ -39,15 +49,15 @@
|
||||
outputs: 3,
|
||||
inputLabels: ["input"],
|
||||
outputLabels: ["process", "dbase", "parent"],
|
||||
icon: "font-awesome/fa-recycle",
|
||||
icon: "font-awesome/fa-flask",
|
||||
label: function() {
|
||||
return this.name || "advancedReactor";
|
||||
return this.name || "Reactor";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
// wait for the menu scripts to load
|
||||
const waitForMenuData = () => {
|
||||
if (window.EVOLV?.nodes?.advancedReactor?.initEditor) {
|
||||
window.EVOLV.nodes.advancedReactor.initEditor(this);
|
||||
if (window.EVOLV?.nodes?.reactor?.initEditor) {
|
||||
window.EVOLV.nodes.reactor.initEditor(this);
|
||||
} else {
|
||||
setTimeout(waitForMenuData, 50);
|
||||
}
|
||||
@@ -115,8 +125,8 @@
|
||||
},
|
||||
oneditsave: function() {
|
||||
// save logger fields
|
||||
if (window.EVOLV?.nodes?.['advancedReactor']?.loggerMenu?.saveEditor) {
|
||||
window.EVOLV.nodes['advancedReactor'].loggerMenu.saveEditor(this);
|
||||
if (window.EVOLV?.nodes?.reactor?.loggerMenu?.saveEditor) {
|
||||
window.EVOLV.nodes.reactor.loggerMenu.saveEditor(this);
|
||||
}
|
||||
|
||||
// save position field
|
||||
@@ -136,7 +146,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="advancedReactor">
|
||||
<script type="text/html" data-template-name="reactor">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
@@ -243,6 +253,6 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="advancedReactor">
|
||||
<script type="text/html" data-help-name="reactor">
|
||||
<p>New reactor node</p>
|
||||
</script>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const nameOfNode = "advancedReactor"; // name of the node, should match file name and node type in Node-RED
|
||||
const nameOfNode = "reactor"; // name of the node, should match file name and node type in Node-RED
|
||||
const nodeClass = require('./src/nodeClass.js'); // node class
|
||||
const { MenuManager } = require('generalFunctions');
|
||||
|
||||
|
||||
@@ -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*60) * this.config.timeStep; // time step [d]
|
||||
this.timeStep = 1 / (24*60*60) * this.config.timeStep; // time step in seconds, converted to days.
|
||||
this.speedUpFactor = 60; // speed up factor for simulation, 60 means 1 minute per simulated second
|
||||
}
|
||||
|
||||
@@ -119,13 +119,18 @@ class Reactor {
|
||||
return;
|
||||
}
|
||||
|
||||
const position = measurement.config.functionality.positionVsParent;
|
||||
let position;
|
||||
if (measurement.config.functionality.distance !== 'undefined') {
|
||||
position = measurement.config.functionality.distance;
|
||||
} else {
|
||||
position = measurement.config.functionality.positionVsParent;
|
||||
}
|
||||
const measurementType = measurement.config.asset.type;
|
||||
const key = `${measurementType}_${position}`;
|
||||
const eventName = `${measurementType}.measured.${position}`;
|
||||
|
||||
// Register event listener for measurement updates
|
||||
this.measurements.emitter.on(eventName, (eventData) => {
|
||||
measurement.measurements.emitter.on(eventName, (eventData) => {
|
||||
this.logger.debug(`${position} ${measurementType} from ${eventData.childName}: ${eventData.value} ${eventData.unit}`);
|
||||
|
||||
// Store directly in parent's measurement container
|
||||
@@ -317,13 +322,14 @@ class Reactor_PFR extends Reactor {
|
||||
|
||||
_updateMeasurement(measurementType, value, position, context) {
|
||||
switch(measurementType) {
|
||||
case "oxygen":
|
||||
grid_pos = Math.round(position * this.n_x);
|
||||
case "quantity (oxygen)":
|
||||
let grid_pos = Math.round(position / this.config.length * this.n_x);
|
||||
this.state[grid_pos][S_O_INDEX] = value; // naive approach for reconciling measurements and simulation
|
||||
break;
|
||||
}
|
||||
default:
|
||||
super._updateMeasurement(measurementType, value, position, context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply boundary conditions to the reactor state.
|
||||
|
||||
Reference in New Issue
Block a user