supremesports
Hi,

I have an issue with the Modbus TCP modules. They work properly as to communication. The problem I have is that whenever it loses communication for any amount of time, the program seems to "stack" actions and pushes them back once the communication is back.

Actual setup for tests:
To test capabilities and the way I could implement my devices using your interface, I've made a little ladder logic toggling an output driving a LED every second plugged on an arduino using Modbus TCP.
The OpenPLC runtime is running on m laptop (eventually will be installed on a RPi B+)

The problem arise whenever there's a little glitch in the network communication.
Example, if I unplug the network cable for let say 5 seconds, when I replug the network cable, the LED will flash very fast (more than once per second as in my ladder) to "catch up" on the lost communication then it goes back to normal flash at once per second.

Am I missing something in the Modbus TCP?

Thank you

Untitled3.png 
Reply 0 0
thiagoralves
This has nothing to do with OpenPLC, but how any TCP/IP network should work. You see, by definition TCP networks guarantee packet delivery, which means that if a packet is lost for some reason, the network will try to redeliver the packet for some time until it succeeds or timeout. If you disconnect your device, those packets add up on the network (TCP stack, routers, etc) until they are all delivered or time out.

To have a “discard if fail” behavior you need to use Modbus over UDP, which unfortunately OpenPLC does not support for not being very common.
Reply 1 0
supremesports
Ok, I understand, I just wanted to make sure it was not a real problem. Is the timeout adjustable? If so, how do I do this?
Reply 0 0
thiagoralves
There isn’t an easy way to change the timeout. This is internal to the TCP stack of your OS and routers. Check this for more info:  https://stackoverflow.com/questions/13085676/tcp-socket-no-connection-timeout
Reply 1 0
supremesports
Thank you very much, I understand perfectly and will manage my code accordingly!!! 🙂
Reply 0 0
Reply