github.com/tdemin/opmodbus (go): Package modbus implements a proof-of-concept thread-safe Modbus client that operates on batches of requests.  The client is designed to work on high-latency connections where an average delay between a Modbus request and the response to it gets up to a few seconds by using Modbus functions 3 and 16 to combine requests which can be merged into one. See doc of BatchRead/BatchWrite for details.  The client can also optimize batch writes by difference against an older set of values. See doc of BatchWrite for details.  1. For write operations: if differential optimization is enabled, exclude all operations whose register and value match the older written data.  2. Sort operations by register number in ascending order.  3. If out of two consecutive operations A and B the following condition holds true:  and the total quantity after merge does not exceed 2047 for reads and 123 for writes, merge operations.
Keywords: go|modbus|optimization