The problem with function node, change only once one variable

Hello,
i have a problem with a "function2" function node in my flow here:


In this flow I take some data from s7-1500 plc controller (pump control value, valve control values etc), combine into one message and then I have the "function2" function node where I analyze the input data and calculate the output values to send to the plc controller. The code inside the "function2" function node:

// reading values of input signals, coming from PLC S7-1500 controller
var pv1_wartosc = msg.payload.sygnaly_pv1.value[0];
var pompa_wartosc = msg.payload.sygnaly_pompa.value[0];
var zaworzbiornik1_wartosc = msg.payload.sygnaly_zaworzbiornik1.value[0];
var zaworlaczacy_wartosc = msg.payload.sygnaly_zaworlaczacy.value[0];
var doplywwody_wartosc = msg.payload.sygnaly_doplywwody.value[0];
var zaklocenie1_wartosc = msg.payload.sygnaly_zaklocenie1.value[0];
var zaklocenie2_wartosc = msg.payload.sygnaly_zaklocenie2.value[0];
var nowa_zmienna 

// sending output signals to the PLC controller
// calculating the values of controlling signals
var poziom_wody_etap1 = 15;
var pompa_sygnal_sterujacy = 30;
var zaworzbiornik1_sygnal_sterujacy = 100;
var zaworlaczacy_sygnal_sterujacy = 0;
var zaklocenie1_sygnal_sterujacy = false;
var zaklocenie2_sygnal_sterujacy = false;
var doplywwody_sygnal_sterujacy = false;
var zmiana_dokonana;

// checking if the value of water level in tank is higher than the control point (poziom_wody_etap_1)
if (pv1_wartosc >= poziom_wody_etap1) {
    zaklocenie1_sygnal_sterujacy = true;
    zmiana_dokonana = true;
}
if (pv1_wartosc < poziom_wody_etap1) {
    zaklocenie1_sygnal_sterujacy = false;
    zmiana_dokonana = false;
}
if (pv1_wartosc < poziom_wody_etap1 && zmiana_dokonana === true) {
    zaklocenie1_sygnal_sterujacy = true;
    zmiana_dokonana = true;
}

var zmiana_dokonana_msg = {};
zmiana_dokonana_msg.payload = {
    "value": [zmiana_dokonana] 
};
// sending messages with values to the PLC controller
var pompa_msg = {};
pompa_msg.payload = {
    "Signal": "rPompa",    
    "path": "DB1,REAL8",
    "error": 0,
    "value": [pompa_sygnal_sterujacy]
};
var zaworzbiornik1_msg = {}
zaworzbiornik1_msg.payload = {
    "Signal": "rZaworZbiornik1",
    "path": "DB1,REAL16",
    "error": 0,
    "value": [zaworzbiornik1_sygnal_sterujacy]
};
var zaworlaczacy_msg = {};
zaworlaczacy_msg.payload = {
    "Signal": "rZaworLaczacy",
    "path": "DB1,REAL12",
    "error": 0,
    "value": [zaworlaczacy_sygnal_sterujacy]
};
var zaklocenie1_msg = {};
zaklocenie1_msg.payload = {
    "Signal": "bZaklocenie1",
    "path": "DB1,X24.0",
    "error": 0,
    "value": [zaklocenie1_sygnal_sterujacy]
};
var zaklocenie2_msg = {}
zaklocenie2_msg.payload = {
    "Signal": "bZaklocenie2",
    "path": "DB1,X24.1",
    "error": 0,
    "value": [zaklocenie2_sygnal_sterujacy]
};
var doplywwody_msg = {};
doplywwody_msg.payload = {
    "Signal": "bDoplywWody",
    "path": "DB1,X30",
    "error": 0,
    "value": [doplywwody_sygnal_sterujacy]
};

return [[pompa_msg], [zaworzbiornik1_msg], [zaworlaczacy_msg], [zaklocenie1_msg], [zaklocenie2_msg], [doplywwody_msg], [zmiana_dokonana_msg]];

The whole flow:

