Skip to content

ModbusNetworkDriver

Dario Bonino edited this page May 30, 2013 · 11 revisions

The network-level driver for Modbus devices, supports ModbusTCP and Modbus RTU over TCP connections.

The driver continuously polls the Modbus registers associated to devices currently handled by Dog, converting the typical pull interaction of Modbus networks into the native event-driven operation of the Dog gateway. Polling time is uniform for all connected gateways and can be configured through the driver configuration file, i.e., through the pollingTimeMillis service property.

Upon availability (addition to the set of handled devices) of device services, the driver tries to establish a connection towards the Modbus access point (gateway) to which the device is connected, using the proper protocol variant (either TCP, RTU_TCP or RTU_UDP). If the connection is successful, it will be pooled to avoid waste of network resources and delays, and the corresponding registers will be polled according to the configured polling time. If, instead, the Modbus gateway is not accessible, the driver will re-try to connect for a maximum numTry times (0 means forever) at betweenTrialTimeMillis milliseconds intervals.

The typical configuration file for this driver is as follows

# NETWORK CONFIGURATION
# ------------------------------

# Time between 2 subsequent polls of the real modbus registers in milliseconds
pollingTimeMillis=1000 

# Time between two consecutive tests of the connection to the house (after)
betweenTrialTimeMillis=30000

# the number of connection trials...
numTry=3

It must be noticed that the Modbus protocol defines different types of registers to which correspond different encoding and sizes. The currently supported registers are identified through a register type numeric attribute defined as follows (must be reported in the device XML configuration, see the other drivers documentation):

TYPE_BOOLEAN_COIL = 0;
TYPE_2BYTE_INTEGER_HOLDING = 2;
TYPE_4BYTE_INTEGER_HOLDING_BE = 3; //word big-endian, byte little-endian (for FRER meters)
TYPE_4BYTE_INTEGER_HOLDING = 4;
TYPE_4BYTE_FLOAT_HOLDING = 5;
TYPE_4BYTE_FLOAT_INPUT = 6;
TYPE_4BYTE_INTEGER_INPUT = 7;