ITADN

Modbus Communication Failure

#564Openxzcdgit 创建于 2026-03-09
bug
X
xzcdgitcommented
### Which node-red-contrib-modbus version are you using? 5.43.0 ### What happened? In version 5.43.0 of node-red-contrib-modbus, the Modbus communication may unexpectedly stop working without any error prompts from the nodes. The communication can only be restored to normal by manually disabling and then re-enabling the modbus-client node. ### Server Other/External server ### How can this be reproduced? The issue occurs without any discernible pattern, and may only happen once every one to two months. The Modbus server is a Siemens S7-200 SMART PLC Node-RED flow configuration (JSON) for the affected Modbus setup: [ { "id": "bb77bd643449b97b", "type": "inject", "z": "7276883c80c2708b", "name": "Trigger Read", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" }, { "p": "msg.timeOut", "v": "5000", "vt": "num" } ], "repeat": "5", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "{\"fc\":3,\"unitid\":1,\"address\":0,\"quantity\":50}", "payloadType": "json", "x": 330, "y": 660, "wires": [ [ "fec25ced39ff7b70" ] ] }, { "id": "fec25ced39ff7b70", "type": "function", "z": "7276883c80c2708b", "name": "Prepare Request", "func": "msg.timeOut = 20000;\nmsg.payload = { 'fc': 3, 'unitid': 1, 'address': 0, 'quantity': 70 };\nreturn msg;\n", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 520, "y": 660, "wires": [ [ "9f674b9329897219" ] ] }, { "id": "9f674b9329897219", "type": "function", "z": "7276883c80c2708b", "name": "Split Request", "func": "// Set maximum number of registers to read per request\nconst MAX_QUANTITY = 100;\n\n// Input validation\nif (!msg.payload || typeof msg.payload !== 'object') {\n node.error(\"Invalid payload format\", msg);\n return null;\n}\n\n// Get request parameters\nconst { fc, unitid, address, quantity } = msg.payload;\n\n// Initialize message array\nlet messages = [];\n\n// Calculate number of chunks needed\nconst chunks = Math.ceil(quantity / MAX_QUANTITY);\n\n// Generate split requests\nfor (let i = 0; i < chunks; i++) {\n // Calculate start address and quantity for current chunk\n const chunkSize = Math.min(MAX_QUANTITY, quantity - i * MAX_QUANTITY);\n const chunkAddress = address + i * MAX_QUANTITY;\n\n // Create new request object\n messages.push({\n fc,\n unitid,\n address: chunkAddress,\n quantity: chunkSize\n });\n}\n\n// Construct final message object\nmsg.payload = messages;\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 700, "y": 660, "wires": [ [ "43b501c35bd37934" ] ] }, { "id": "46565060abcf1e3d", "type": "modbus-flex-getter", "z": "7276883c80c2708b", "name": "Data Read", "showStatusActivities": false, "showErrors": false, "showWarnings": true, "logIOActivities": false, "server": "2a21de5643686fcc", "useIOFile": false, "ioFile": "", "useIOForPayload": false, "emptyMsgOnFail": false, "keepMsgProperties": false, "delayOnStart": false, "startDelayTime": "", "x": 1180, "y": 660, "wires": [ [], [] ] }, { "id": "e2c8132c8a56b275", "type": "delay", "z": "7276883c80c2708b", "name": "", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "5", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1010, "y": 660, "wires": [ [ "46565060abcf1e3d" ] ] }, { "id": "43b501c35bd37934", "type": "split", "z": "7276883c80c2708b", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "property": "payload", "x": 850, "y": 660, "wires": [ [ "e2c8132c8a56b275" ] ] }, { "id": "2a21de5643686fcc", "type": "modbus-client", "name": "Roof Welding Dust Collector 03 Controller Info", "clienttype": "tcp", "bufferCommands": true, "stateLogEnabled": false, "queueLogEnabled": false, "failureLogEnabled": true, "tcpHost": "10.70.36.155", "tcpPort": "702", "tcpType": "DEFAULT", "serialPort": "/dev/ttyUSB", "serialType": "RTU-BUFFERD", "serialBaudrate": 9600, "serialDatabits": 8, "serialStopbits": 1, "serialParity": "none", "serialConnectionDelay": 100, "serialAsciiResponseStartDelimiter": "0x3A", "unit_id": 1, "commandDelay": 1, "clientTimeout": 1000, "reconnectOnTimeout": true, "reconnectTimeout": 2000, "parallelUnitIdsAllowed": true, "showErrors": false, "showWarnings": true, "showLogs": true } ] ### What did you expect to happen? _No response_ ### Other Information _No response_
0 条评论