The Type of Calculation that the Driver Performs
The maximum gap size used to determine whether to split a poll into more than one read request can be user defined, or be calculated automatically by the SCADAPack Modbus driver (see Specify how any Scanning Gaps are Handled).
If the driver performs the calculation automatically, it calculates the optimum maximum gap size based on the channel’s configured pre- and post-message delay, plus the time needed to transmit the header bytes on both Tx (transmitted) and Rx (received) messages.
In each case:
- The minimum gap is at least 4 registers or 40 coils or discretes
- The maximum gap is the maximum number of registers, coils, or discretes that can be read in one request (see Modbus Function Codes Supported by the Geo SCADA Expert SCADAPack Modbus Driver).
The number of header bytes varies, depending on the type of Modbus communications being used:
- Modbus RTU—With Standard addressing, the header bytes total 13 (((Address + function + 2 byte CRC) * 2) + read command + reply count)
With Extended addressing, the header bytes total 17
- Modbus ASCII—With Standard addressing, the header bytes total 25 (3 framing bytes (:CRLF) + (((( Address + function + LRC) * 2) + read command + reply count) * 2))
With Extended addressing, the header bytes total 33
- Modbus TCP—With Standard addressing, the header bytes total 21 (((TCP header (6 bytes) + address + function) * 2) + read command + reply count)
With Extended addressing, the header bytes total 25.
Example:
A device is configured to use the following:
- Modbus RTU
- Standard addressing
- A serial line at 9600 baud rate
- No pre- or post-message delay.
The driver is configured to automatically calculate the optimum maximum gap size. To do this, the driver uses one of the following calculations (depending on the type of data that is to be read):
For registers:
14 (time in ms to transmit overhead bytes) / 3 (time is ms to transmit 1 register) = 4 registers.
For coils:
14 (time in ms to transmit overhead bytes) / 2 (time in ms to transmit 8 coils)) * 8 = 56 coils.