Argonne-National-Laboratory / node-red-contrib-modbustcp

Node-Red nodes for communicating with a Modbus TCP server
Other
14 stars 15 forks source link

Cannot have two modbus tcp outputs to the same modbus server - connection failures #35

Open polarlightning opened 4 years ago

polarlightning commented 4 years ago

I tried to use this with relatively popular SIEMENS LOGO!8 PLC, with modbus-tcp server enabled. All works nice, when I add first modbus-tcp output node to Node-RED flow. When I add a second one, then both outputs start to fail as connections starts to break and neither output is working, or just one is working time-to-time. I like the idea of configuration node for modbus-tcp server, which allows defining such server just once, so it can be referred to in read and write nodes thereafter. My expectation was, that this separate configuration of server means that all requests, at least from the same Node flow, to it will be queued to the same tcp connection, as is the way how SCADA systems and equivalent automation systems work, to my best knowledge. PLC devices and simpler modbus-devices have typically limited processing and memory resources for IP stack services, so optimal way to use them is single-connection with request queues.

I was not able to find answer in documentation, of what is the intended modbus-tcp connection behavior in this code.

jhalag commented 3 years ago

I believe the node uses the configuration from the config node, but creates a separate TCP connection for each node using it. I've experienced a similar issue.

As a workaround until such point as it implements TCP connection reuse (A feature I'd like to see implemented as well) I would suggest creating a single output node in NodeRED, and using link nodes to connect to it from your various flows - then there is only a single TCP connection.