Close volume balance and minor fixes

This commit is contained in:
2025-06-18 10:25:40 +02:00
parent 167014a24b
commit 288cf905d1
4 changed files with 20 additions and 18 deletions

View File

@@ -11,12 +11,12 @@ module.exports = function(RED) {
switch (msg.topic) {
case "Fluent":
// conserve volume flow debit
let F1 = msg.payload.F;
let F_diff = Math.max(F1 - F2, 0);
let F2_corr = F1 < F2 ? F1 : F2;
let F_in = msg.payload.F;
let F1 = Math.max(F_in - F2, 0);
let F2_corr = F_in < F2 ? F_in : F2;
let msg_F1 = structuredClone(msg);
msg_F1.payload.F = F_diff;
msg_F1.payload.F = F1;
let msg_F2 = {...msg};
msg_F2.payload.F = F2_corr;