[ { "id": "44d283ea6b7c10e4", "type": "tab", "label": "Flujo 2", "disabled": false, "info": "", "env": [] }, { "id": "3a43f618afbfa2f7", "type": "modbus-read", "z": "44d283ea6b7c10e4", "name": "Wind-Read", "topic": "", "showStatusActivities": true, "logIOActivities": false, "showErrors": true, "showWarnings": true, "unitid": "255", "dataType": "HoldingRegister", "adr": "0", "quantity": "2", "rate": "1", "rateUnit": "s", "delayOnStart": false, "startDelayTime": "", "server": "708f53f6157d2ec2", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "x": 100, "y": 360, "wires": [ [ "3cc6dfe7007d4f73", "f0196ac713c38671", "b5d068337b7b3f1f" ], [] ] }, { "id": "9956a0ce0ffa1692", "type": "debug", "z": "44d283ea6b7c10e4", "name": "debug RAW", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "true", "targetType": "full", "statusVal": "payload", "statusType": "auto", "x": 650, "y": 60, "wires": [] }, { "id": "3cc6dfe7007d4f73", "type": "function", "z": "44d283ea6b7c10e4", "name": "RAW", "func": "\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 390, "y": 60, "wires": [ [ "9956a0ce0ffa1692" ] ] }, { "id": "d6c4f0aeee28dff6", "type": "function", "z": "44d283ea6b7c10e4", "name": "RAW 2 m/s", "func": "msg.payload /= 100\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 140, "wires": [ [ "9eeec0837153c824", "ac8c43cb79976b82", "fe880495d58287f5" ] ] }, { "id": "9eeec0837153c824", "type": "debug", "z": "44d283ea6b7c10e4", "name": "m/s", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 930, "y": 200, "wires": [] }, { "id": "ac8c43cb79976b82", "type": "ui_gauge", "z": "44d283ea6b7c10e4", "name": "", "group": "786fd9e70bfb3a7b", "order": 1, "width": 0, "height": 0, "gtype": "gage", "title": "Velocidad Aparente", "label": "m/s", "format": "{{payload}}", "min": 0, "max": "20", "colors": [ "#21a7f8", "#21a7f8", "#21a7f8" ], "seg1": "5", "seg2": "10", "diff": false, "className": "", "x": 970, "y": 140, "wires": [] }, { "id": "fe880495d58287f5", "type": "signalk-send-pathvalue", "z": "44d283ea6b7c10e4", "name": "wind.speedApparent", "path": "environment.wind.speedApparent", "source": "node-red-wind", "meta": "{}", "x": 980, "y": 80, "wires": [] }, { "id": "f0196ac713c38671", "type": "change", "z": "44d283ea6b7c10e4", "name": "", "rules": [ { "t": "delete", "p": "payload[1]", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 500, "y": 140, "wires": [ [ "d6c4f0aeee28dff6" ] ] }, { "id": "524293978f86d016", "type": "switch", "z": "44d283ea6b7c10e4", "name": "Ajustes grados", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "1", "vt": "num", "v2": "270", "v2t": "num" }, { "t": "btwn", "v": "271", "vt": "num", "v2": "360", "v2t": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 740, "y": 460, "wires": [ [ "129be4eb1a46fa37" ], [ "617ba108d4ea2e34" ] ] }, { "id": "129be4eb1a46fa37", "type": "function", "z": "44d283ea6b7c10e4", "name": "+90 grados", "func": "msg.payload -= -90\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 440, "wires": [ [ "2182ef5de4dec356" ] ] }, { "id": "617ba108d4ea2e34", "type": "function", "z": "44d283ea6b7c10e4", "name": "- 270 grados", "func": "msg.payload -= 270\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 930, "y": 480, "wires": [ [ "2182ef5de4dec356" ] ] }, { "id": "433a508466e9cba6", "type": "function", "z": "44d283ea6b7c10e4", "name": "RAW 2 grados", "func": "msg.payload/=10\nmsg.payload = parseFloat(msg.payload).toFixed(0);\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 520, "y": 420, "wires": [ [ "524293978f86d016", "f336915d356e57c2", "ee65399e38db2339", "5d7a57aa3fd8cec9" ] ] }, { "id": "f336915d356e57c2", "type": "debug", "z": "44d283ea6b7c10e4", "name": "Dirección Real", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 780, "y": 360, "wires": [] }, { "id": "b5d068337b7b3f1f", "type": "change", "z": "44d283ea6b7c10e4", "name": "", "rules": [ { "t": "delete", "p": "payload[0]", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 420, "wires": [ [ "433a508466e9cba6" ] ] }, { "id": "ee65399e38db2339", "type": "ui_gauge", "z": "44d283ea6b7c10e4", "name": "", "group": "786fd9e70bfb3a7b", "order": 0, "width": 0, "height": 0, "gtype": "compass", "title": "Dirección Real", "label": "º", "format": "{{payload}}", "min": 0, "max": "360", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 780, "y": 320, "wires": [] }, { "id": "6ba28b152969d7ed", "type": "signalk-send-pathvalue", "z": "44d283ea6b7c10e4", "name": "wind.angleTrueWater", "path": "environment.wind.angleTrueWater", "source": "node-red-wind", "meta": "{}", "x": 1000, "y": 260, "wires": [] }, { "id": "2182ef5de4dec356", "type": "function", "z": "44d283ea6b7c10e4", "name": "a 2 de 180", "func": "let angle = msg.payload % 360;\n\nif (angle === 0) {\n msg.payload = 0; // o 360 si prefieres mostrar 360 en el tope\n} else if (angle > 0 && angle <= 180) {\n msg.payload = angle; // positiva\n} else {\n msg.payload = -(360 - angle); // negativa\n}\n//msg.payload *= -1 // invierte el signo\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1090, "y": 460, "wires": [ [ "db43738fe70d0528", "0662b9ac82b626c2", "bf89d6dd2cb68747" ] ] }, { "id": "db43738fe70d0528", "type": "ui_gauge", "z": "44d283ea6b7c10e4", "name": "", "group": "786fd9e70bfb3a7b", "order": 4, "width": 0, "height": 0, "gtype": "compass", "title": "Dirección Aparente", "label": "units", "format": "{{value}}", "min": "-180", "max": "180", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "diff": false, "className": "", "x": 1310, "y": 520, "wires": [] }, { "id": "51f2c03e3dd98307", "type": "signalk-send-pathvalue", "z": "44d283ea6b7c10e4", "name": "wind.angleApparent", "path": "environment.wind.angleApparent", "source": "node-red-wind", "meta": "{}", "x": 1300, "y": 360, "wires": [] }, { "id": "0662b9ac82b626c2", "type": "debug", "z": "44d283ea6b7c10e4", "name": "debug 2", "active": true, "tosidebar": true, "console": false, "tostatus": true, "complete": "payload", "targetType": "msg", "statusVal": "payload", "statusType": "auto", "x": 1280, "y": 460, "wires": [] }, { "id": "5d7a57aa3fd8cec9", "type": "function", "z": "44d283ea6b7c10e4", "name": "Pasa a radianes", "func": "let grados = msg.payload;\n\n// Convertir a radianes\nlet radianes = grados * (Math.PI / 180);\n\n// Asignar el resultado a msg.payload\nmsg.payload = radianes;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 780, "y": 260, "wires": [ [ "6ba28b152969d7ed" ] ] }, { "id": "bf89d6dd2cb68747", "type": "function", "z": "44d283ea6b7c10e4", "name": "Pasa a radianes", "func": "let grados = msg.payload;\n\n// Convertir a radianes\nlet radianes = grados * (Math.PI / 180);\n\n// Asignar el resultado a msg.payload\nmsg.payload = radianes;\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1100, "y": 360, "wires": [ [ "51f2c03e3dd98307" ] ] }, { "id": "708f53f6157d2ec2", "type": "modbus-client", "name": "ModBus_Wind", "clienttype": "serial", "bufferCommands": true, "stateLogEnabled": true, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "127.0.0.1", "tcpPort": "502", "tcpType": "DEFAULT", "serialPort": "/dev/ttyACM0", "serialType": "RTU-BUFFERD", "serialBaudrate": "9600", "serialDatabits": "8", "serialStopbits": "1", "serialParity": "none", "serialConnectionDelay": "100", "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 255, "commandDelay": 20, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 1000, "parallelUnitIdsAllowed": false, "showErrors": true, "showWarnings": true, "showLogs": true }, { "id": "786fd9e70bfb3a7b", "type": "ui_group", "name": "Wind", "tab": "36a5a0d798f9c3c6", "order": 1, "disp": true, "width": "6", "collapse": false, "className": "" }, { "id": "36a5a0d798f9c3c6", "type": "ui_tab", "name": "Dirección", "icon": "dashboard", "disabled": false, "hidden": false } ]