Prepared testing materials:
- There are two nodes, one is a Modbus server, and the other is a Modbus Flex server.
- Modbus client simulation program. Testing procedure:
- Both the Modbus server and Modbus Flex server use the same IP and different ports, one using port 502 and the other using port 18502. These settings will be exchanged later.
- When the Modbus server uses port 502 and the Modbus Flex server uses port 18502, the client can connect to the Modbus server but not to the Modbus Flex server. I am guessing if this might be a port-related issue.
- Later, the port settings were exchanged, meaning the Modbus server uses port 18502, and the Modbus Flex server uses port 502. However, the client can still only connect to the Modbus server.
Questions:
- Why am I unable to establish a connection to the Modbus Flex server?
- Can the settings inside the Modbus Flex server (such as coils) be configured to immediately transmit data once received? I initially used the Modbus read node, but there were still issues with timing and system load during reading. Therefore, I want to explore the possibility of immediately passing on data when received by nodes related to the Modbus server.
Here are the configurations for the two nodes:
Modbus Server Node:
[
{
"id": "efe386f451e14b9a",
"type": "modbus-server",
"z": "0ad15c95d9e468da",
"name": "Modbus server",
"logEnabled": false,
"hostname": "0.0.0.0",
"serverPort": "502",
"responseDelay": 100,
"delayUnit": "ms",
"coilsBufferSize": "30",
"holdingBufferSize": "90",
"inputBufferSize": "670",
"discreteBufferSize": "50",
"showErrors": true,
"x": 260,
"y": 340,
"wires": [
[],
[],
[],
[],
[]
]
}
]
Modbus Flex Server Node:
[
{
"id": "ad380629.c0b74",
"type": "modbus-flex-server",
"z": "278c3ffc.fa40d8",
"name": "template modbus flex server",
"logEnabled": true,
"serverAddress": "0.0.0.0",
"serverPort": "18502",
"responseDelay": 100,
"unitId": "1",
"delayUnit": "ms",
"coilsBufferSize": 20000,
"registersBufferSize": 20000,
"minAddress": 0,
"splitAddress": 10000,
"funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === 1 && addr === 1) {\n\t\treturn node.coils.readUInt8(addr);\n\t}\n}",
"funcGetDiscreteInput": "",
"funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor) \n\t} \n}",
"funcGetHoldingRegister": "",
"funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === 1 && addr === 1) { \n\t\tnode.coils.writeUInt8(value, addr); \n\t} \n}",
"funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor) \n\t} \n}",
"showErrors": true,
"x": 240,
"y": 100,
"wires": [
[],
[],
[],
[],
[]
]
}
]