Concurrent Modbus Polling Issue


rboardley

Recommended Posts

We use the following sequence to poll a number of units on a RS485 Modbus RTU network. It uses the channel grouping and ReadGroup function to poll each device on the network. The channel groups are organised as seqential S16 registers so only a single Modbus read is performed.

The poll time is normally about 6 seconds but when we add another sequence polling loop on another serial port the poll time doubles.

We had hoped that we could poll three ports simultaneously using 3 sequences on different modbus devices and different serial ports but the poll time slows down as if they are done one at a time.

sequence 1...

for( unit = 1000, unit <= 1255, unit++ )

try

channel.ReadGroup("Unit_" + unit) //read all channels in the unit

catch("C1000") //ignore Channel not found errors

endcatch

delay(0.01)

endfor

sequence 2...

for( unit = 2000, unit <= 2255, unit++ )

try

channel.ReadGroup("Unit_" + unit) //read all channels in the unit

catch("C1000") //ignore Channel not found errors

endcatch

delay(0.01)

endfor

sequence 3...

for( unit = 3000, unit <= 3255, unit++ )

try

channel.ReadGroup("Unit_" + unit) //read all channels in the unit

catch("C1000") //ignore Channel not found errors

endcatch

delay(0.01)

endfor

The timing and offset values in the channels are set to zero, do we need to have a different offset to allow concurrent polls with the ReadGroup function?

Everything functions correctly its just the poll time increases as we start each sequence. We are using a very fast i7 processor with 6GB of RAM and Windows 7 64bit.

Is there anything we can do to speed up the polling?

Link to comment
Share on other sites

There appears to be an issue with readGroup that causes it to block. Why are you not simply using Timing and Offset and not readGroup()? Set the timing to say 6.0 for all your input channels, and then for each of the three groups provide a different offset. The difference can be minimal, say 0.00, 0.01 and 0.02. The only reason to use readGroup() would be if you wanted to do other processing only after all the channels in the group are read.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.