[{"id":"b7bafc365cb516fa","type":"tab","label":"scenariusz 2 pracy","disabled":false,"info":"","env":[]},{"id":"2bcb6ff9c835deaa","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"realPV1\"}","s7Name":"realPV1","topic":"sygnaly_pv1","name":"Poziom wody (zbiornik 1) - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":390,"y":120,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"96653635fa54052b","type":"inject","z":"b7bafc365cb516fa","name":"","props":[{"p":"payload"}],"repeat":"0.1","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"true","payloadType":"bool","x":90,"y":200,"wires":[["2bcb6ff9c835deaa","265dcd68a393ec2c","59e4c7fc0c2c28cf","e410975420c01b56","224de926efa64c6b","0b27ce9a069f6946","b373230dd97e9b93"]]},{"id":"9aae9d8e2901c867","type":"debug","z":"b7bafc365cb516fa","name":"sygnały ze sterownika PLC","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":120,"wires":[]},{"id":"c87e51c94b51c276","type":"debug","z":"b7bafc365cb516fa","name":"połączone sygnały wejściowe ze sterownika PLC","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1220,"y":280,"wires":[]},{"id":"265dcd68a393ec2c","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"8\",\"S7_BitOffset\":\"4\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rPompa\"}","s7Name":"rPompa","topic":"sygnaly_pompa","name":"Pompa - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":330,"y":180,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"5b8399cf016df6be","type":"join","z":"b7bafc365cb516fa","name":"Połączenie wiadomości wejściowych","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"7","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":790,"y":280,"wires":[["c87e51c94b51c276","6dfbba0a301633e8","0e814faa6050071b"]]},{"id":"59e4c7fc0c2c28cf","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bZaklocenie1\"}","s7Name":"bZaklocenie1","topic":"sygnaly_zaklocenie1","name":"Zakłócenie 1 - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":350,"y":360,"wires":[["5b8399cf016df6be","9aae9d8e2901c867"]]},{"id":"e410975420c01b56","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"16\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rZaworZbiornik1\"}","s7Name":"rZaworZbiornik1","topic":"sygnaly_zaworzbiornik1","name":"Zawór zbiornik 1 - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":360,"y":240,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"224de926efa64c6b","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"12\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rZaworLaczacy\"}","s7Name":"rZaworLaczacy","topic":"sygnaly_zaworlaczacy","name":"Zawór łączący - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":350,"y":300,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"b373230dd97e9b93","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"1\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bZaklocenie2\"}","s7Name":"bZaklocenie2","topic":"sygnaly_zaklocenie2","name":"Zakłócenie 2 - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":350,"y":420,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"0b27ce9a069f6946","type":"s7comm read","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"30\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bDoplywWody\"}","s7Name":"bDoplywWody","topic":"sygnaly_doplywwody","name":"Dopływ wody - sygnał IN","signalSetted":false,"none":"true","repeat":"","once":false,"x":350,"y":480,"wires":[["9aae9d8e2901c867","5b8399cf016df6be"]]},{"id":"7e1ba787267e7024","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"8\",\"S7_BitOffset\":\"4\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rPompa\"}","s7Name":"rPompa","topic":"sygnaly_pompa","name":"Pompa - sygnał OUT","signalSetted":false,"x":1240,"y":440,"wires":[[]]},{"id":"3b74a75cddc08f4b","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"16\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rZaworZbiornik1\"}","s7Name":"rZaworZbiornik1","topic":"sygnaly_zaworzbiornik1","name":"Zawór zbiornik 1 - sygnał OUT","signalSetted":false,"x":1270,"y":500,"wires":[[]]},{"id":"dd067e041b377977","type":"file","z":"b7bafc365cb516fa","name":"zapis uzyskanych danych do pliku CSV","filename":"/home/nodered/node-red-home/scenariusz_pracy_2_wartosci_sr.csv","filenameType":"str","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"utf8","x":980,"y":940,"wires":[[]]},{"id":"559cca990db14843","type":"csv","z":"b7bafc365cb516fa","name":"CSV parser from LT node","sep":";","hdrin":true,"hdrout":"once","multi":"one","ret":"\\r\\n","temp":"pv1_wartosc, pompa_wartosc, zaworzbiornik1_wartosc, zaworlaczacy_wartosc, doplywwody_wartosc, zaklocenie1_wartosc, zaklocenie2_wartosc","skip":"0","strings":true,"include_empty_strings":"","include_null_values":true,"x":630,"y":860,"wires":[["318eb743e642d23a","dd067e041b377977"]]},{"id":"318eb743e642d23a","type":"debug","z":"b7bafc365cb516fa","name":"CSV parser","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":860,"wires":[]},{"id":"6dfbba0a301633e8","type":"function","z":"b7bafc365cb516fa","name":"function - zapis danych do pliku CSV","func":"// odczytanie wartości sygnałów wejściowych, pochodzących ze sterownika PLC ze stanowiska badawczego\nvar pv1_wartosc = msg.payload.sygnaly_pv1.value[0];\nvar pompa_wartosc = msg.payload.sygnaly_pompa.value[0];\nvar zaworzbiornik1_wartosc = msg.payload.sygnaly_zaworzbiornik1.value[0];\nvar zaworlaczacy_wartosc = msg.payload.sygnaly_zaworlaczacy.value[0];\nvar doplywwody_wartosc = msg.payload.sygnaly_doplywwody.value[0];\nvar zaklocenie1_wartosc = msg.payload.sygnaly_zaklocenie1.value[0];\nvar zaklocenie2_wartosc = msg.payload.sygnaly_zaklocenie2.value[0];\n\nvar msg_dane_do_pliku = {};\nmsg_dane_do_pliku.payload =\n{\n    \"pv1_wartosc\": pv1_wartosc,\n    \"pompa_wartosc\": pompa_wartosc,\n    \"zaworzbiornik1_wartosc\": zaworzbiornik1_wartosc,\n    \"zaworlaczacy_wartosc\": zaworlaczacy_wartosc,\n    \"doplywwody_wartosc\": doplywwody_wartosc,\n    \"zaklocenie1_wartosc\": zaklocenie1_wartosc,\n    \"zaklocenie2_wartosc\": zaklocenie2_wartosc,\n}\n\nreturn msg_dane_do_pliku;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":860,"wires":[["559cca990db14843","e735bdaafe351a56"]]},{"id":"e735bdaafe351a56","type":"debug","z":"b7bafc365cb516fa","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":960,"wires":[]},{"id":"b71d191e08446a7b","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"12\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rZaworLaczacy\"}","s7Name":"rZaworLaczacy","topic":"sygnaly_zaworlaczacy","name":"Zawór łączący - sygnał OUT","signalSetted":false,"x":1260,"y":560,"wires":[[]]},{"id":"0e814faa6050071b","type":"function","z":"b7bafc365cb516fa","name":"function 2","func":"// reading values of input signals, coming from PLC S7-1500 controller\nvar pv1_wartosc = msg.payload.sygnaly_pv1.value[0];\nvar pompa_wartosc = msg.payload.sygnaly_pompa.value[0];\nvar zaworzbiornik1_wartosc = msg.payload.sygnaly_zaworzbiornik1.value[0];\nvar zaworlaczacy_wartosc = msg.payload.sygnaly_zaworlaczacy.value[0];\nvar doplywwody_wartosc = msg.payload.sygnaly_doplywwody.value[0];\nvar zaklocenie1_wartosc = msg.payload.sygnaly_zaklocenie1.value[0];\nvar zaklocenie2_wartosc = msg.payload.sygnaly_zaklocenie2.value[0];\n\n// sending output signals to the PLC controller\n// calculating the values of controlling signals\nvar poziom_wody_etap1 = 15;\nvar pompa_sygnal_sterujacy = 30;\nvar zaworzbiornik1_sygnal_sterujacy = 100;\nvar zaworlaczacy_sygnal_sterujacy = 0;\nvar zaklocenie1_sygnal_sterujacy = false;\nvar zaklocenie2_sygnal_sterujacy = false;\nvar doplywwody_sygnal_sterujacy = false;\nvar zmiana_dokonana;\n\n// checking if the value of water level in tank is higher than the control point (poziom_wody_etap_1)\nif (pv1_wartosc >= poziom_wody_etap1) {\n    zaklocenie1_sygnal_sterujacy = true;\n    zmiana_dokonana = true;\n}\nif (pv1_wartosc < poziom_wody_etap1) {\n    zaklocenie1_sygnal_sterujacy = false;\n    zmiana_dokonana = false;\n}\nif (pv1_wartosc < poziom_wody_etap1 && zmiana_dokonana === true) {\n    zaklocenie1_sygnal_sterujacy = true;\n    zmiana_dokonana = true;\n}\n\nvar zmiana_dokonana_msg = {};\nzmiana_dokonana_msg.payload = {\n    \"value\": [zmiana_dokonana] \n};\n// sending messages with values to the PLC controller\nvar pompa_msg = {};\npompa_msg.payload = {\n    \"Signal\": \"rPompa\",    \n    \"path\": \"DB1,REAL8\",\n    \"error\": 0,\n    \"value\": [pompa_sygnal_sterujacy]\n};\nvar zaworzbiornik1_msg = {}\nzaworzbiornik1_msg.payload = {\n    \"Signal\": \"rZaworZbiornik1\",\n    \"path\": \"DB1,REAL16\",\n    \"error\": 0,\n    \"value\": [zaworzbiornik1_sygnal_sterujacy]\n};\nvar zaworlaczacy_msg = {};\nzaworlaczacy_msg.payload = {\n    \"Signal\": \"rZaworLaczacy\",\n    \"path\": \"DB1,REAL12\",\n    \"error\": 0,\n    \"value\": [zaworlaczacy_sygnal_sterujacy]\n};\nvar zaklocenie1_msg = {};\nzaklocenie1_msg.payload = {\n    \"Signal\": \"bZaklocenie1\",\n    \"path\": \"DB1,X24.0\",\n    \"error\": 0,\n    \"value\": [zaklocenie1_sygnal_sterujacy]\n};\nvar zaklocenie2_msg = {}\nzaklocenie2_msg.payload = {\n    \"Signal\": \"bZaklocenie2\",\n    \"path\": \"DB1,X24.1\",\n    \"error\": 0,\n    \"value\": [zaklocenie2_sygnal_sterujacy]\n};\nvar doplywwody_msg = {};\ndoplywwody_msg.payload = {\n    \"Signal\": \"bDoplywWody\",\n    \"path\": \"DB1,X30\",\n    \"error\": 0,\n    \"value\": [doplywwody_sygnal_sterujacy]\n};\n\nreturn [[pompa_msg], [zaworzbiornik1_msg], [zaworlaczacy_msg], [zaklocenie1_msg], [zaklocenie2_msg], [doplywwody_msg], [zmiana_dokonana_msg]];","outputs":6,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":440,"wires":[["7e1ba787267e7024"],["3b74a75cddc08f4b"],["b71d191e08446a7b"],["1d7bb153e72e98d7"],["3d1e2698f404092f"],["ba62089f1ce7281e"]]},{"id":"1d7bb153e72e98d7","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bZaklocenie1\"}","s7Name":"bZaklocenie1","topic":"sygnaly_zaklocenie1","name":"Zakłócenie 1 - sygnał OUT","signalSetted":false,"x":1260,"y":620,"wires":[[]]},{"id":"3d1e2698f404092f","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"1\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bZaklocenie2\"}","s7Name":"bZaklocenie2","topic":"sygnaly_zaklocenie2","name":"Zakłócenie 2 - sygnał OUT","signalSetted":false,"x":1260,"y":680,"wires":[[]]},{"id":"ba62089f1ce7281e","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"30\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bDoplywWody\"}","s7Name":"bDoplywWody","topic":"sygnaly_doplywwody","name":"Dopływ wody - sygnał OUT","signalSetted":false,"x":1260,"y":740,"wires":[[]]},{"id":"6fde8d5a9aebf4a2","type":"s7comm write","z":"b7bafc365cb516fa","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bZaklocenie1\"}","s7Name":"bZaklocenie1","topic":"sygnaly_zaklocenie1","name":"send Control value to Zaklocenie1","signalSetted":false,"x":860,"y":1320,"wires":[[]]},{"id":"7fd625dbfea14360","type":"inject","z":"b7bafc365cb516fa","name":"signal to send values","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1280,"wires":[["08ba843cc44a8ea7"]]},{"id":"71a8a6b25b56c313","type":"function","z":"b7bafc365cb516fa","name":"send JSON pump new 2","func":"// NEW version - suggestion from SIOS (Mr. Bosak)\n\n// set msg.payload values\nmsg.payload = {\n\"Signal\": \"bZaklocenie1\",\n    \"path\": \"DB1,X24.0\",\n    \"error\": 0,\n    \"value\": [false]\n};\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":1360,"wires":[["6fde8d5a9aebf4a2"]]},{"id":"c27799fc5d3cbf51","type":"comment","z":"b7bafc365cb516fa","name":"send json function - new (value 0)","info":"","x":530,"y":1320,"wires":[]},{"id":"08ba843cc44a8ea7","type":"function","z":"b7bafc365cb516fa","name":"send JSON pump new 1","func":"// NEW version - suggestion from SIOS (Mr. Bosak)\n\n// set msg.payload values\nmsg.payload = {\n \"Signal\": \"bZaklocenie1\",\n    \"path\": \"DB1,X24.0\",\n    \"error\": 0,\n    \"value\": [true]\n};\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":510,"y":1280,"wires":[["6fde8d5a9aebf4a2"]]},{"id":"d5f24bbeb8b7afa8","type":"inject","z":"b7bafc365cb516fa","name":"signal to send values","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":1360,"wires":[["71a8a6b25b56c313"]]},{"id":"fbc05d2c69b5de98","type":"comment","z":"b7bafc365cb516fa","name":"send json function - new (value 40)","info":"","x":540,"y":1400,"wires":[]},{"id":"6cfa463eced65fce","type":"comment","z":"b7bafc365cb516fa","name":"Zaklocenie1","info":"","x":230,"y":1220,"wires":[]},{"id":"81279ee0c6bff15e","type":"s7comm","ip":"192.168.200.7","port":"102","rack":"0","slot":"1","payload":[{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"realPV1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"4","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rPV2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"8","S7_BitOffset":"4","S7_Quantity":"1","S7_Name":"rPompa"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"12","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworLaczacy"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"16","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworZbiornik1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"20","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworZbiornik2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bZaklocenie1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"1","S7_Quantity":"1","S7_Name":"bZaklocenie2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"26","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rPrzeplyw"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"30","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bDoplywWody"}]}]

My aim is to change the value of the "zaklocenie1_sygnal_sterujacy" variable only ONCE but unfortunately in changes everytime the value "pv1_wartosc" variable goes over or under the value of the trigger of if statements ("poziom_wody_etap1" variable). How should i change my flow so it would work as i wish?

Ok, so you receive messages from the PLC and it is joined by the yellow node.

That creates a complex message which is sent into your function 2 node.

It changes value because of the order in which you have the if( ) commands.

It is a bit difficult reading it all in my text editor, reading your question and replying all at once.

line 17
var zaklocenie1_sygnal_sterujacy = false;
This sets the variable to false
Fixed.

line 23 +

if (pv1_wartosc >= poziom_wody_etap1) {
    zaklocenie1_sygnal_sterujacy = true;

sets the variable depending on something.

line 27 +

if (pv1_wartosc < poziom_wody_etap1) {
    zaklocenie1_sygnal_sterujacy = false;

sets the variable depending on something.

line 31 +

if (pv1_wartosc < poziom_wody_etap1 && zmiana_dokonana === true) {
    zaklocenie1_sygnal_sterujacy = true;

sets the variable depending on something.

Then way further down,
line 63 +

zaklocenie1_msg.payload = {
    "Signal": "bZaklocenie1",
    "path": "DB1,X24.0",
    "error": 0,
    "value": [zaklocenie1_sygnal_sterujacy]

The last bit of code sets it respectively.

Which is a bit strange.

You may need to use the else statement.

On a trivial point change all your var to let.
var is only supported for compatibility.

Hello,
thank you for your answer, I will try to implement your suggestion. Due to " sets the variable depending on something" sentences from your response, i fixed my function code by translating it fully to english (i am sorry for the problem that i caused):

// reading values of input signals, coming from PLC S7-1500 controller
var waterlevel_tank1_value = msg.payload.signals_waterlevel_tank1_value[0];
var pump_value = msg.payload.signals_pump.value[0];
var drainvalve_tank1_value = msg.payload.signals_drainvalve_tank1.value[0];
var drainvalve_betweentanks_value = msg.payload.signals_drainvalve_betweentanks.value[0];
var watersupply_value = msg.payload.signals_watersupply.value[0];
var disruption1_value = msg.payload.signals_disruption1.value[0];
var disruption2_value = msg.payload.signals_disruption2.value[0];

// sending output signals to the PLC controller
// calculating the values of controlling signals
var waterlevel_step1 = 15;
var pump_control_signal = 30;
var drainvalve_tank1_control_signal = 100;
var drainvalve_betweentanks_control_signal = 0;
var disruption1_control_signal = false;
var disruption2_control_signal = false;
var watersupply_control_signal = false;
var signal_change_made;

// checking if the value of water level in tank is higher than the control point from step1
if (waterlevel_tank1_value >= waterlevel_step1) {
    disruption1_control_signal = true;
    signal_change_made = true;
}
if (waterlevel_tank1_value < waterlevel_step1) {
    disruption1_control_signal = false;
    signal_change_made = false;
}
if (waterlevel_tank1_value < waterlevel_step1 && signal_change_made === true) {
    disruption1_control_signal = true;
    signal_change_made = true;
}

var signal_change_made_msg = {};
signal_change_made_msg.payload = {
    "value": [signal_change_made]
};
// sending messages with values to the PLC controller
var pump_msg = {};
pump_msg.payload = {
    "Signal": "rpump",
    "path": "DB1,REAL8",
    "error": 0,
    "value": [pump_control_signal]
};
var drainvalve_tank1_msg = {}
drainvalve_tank1_msg.payload = {
    "Signal": "rdrainvalve_tank1",
    "path": "DB1,REAL16",
    "error": 0,
    "value": [drainvalve_tank1_control_signal]
};
var drainvalve_betweentanks_msg = {};
drainvalve_betweentanks_msg.payload = {
    "Signal": "rdrainvalve_betweentanks",
    "path": "DB1,REAL12",
    "error": 0,
    "value": [drainvalve_betweentanks_control_signal]
};
var disruption1_msg = {};
disruption1_msg.payload = {
    "Signal": "bdisruption1",
    "path": "DB1,X24.0",
    "error": 0,
    "value": [disruption1_control_signal]
};
var disruption2_msg = {}
disruption2_msg.payload = {
    "Signal": "bdisruption2",
    "path": "DB1,X24.1",
    "error": 0,
    "value": [disruption2_control_signal]
};
var watersupply_msg = {};
watersupply_msg.payload = {
    "Signal": "bwatersupply",
    "path": "DB1,X30",
    "error": 0,
    "value": [watersupply_control_signal]
};

return [[pump_msg], [drainvalve_tank1_msg], [drainvalve_betweentanks_msg], [disruption1_msg], [disruption2_msg], [watersupply_msg], [signal_change_made_msg]];

Whole flow code in JSON:

[{"id":"f9730aa2818c2214","type":"tab","label":"scenario 1 ENG","disabled":false,"info":"","env":[]},{"id":"9dee586d683e9d70","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"real_waterlevel_tank1\"}","s7Name":"real_waterlevel_tank1","topic":"signals_waterlevel_tank1","name":"Water level in tank1 - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":430,"y":120,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"8ced110bc3e01a28","type":"inject","z":"f9730aa2818c2214","name":"","props":[{"p":"payload"}],"repeat":"0.1","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"true","payloadType":"bool","x":150,"y":200,"wires":[["9dee586d683e9d70","3a0713e02481f44f","1ed09d484d3b90d9","23044ecc377da5b6","4f54e15cadd4f65d","119815421cbfd632","3662af55b1bdda28"]]},{"id":"26af2a4f711b7ddc","type":"debug","z":"f9730aa2818c2214","name":"signals from PLC controller","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":120,"wires":[]},{"id":"57d781c4b88b4172","type":"debug","z":"f9730aa2818c2214","name":"Combined input signals from PLC controller","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1270,"y":280,"wires":[]},{"id":"3a0713e02481f44f","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"8\",\"S7_BitOffset\":\"4\",\"S7_Quantity\":\"1\",\"S7_Name\":\"rPompa\"}","s7Name":"rPompa","topic":"signals_pump","name":"Pump - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":380,"y":180,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"6906bdeb98057702","type":"join","z":"f9730aa2818c2214","name":"Connecting input messages","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"7","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":280,"wires":[["57d781c4b88b4172","6ddfa4d2768790e5","45fba93d05bae955"]]},{"id":"1ed09d484d3b90d9","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_disruption1\"}","s7Name":"bool_disruption1","topic":"signals_disruption1","name":"Disruption 1 - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":400,"y":360,"wires":[["6906bdeb98057702","26af2a4f711b7ddc"]]},{"id":"23044ecc377da5b6","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"16\",\"S7_Name\":\"real_drain_valve_tank1\"}","s7Name":"real_drain_valve_tank1","topic":"signals_drainvalve_tank1","name":"Drain valve from tank 1 - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":440,"y":240,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"4f54e15cadd4f65d","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"12\",\"S7_Name\":\"real_drain_valve_between_tanks\"}","s7Name":"real_drain_valve_between_tanks","topic":"signals_drainvalve_betweentanks","name":"Drain valve between tanks 1 & 2 - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":470,"y":300,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"3662af55b1bdda28","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"1\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_disruption2\"}","s7Name":"bool_disruption2","topic":"signals_disruption2","name":"Disruption 2 - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":400,"y":420,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"119815421cbfd632","type":"s7comm read","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"30\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_water_supply\"}","s7Name":"bool_water_supply","topic":"signals_watersupply","name":"Water supply - IN signal","signalSetted":false,"none":"true","repeat":"","once":false,"x":410,"y":480,"wires":[["26af2a4f711b7ddc","6906bdeb98057702"]]},{"id":"72eb21afc4e11c0d","type":"file","z":"f9730aa2818c2214","name":"zapis uzyskanych danych do pliku CSV","filename":"/home/nodered/node-red-home/scenario1_eng.csv","filenameType":"str","appendNewline":false,"createDir":true,"overwriteFile":"false","encoding":"utf8","x":1680,"y":760,"wires":[[]]},{"id":"e852aeda01c91969","type":"csv","z":"f9730aa2818c2214","name":"CSV parser from LT node","sep":";","hdrin":true,"hdrout":"once","multi":"one","ret":"\\r\\n","temp":"waterlevel_tank1_value, pump_value, drainvalve_tank1_value, drainvalve_betweentanks_value, watersupply_value, disruption1_value, disruption2_value","skip":"0","strings":true,"include_empty_strings":"","include_null_values":true,"x":1310,"y":700,"wires":[["f6e205b06a9e538a","72eb21afc4e11c0d"]]},{"id":"f6e205b06a9e538a","type":"debug","z":"f9730aa2818c2214","name":"CSV parser","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1590,"y":700,"wires":[]},{"id":"6ddfa4d2768790e5","type":"function","z":"f9730aa2818c2214","name":"function - save data to CSV file","func":"// odczytanie wartości sygnałów wejściowych, pochodzących ze sterownika PLC ze stanowiska badawczego\nvar waterlevel_tank1_value = msg.payload.signals_waterlevel_tank1.value[0];\nvar pump_value = msg.payload.signals_pump.value[0];\nvar drainvalve_tank1_value = msg.payload.signals_drainvalve_tank1.value[0];\nvar drainvalve_betweentanks_value = msg.payload.signals_drainvalve_betweentanks.value[0];\nvar watersupply_value = msg.payload.signals_watersupply.value[0];\nvar disruption1_value = msg.payload.signals_disruption1.value[0];\nvar disruption2_value = msg.payload.signals_disruption2.value[0];\n\nvar msg_dane_do_pliku = {};\nmsg_dane_do_pliku.payload =\n{\n    \"waterlevel_tank1_value\": waterlevel_tank1_value,\n    \"pump_value\": pump_value,\n    \"drainvalve_tank1_value\": drainvalve_tank1_value,\n    \"drainvalve_betweentanks_value\": drainvalve_betweentanks_value,\n    \"watersupply_value\": watersupply_value,\n    \"disruption1_value\": disruption1_value,\n    \"disruption2_value\": disruption2_value,\n}\n\nreturn msg_dane_do_pliku;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":930,"y":700,"wires":[["e852aeda01c91969","602737dfc91e7369"]]},{"id":"602737dfc91e7369","type":"debug","z":"f9730aa2818c2214","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1260,"y":800,"wires":[]},{"id":"45fba93d05bae955","type":"function","z":"f9730aa2818c2214","name":"function 4","func":"// reading values of input signals, coming from PLC S7-1500 controller\nvar waterlevel_tank1_value = msg.payload.signals_waterlevel_tank1_value[0];\nvar pump_value = msg.payload.signals_pump.value[0];\nvar drainvalve_tank1_value = msg.payload.signals_drainvalve_tank1.value[0];\nvar drainvalve_betweentanks_value = msg.payload.signals_drainvalve_betweentanks.value[0];\nvar watersupply_value = msg.payload.signals_watersupply.value[0];\nvar disruption1_value = msg.payload.signals_disruption1.value[0];\nvar disruption2_value = msg.payload.signals_disruption2.value[0];\n\n// sending output signals to the PLC controller\n// calculating the values of controlling signals\nvar waterlevel_step1 = 15;\nvar pump_control_signal = 30;\nvar drainvalve_tank1_control_signal = 100;\nvar drainvalve_betweentanks_control_signal = 0;\nvar disruption1_control_signal = false;\nvar disruption2_control_signal = false;\nvar watersupply_control_signal = false;\nvar signal_change_made;\n\n// checking if the value of water level in tank is higher than the control point from step1\nif (waterlevel_tank1_value >= waterlevel_step1) {\n    disruption1_control_signal = true;\n    signal_change_made = true;\n}\nif (waterlevel_tank1_value < waterlevel_step1) {\n    disruption1_control_signal = false;\n    signal_change_made = false;\n}\nif (waterlevel_tank1_value < waterlevel_step1 && signal_change_made === true) {\n    disruption1_control_signal = true;\n    signal_change_made = true;\n}\n\nvar signal_change_made_msg = {};\nsignal_change_made_msg.payload = {\n    \"value\": [signal_change_made]\n};\n// sending messages with values to the PLC controller\nvar pump_msg = {};\npump_msg.payload = {\n    \"Signal\": \"rpump\",\n    \"path\": \"DB1,REAL8\",\n    \"error\": 0,\n    \"value\": [pump_control_signal]\n};\nvar drainvalve_tank1_msg = {}\ndrainvalve_tank1_msg.payload = {\n    \"Signal\": \"rdrainvalve_tank1\",\n    \"path\": \"DB1,REAL16\",\n    \"error\": 0,\n    \"value\": [drainvalve_tank1_control_signal]\n};\nvar drainvalve_betweentanks_msg = {};\ndrainvalve_betweentanks_msg.payload = {\n    \"Signal\": \"rdrainvalve_betweentanks\",\n    \"path\": \"DB1,REAL12\",\n    \"error\": 0,\n    \"value\": [drainvalve_betweentanks_control_signal]\n};\nvar disruption1_msg = {};\ndisruption1_msg.payload = {\n    \"Signal\": \"bdisruption1\",\n    \"path\": \"DB1,X24.0\",\n    \"error\": 0,\n    \"value\": [disruption1_control_signal]\n};\nvar disruption2_msg = {}\ndisruption2_msg.payload = {\n    \"Signal\": \"bdisruption2\",\n    \"path\": \"DB1,X24.1\",\n    \"error\": 0,\n    \"value\": [disruption2_control_signal]\n};\nvar watersupply_msg = {};\nwatersupply_msg.payload = {\n    \"Signal\": \"bwatersupply\",\n    \"path\": \"DB1,X30\",\n    \"error\": 0,\n    \"value\": [watersupply_control_signal]\n};\n\nreturn [[pump_msg], [drainvalve_tank1_msg], [drainvalve_betweentanks_msg], [disruption1_msg], [disruption2_msg], [watersupply_msg], [signal_change_made_msg]];","outputs":6,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1040,"y":420,"wires":[["d489f9b3e539c1c8"],["32991a8481feb87c"],["0a6cbf83906f886f"],["a3b41a35a60ff85b"],["475a99911e7f49b5"],["56d76ab97714a59a"]]},{"id":"d489f9b3e539c1c8","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"8\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"real_pump\"}","s7Name":"real_pump","topic":"signals_pump","name":"Pump - OUT signal","signalSetted":false,"x":1330,"y":340,"wires":[[]]},{"id":"32991a8481feb87c","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"16\",\"S7_Name\":\"real_drain_valve_tank1\"}","s7Name":"real_drain_valve_tank1","topic":"signals_drainvalve_tank1","name":"Drain valve from tank 1 - OUT signal","signalSetted":false,"x":1390,"y":400,"wires":[[]]},{"id":"0a6cbf83906f886f","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"R\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"12\",\"S7_Name\":\"real_drain_valve_between_tanks\"}","s7Name":"real_drain_valve_between_tanks","topic":"signals_drainvalve_betweentanks","name":"Drain valve between tanks 1 & 2 - OUT signal","signalSetted":false,"x":1410,"y":460,"wires":[[]]},{"id":"a3b41a35a60ff85b","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_disruption1\"}","s7Name":"bool_disruption1","topic":"signals_disruption1","name":"Disruption 1 - OUT signal","signalSetted":false,"x":1350,"y":520,"wires":[[]]},{"id":"475a99911e7f49b5","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"24\",\"S7_BitOffset\":\"1\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_disruption2\"}","s7Name":"bool_disruption2","topic":"signals_disruption2","name":"Disruption 2 - OUT signal","signalSetted":false,"x":1350,"y":580,"wires":[[]]},{"id":"56d76ab97714a59a","type":"s7comm write","z":"f9730aa2818c2214","connection":"81279ee0c6bff15e","payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"30\",\"S7_BitOffset\":\"0\",\"S7_Quantity\":\"1\",\"S7_Name\":\"bool_water_supply\"}","s7Name":"bool_water_supply","topic":"signals_watersupply","name":"Water supply - OUT signal","signalSetted":false,"x":1350,"y":640,"wires":[[]]},{"id":"81279ee0c6bff15e","type":"s7comm","ip":"192.168.200.7","port":"102","rack":"0","slot":"1","payload":[{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"realPV1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"4","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rPV2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"8","S7_BitOffset":"4","S7_Quantity":"1","S7_Name":"rPompa"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"12","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworLaczacy"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"16","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworZbiornik1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"20","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rZaworZbiornik2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bZaklocenie1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"1","S7_Quantity":"1","S7_Name":"bZaklocenie2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"26","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"rPrzeplyw"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"30","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bDoplywWody"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"real_waterlevel_tank1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"8","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"real_pump"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"12","S7_Name":"real_drain_valve_between_tanks"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"R","S7_Offset":"0","S7_BitOffset":"0","S7_Quantity":"16","S7_Name":"real_drain_valve_tank1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bool_disruption1"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"24","S7_BitOffset":"1","S7_Quantity":"1","S7_Name":"bool_disruption2"},{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"30","S7_BitOffset":"0","S7_Quantity":"1","S7_Name":"bool_water_supply"}]}]

My aim is to change the value of the "disruption1_control_value" variable only ONCE (from false to true value) but unfortunately in changes everytime the value "waterlevel_tank1_value" variable goes over or under the value of the "waterlevel_step1" trigger of if statements.

I intend to go something like this:

  • get signals from PLC about the drain valves, tank water level, pump etc.

  • i turn the pump on by setting the 30% value of its max power var pump_control_signal = 30;, so the water level in my tank rises,

  • when the water level in tank 1 reaches certain value defined by step1, the control value of disruption1 signal should be turned on the disruption1, (which opens a digital drainvalve from tank1 and lets the water go out of the tank1, so the water level drops):
    if (waterlevel_tank1_value >= waterlevel_step1) { disruption1_control_signal = true; signal_change_made = true; }.
    There also should be marked that the signal change was made (variable signal_change_made to true).

  • if the water level in tank1 is below the certain value defined by step1, the control value of disruption1 signal should be false (drain valve not turned on - like initial value for this drain valve) and there was no disruption1 signal change made:
    if (waterlevel_tank1_value < waterlevel_step1) { disruption1_control_signal = false; signal_change_made = false; }

  • if the water level in tank1 is below the certain value defined by step1, but the signal change of disruption1 digital drainvalve was made earlier, the control value of disruption1 signal should be true:
    if (waterlevel_tank1_value < waterlevel_step1) { disruption1_control_signal = false; signal_change_made = false; }
    If the disruption1 signal change was made once, there should be no further changes of this signal.

Unfortunately, i have a situation like this:

  1. pump turned on, so water level in tank1 rises,
  2. if the water level in tank reaches certain value, disruption1 turns on, so the water level in tank drops,
  3. the water level in tank drops, so the disruption1 turns off, so the water level in tank rises (pump still turned on)
    then the steps 2 & 3 goes again and again...

How should i change my flow so it would work as i wish?

Quick reply.

If you posted the flow as shown in the first picture, I can't help you.

You may need to make a dummy flow (well kind of) and replace all those blue nodes with simple change nodes.

Then when I press the first inject node, I get a message.

Actually it may be better if you make a few versions of the first part, so you can simulate different readings by pressing different inject nodes.

Ok, after reading the bottom bit, let's see if we can work out what's going on and how to address it.

(By the way, what you wrote at the bottom is a GREAT way to start. Get a step by step break down of what you want to do.)

So you have a tank (1) (are there others?).

Does the tank drains at a variable or fixed speed? (WRT the pump filling speed)
(This is important. You'll see later)

When the tank is low, it is filled.

When it gets full, the pump turns off.

So, back to the speed it drains and fills:
If it drains FASTER than it FILLS, there is a problem.
I'm sure you can see this.

Is there ever a time when the tank is NOT emptying?

Reading what you wrote at the bottom, I think you are describing it correctly.

My understanding:
Given the tank is originally FULL.

It is draining - slowly.

It gets to a LOW level.
-> The pump turns on. (Basic)
-> The tank fills.
-> The tank gets full.
-> The pump stops.

The tank continues to drain.
After some time it is low again.

Steps above repeat.

It will constantly cycle. Maybe how frequently - but that depends on the drain speed vs pump refill speed.

Your new code still doesn't have any else statements.
I think that may be a part of the problem.

But not sure.

Just looking at this snippet of your code:

// checking if the value of water level in tank is higher than the control point from step1
if (waterlevel_tank1_value >= waterlevel_step1) {
    disruption1_control_signal = true;
    signal_change_made = true;
}
if (waterlevel_tank1_value < waterlevel_step1) {
    disruption1_control_signal = false;
    signal_change_made = false;
}
if (waterlevel_tank1_value < waterlevel_step1 && signal_change_made === true) {
    disruption1_control_signal = true;
    signal_change_made = true;
}

The third block of code can never be executed.

Again looking at the top picture:

Sorry, could you translate all the blue nodes just after the inject node?

To me, it is more complex than it needs to be.
But that may be because I am not understanding all the inputs.

I'll also skip what happens at the bottom.
(Sorry small steps for me. I've got short legs) :wink:

Oh, checking:
The tank has 1 input and 2 outlets? Checking.

This is a start on what I can understand you want to do.

Screenshot from 2024-06-13 21-37-37

Now this isn't the FULL code that would do anything.

It is more a structure of how to do it.

[{"id":"e9c7dda108809a85","type":"inject","z":"e43e3902.57c4e8","name":"Tank full","props":[{"p":"tank_level","v":"10","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":4780,"wires":[["15d07f41a2ed6375"]]},{"id":"8fc3e6c176dcbc24","type":"inject","z":"e43e3902.57c4e8","name":"Tank low","props":[{"p":"tank_level","v":"3","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":4840,"wires":[["15d07f41a2ed6375"]]},{"id":"15d07f41a2ed6375","type":"switch","z":"e43e3902.57c4e8","name":"Full?","property":"tank_level","propertyType":"msg","rules":[{"t":"eq","v":"10","vt":"num"},{"t":"lt","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":4810,"wires":[["35fe713417721aae"],["fb9e7aa18db784cb"]],"outputLabels":["FULL","LOW"]},{"id":"35fe713417721aae","type":"function","z":"e43e3902.57c4e8","name":"Stop pump","func":"msg.payload = \"Turn pump off\"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":4780,"wires":[["aaaceb5256467aef"]]},{"id":"fb9e7aa18db784cb","type":"function","z":"e43e3902.57c4e8","name":"Start pump","func":"msg.payload = \"Turn pump on\"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":4830,"wires":[["aaaceb5256467aef"]]},{"id":"aaaceb5256467aef","type":"debug","z":"e43e3902.57c4e8","name":"debug 2535","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":4810,"wires":[]}]

I forgot the debug node

Of course you will have to put in the PLC (?) nodes you use.

And the output (debug) would go to control the pump.

You would then expand the code to open the outputs when the pump is turned OFF.

(second example of code)

[{"id":"e9c7dda108809a85","type":"inject","z":"e43e3902.57c4e8","name":"Tank full","props":[{"p":"tank_level","v":"10","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":4780,"wires":[["15d07f41a2ed6375"]]},{"id":"15d07f41a2ed6375","type":"switch","z":"e43e3902.57c4e8","name":"Full?","property":"tank_level","propertyType":"msg","rules":[{"t":"eq","v":"10","vt":"num"},{"t":"lt","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":4810,"wires":[["35fe713417721aae"],["fb9e7aa18db784cb"]],"outputLabels":["FULL","LOW"]},{"id":"8fc3e6c176dcbc24","type":"inject","z":"e43e3902.57c4e8","name":"Tank low","props":[{"p":"tank_level","v":"3","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":300,"y":4840,"wires":[["15d07f41a2ed6375"]]},{"id":"35fe713417721aae","type":"function","z":"e43e3902.57c4e8","name":"Stop pump","func":"msg.payload = {\"pump\":\"Turn pump off\", \"valve1\":\"Open valve 1\"}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":4780,"wires":[["aaaceb5256467aef","be92073759bc0b2e"]]},{"id":"fb9e7aa18db784cb","type":"function","z":"e43e3902.57c4e8","name":"Start pump","func":"msg.payload = { \"pump\": \"Turn pump on\", \"valve1\": \"Close valve 1\" }\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":4830,"wires":[["aaaceb5256467aef","be92073759bc0b2e"]]},{"id":"aaaceb5256467aef","type":"debug","z":"e43e3902.57c4e8","name":"Pump message","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.pump","targetType":"msg","statusVal":"payload.pump","statusType":"auto","x":860,"y":4700,"wires":[]},{"id":"be92073759bc0b2e","type":"debug","z":"e43e3902.57c4e8","name":"Valve message","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.valve1","targetType":"msg","statusVal":"payload.valve1","statusType":"auto","x":860,"y":4880,"wires":[]}]

This is an EXAMPLE.

But I think it is a bit simpler/easier to understand.
I hope it helps you.

Something about the comments in your code:

// checking if the value of water level in tank is higher than the control point from step1
if (waterlevel_tank1_value >= waterlevel_step1) {
    disruption1_control_signal = true;
    signal_change_made = true;
}
if (waterlevel_tank1_value < waterlevel_step1) {
    disruption1_control_signal = false;
    signal_change_made = false;
}
if (waterlevel_tank1_value < waterlevel_step1 && signal_change_made === true) {
    disruption1_control_signal = true;
    signal_change_made = true;
}

I think you need t put comments at the start of each if line group.

eg:

// checking if the value of water level in tank is higher than the control point from step1
(existing.   Ok.)
if (waterlevel_tank1_value >= waterlevel_step1) {
    disruption1_control_signal = true;
    signal_change_made = true;
}
//    What does this do?
if (waterlevel_tank1_value < waterlevel_step1) {
    disruption1_control_signal = false;
    signal_change_made = false;
}
//    And what does this do?
if (waterlevel_tank1_value < waterlevel_step1 && signal_change_made === true) {
    disruption1_control_signal = true;
    signal_change_made = true;
}

Only that the // checking if the value of water level in the tank..... is meaningless as there are 3 tests done and only one comment.

Hello,
i have 2 tanks in my model like this:


in my case i dont use 2nd tank, drain valve from tank2, coil delay, disruption 2, flow meter behind the pump.
The control signal for the pump is set to 40, the control signal set to the drain valve from tank 1 is set to 100, the control signal set to the drain valve between tanks is set to 0 (no flow) and the control signal set to disruption 1 drain valve is set to false (it is closed).

I hope at this moment everything is understandable.

Well, sorry, yes and no.

The pictures kind of help but also don't.

BUT!

It is good you have that and YOU understand how things work.

As much as I appreciate what you tried to say, I am not really getting it.
My fault.

Maybe you are concentrating too much on the values things have rather than fully understanding the system's workings.
Though it is good to know all the in's and out's of how things work, sometimes it can be confusing and complicate things when asking for help.

Ok, I'll ask a different question to see if I can learn more on how you want things to work.

Questions:
1 - how many sensors do you need/have in the entire system? (water level sensors, flow sensors etc)
2 - how many outputs do you need/have in the entire system? (eg: Controls to turn relays on/off)

So what you need to do is make a truth table of these things.

(I am not a good artist so this is an EXAMPLE only.)

And it will show you how the different values on the sensors affect the relay/pump conditions.

I fear you haven't quite got that part clear. Or, I'm not seeing it easily in what you are saying.

And you have to understand that how often (or how frequently) you apply this will have an effect on what happens.

Having the value set to 40 means.....?
If it is 100 the drain valve for tank 1 is set......????
To me the valve is either OPEN or CLOSED.
Or 0 and 100.

And really it should be 0 and 1 to either have the valve open/closed. Or more so CLOSED and OPEN.
0 = CLOSED
1 = OPEN.
Closed: no water can flow.
Open: water can flow.

What the PLC's want is a whole other thing and at this stage should be overlooked as you need to determine how it works at the basic level. Then work on the commands to the PLC, etc.

Based on the diagram above the valves do accept an analogue signal 1- 100.

Yes, but I'm confused with what the valves do with the intermediate values.

To me - as said - valves are either open or closed.

Adding the other 98 values confuses the issue.

:person_shrugging:

@STawor Did you look at @jbudd post, there is a problem with your logic ?

Some valves are fully controllable, so can be half open, for example. This gives a variable flow, not just open or closed.

Hello,
@Trying_to_learn as you asked earlier 2 questions, I will answer now:

  1. how many sensors do you need/have in the entire system? (water level sensors, flow sensors etc) - I have 3 sensors:
  • sensor 1 - gives information about water level in tank nr 1 in percentages (how much water is in the tank nr 1, 0 value - empty tank, 100 value - tank full of water),
  • sensor 2 - gives information about water level in tank nr 2 in percentages (how much water is in the tank nr 1, 0 value - empty tank, 100 value - tank full of water),
  • sensor 3 - gives information about the water flow through the pump (values measured in litres per minute)
  1. how many outputs do you need/have in the entire system? (eg: Controls to turn relays on/off) - I have 3 outputs
  • output 1 - water level in tank nr 1 in percentages,
  • output 2 - water level in tank nr 2 in percentages
  • output 3 - water flow through the pump, measured in litres per minute

I don't get why should I do the truth table based on these things, but OK, i will try. I hope this answer won't screw the topic even more.

Answering also to this:

Having the value set to 40 means.....?
If it is 100 the drain valve for tank 1 is set......????
To me the valve is either OPEN or CLOSED.
Or 0 and 100.
And really it should be 0 and 1 to either have the valve open/closed. Or more so CLOSED and OPEN.
0 = CLOSED
1 = OPEN.
Closed: no water can flow.
Open: water can flow.

You are not wrong. I am terribly sorry for not putting the units or some explanation of the values.
Values 0 and 1 for the digital drain valves linked to disruption 1 & disruption 2 that I have mean that the valve is closed or not (0 - valve closed, 1 - valve open).
"Value set to 40" - this means that this value is 40% of the maximum water flow value from pump.
Let's say that the maximum water flow value of pump is something like 5.7 litres per minute. If I wanna have flow value this big during work, I would set the pump_control_signal value to 100 in my function node in Node-Red flow.
The pump_control_signal value equal to 40 would mean that this would be 40% of the maximum water flow value from pump (~ 0.4*5.7 = 2.28 [litres per minute]).
The elements that I have like pump & drain valves controlled by the analog control signals would be controlled the same way ("0" value in function node - 0% of maximal water flow value or maximal valve opening, "100" value in function node - 100% of maximal water flow value or maximal valve opening and so on.

@smcgann99 Yes, I looked at @jbudd post, I think there might be a problem with logic in my function node. I am thinking right now how should i somehow:

  • initialize in the function node the variable that would indicate if the water level in tank1 reached a predefined certain value - variable waterlevel_step1

var signal_change_made;

  • Analize the value of the water level value from tank1 (coming from sensor 1) and see then:
  1. if the water flow is below certain value - turned off disruption 1 as it was in the start, so no disruption 1 signal change was made (so the variable signal_change_made should be false now),
  2. if the water flow is over certain value (first time) - disruption 1 turned on, so disruption 1 signal change was made (so the variable signal_change_made should be true now),
  3. if the water flow is below certain value after turning on the disruption 1 - the disruption 1 should be still turned on - disruption 1 turned on earlier, water level dropped because disruption 1 caused water flow out of tank 1 (so the variable signal_change_made should be true now),
    That it is how I would like it to work. I'm wondering whether to use the flow variable (flow scope context - mentioned here Writing Functions : Node-RED in "storing data" paraghaph (I need somehow to store the value of signal_change_made variable somewhere while my flow would be working cyclically (inject node send start message to PLC contoller, get information from PLC, analize information from PLC and send new messages to PLC and so on).

I am sorry for all the misunderstandings in this topic, somehow it is easy to forget that i may use some mental shortcuts or things like that.

It is ok not to know things.

That's how you learn. Believe me, I could write a book on it.

Now with the new information I can better understand what is going on.

And I am sorry for this LONG reply.
I'm torn between just posting the important stuff of preceding it with the reasons why I see it as important.
Just that sometimes it is good to know the WHY of things. In this case my reasons why I would do it the way I am going to (finally) get to.

however

These are INPUTS. They input data to the code.

These too are inputs.
They send information into the code to then determine what happens next.

Looking at your picture I believe you have 4 3 outputs.
P1
O1
W1
Ve2

And even this is generous as you say you don't use O1

I fear there is still confusion about the inputs and outputs.

Looking more at the picture you have even more inputs that you haven't mentioned.

You seemed to not quite get what I meant by inputs and outputs.

Point 2 you posted: (first time).
This isn't a good idea.
As the first time only happens once and so it is not worth investing a lot of code for only the first time.
(Possibly not needed)

Point 3 is..... confusing. And maybe needs a rethink of what is happening in the scheme of things.

Next thing:
(Sorry)

Yes, it is good to call the in/outputs by their names.
But all I am seeing is you are using the names as per the picture.
Which is good for points of reference when sharing with other people.

I don't know if others would agree with me, but their names aren't helping.
(This also kind of reflects on how to code)
In some replies an input is called waterlevel_tank1_value then in another it is sensor1 (to say).

At the top of your code you assign names - like you did with:

var waterlevel_tank1_value = msg.payload.signals_waterlevel_tank1_value[0];
var pump_value = msg.payload.signals_pump.value[0];
var drainvalve_tank1_value = msg.payload.signals_drainvalve_tank1.value[0];
var drainvalve_betweentanks_value = msg.payload.signals_drainvalve_betweentanks.value[0];
var watersupply_value = msg.payload.signals_watersupply.value[0];
var disruption1_value = msg.payload.signals_disruption1.value[0];
var disruption2_value = msg.payload.signals_disruption2.value[0];

That is good.
As it detaches the incoming names from the names you are going to use in the code.
Then, if you change something you change a simple name.
And you did seem to do good with the names.
pump_valve for instance.

So, back to where I was going.

Rather than saying P1 W1 WLS1 and so on, call them by their human readable names.
Pump1 (I'm not sure what w1 is), Water levelSensor1 and so on.

That way when people are reading it, they see clear names and so it makes it easier to read/understand.

Sorry for all that stuff.

Now what I don't like with the 100 possible states

Below there are TANK - which is the water in your tank/s.
PUMP - which is the pump.
FULL and EMPTY - the condition of the TANK
OUTFLOW - the rate which water is leaving your system.
L/M - liters per minute. The rate the water is going in/out of.....
MAXIMUM and MINIMUM - the largest and smallest value that would work for a situation just presented.
ALWAYS/SOMETIMES - the condition of the PUMP. Being it is always or sometimes running.

I am doing this as these are constants and they are to be read as that.
I am not shouting at you. But I need to put them in capitols to identify them as meaning the defined things.

You need to know if the pump can pump water into the tank/s FASTER than it can go out.
As if it can't: The tanks are not really needed.

Here's the part that complicates things no end:
You have a water supply. (as yet not declared)
2 x tanks to store water. (reason unknown because in/out flow rates are variable and not declared)
You haven't really declared where the pump is. Does it pump water from tank 1 to tank 2; pump from tank 2 to tank 1; or from a tank (which is unknown) to......?

Another question which is not addressed:
Do you want the pump to ALWAYS be running or SOMETIMES be running?
This gets back to the how fast can the pump fill the tank/s vs how fast are they emptying question.

So, now I'll ask something that was at the top but is now here.
What is the MAXIMUM rate of water flow the PUMP can manage?
What is the MAXIMUM rate of outflow where the water is COMPLETELY LEAVING this system?

Say:
the PUMP can do 100 L/M Just to demonstrate the problem I am seeing.
the outflow rate is 50 L/M.
the TANK (I'll leave it as 1 for now to again simplify what I'm saying) 100 L.

From this you can say you have 2 minutes of run time if the TANK is FULL to it being EMPTY.

Now, let's change ONE thing at a time.
Say the outflow can change between 0 and 50 L/M.

From this you can have a MINIMUM of 2 minutes to a MAXIMUM of .... (unknown) but let's say 1 00 minutes - depending on how fast the TANK is emptying.

So that is fine.
If the TANK gets to less than 1 L (so it has 1 minute before it is empty) and you turn on the PUMP.
In that minute (and a small bit) the TANK will be FULL.

But! - this is where it gets complicated!
(You have been warned!) :wink:

Say, the TANK has 50L in it.
You can turn on the PUMP and it will fill it is 30 seconds. (half a minute).

So there are a lot of ways you could set a MINIMUM value the TANK is before the PUMP is turned on to REFILL it.
Let's say it is 100 possible values - to keep it round.

Now let's change a SECOND variable:
the TANK's OUTFLOW rate.
It is a MAXIMUM of 50 L/M and a MINIMUM of 1 L/M
We now have another 50 possible times before the TANK goes from FULL to EMPTY.
So now we have 50 x 100 possible solutions. (5000 by the way)

WHY WOULD YOU WANT TO HAVE THAT MANY!!??

So you really need to constrain (limit) these UNLESS you don't mind the PUMP running all the time.
But this loops back to the question: why do you need the TANK?

Do you now understand the complexity of having multi-state VALVES and PUMPS?
They (ideally) should be ON or OFF.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.