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?