How to speed up Modbus communication?
How to speed up Modbus communication?
Modbus communication for both Serial and TCP/IP can be optimized for speed by grouping same type of tags with contiguous I/O address. The goal is to have as little batch as possible to reduce turn around time on communication transaction.
It’s straightforward for Boolean data type, what’s concerning is all addresses must be contiguous without any skipping of addresses. And they are arranged together for Input type and Output type, or in Modbus’ “jargon”, Output Coil and Input Coil should not be mixed together. Similarly simple for Integer data type, the addresses must be arranged contiguously for either int16
or uint16
. You only need to ensure they are categorized into Input type or Output type, i.e. Input Register or Holding Register.
Note that the maximum tags per batch is 2000 for input/output coil and 125 for holding/input register. This mean we can have maximum 62 tags for data type of int32, uint32 and real32, because they all consists of 2 Registers. Anyhow, Ecava IGX will automatically split them according to the maximum allowable length according to Modbus protocol specification.
Thing gets slightly complicated for 32 bit data type like int32
, uint32
and real32
, they are built based on 2 Registers. Some vendors arranged them with skipped of addresses, some arranged them without skipping of addresses. For an instance of 32 bit data type, address listing of 2, 4, 6, 8 & 10 can be a valid continuous form of arrangement, as much as address listing of 1, 2, 3, 4 & 5.
Speed up Modbus for SCADA
This section shows the practical use of the information in SCADA software. If you haven’t, please grab a free download of Ecava IGX for the following explanation. We shall illustrate a non skipping addresses in the following example using Ecava IGX with screenshot. Note that the “Address increment for 32bit” is set to 1.
The address listing has no skipping for tags with int32
data type.
For skipped address arrangement, the “Address increment for 32bit” is set to 2.
So it could be all even numbers or all odd numbers in one batch. The example shows real32
being arranged in even numbers. Also note that there’s one dummy tag has been intentionally added at address 4×0006, so that two chunks of addresses will be treated as one chunk.
The result of contiguous arrangement, can be observed under I/O task’s Property, this Task Property Window can be toggled using the icon button, or via shortcut key Ctrl + Shift + P
. Look at the Batch column, the goal for this Batch number should be smallest possible.
To illustrate the scenario better, we shall disable the padded address to see how this will impact the outcome, by ticking off the Enabled check box.
Restart the I/O task, and you shall see that the Batch count has increased to two, and the transactional count has simply doubled. In the screenshot we captured that 33 vs 66.