Optimizing semi-contiguous reads for modbus
-
Hi,
I've been reading some devices with mango via modbus IP over satellite. Apart from the high latency we also have a bandwidth limit and ridiculous charges for data used beyond our limit.I've noticed that if the addresses being read are contiguous they get read all at once with the 'read multiple registers' modbus command whereas if they are not strictly contiguous a seperate read request is issued for each register or group of contiguous registers.
Each read register request is about 50 bytes regardless of how many registers are read. Likewise there is an overhead of about 50 bytes per reply, regardless of how many registers are in the reply.
It takes mango 3 seconds per request-response cycle with these satellites. Cutting down the number of requests is going to allow us to increase the refresh rate and save on bandwidth charges on the satellite.
Temporarily I could add points to make the addresses contiguous but then I have all the unused points cluttering & confusing the instance.
Is the source for the com.serotonin.modbus4j package available so I could take a crack at getting the number of modbus requests we're making down?
Cheers
Craig -
Yes. Go here: http://sourceforge.net/projects/modbus4j/
-
Hi Matt,
There is only 1 zip file I can find to download on the sourceforge modbus4j website and it only has .class files in it and not .java files.I suppose knowing that BatchRead makes separate requests if there are non contiguous addresses I could insert the missing addresses in at the top of ModbusDataSource.doPoll() to get BatchRead to read bigger batches.
Cheers
Craig -
You should be able to somehow access the CVS repository. This would be more convenient should you have changes to submit. But if you have trouble getting to it let me know.
-
BTW, check out the Mango source, specifically com.serotonin.mango.rt.dataSource.modbus.ModbusDataSource at line 57. The line is this:
batchRead.setContiguousRequests(true);
Maybe try setting that to false and see what happens.
-
My first post was a link with no description, so it was censored.