Jump to content

Recommended Posts

Hello, everybody,

Here's a little question about Modbus RTU: we are using V120 as modbus master to 3 devices. On visilogic we have one modbus configuration and three subroutines for each slave (6..10 read-write steps for each). When all the slaves are online, all is good, but when one or more slaves are offline (due some problem) we have a time lag for the other slaves. Maybe someone could share som thoughts how to keep other slaves data update when some of them are offline? Thank you very much!

Link to comment
Share on other sites

  • MVP 2014

Presumably the master program reads/writes each slave in turn, and waits for one slave to respond before talking to the next one.

The issue is most likely the Modbus timeouts and retries. While all slaves are present the cycle is fast becuase each slave answers and allows the master to proceed to the next slave. If one slave is missing, the master waits on the timout and retries before giving up and going to the next slave. The default is 1 second timeout and 3 retries, which gives a delay of 3 seconds.

There are a few ways of fixing this.

1. Reduce the timeout and/or retries value. Beware that if you reduce this too far, you will start to see missed communications even when the slave is good. To get the optimum time, reduce the timeout until you see regular missed communications then increase it to maybe 2 or 3 times that value (anyone with experience in the field is welcome to add further comments here).

2. Set up automatic logic that disables communications to a given slave if it sees more than "X" number of missed communications. It could re-try on a slow cycle (every 1 minute for example) or require manual reset once the slave is confirmed to be back online.

3. Have a manual process, where the operator can tell the master PLC that slave "X" is offline, so don't try to communicate with it.

(Posted too slow, between starting and ending my response, Joe got in ahead of me :) )

Link to comment
Share on other sites

It is pretty typical to reduce the frequency you "test" for communication to an unresponsive slave. You need to build in a means to record the condition of each device. If you are continuosly polling anyhow, the re-tries might as well be set to a minimum. You'll get it the next time around anyway. The timeouts are normally set way too conservatively. Keep decreasing it until you find the point where things start to break down. Then double it. You will find you are still vastly faster yet with a good margin. Of course your baud will affect this as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...