Modbus

The Modbus Device Driver allows AggreGate Server to communicate with devices supporting Modbus Protocol. These devices may be connected to the system and, like with all other types of devices, their data is converted into a unified form, so they can be accessed from different AggreGate facilities. See Devices article for more information about the "normalized" representation of devices in AggreGate.

The Modbus driver supports both network versions (Modbus TCP and Modbus UDP) and serial versions (Modbus RTU, Modbus ASCII and Modbus BIN) of the protocol. Modbus serial devices should be connected to the COM ports of the PC running AggreGate Server.

If multiple Modbus devices reside on a serial bus (e.g. RS-485 bus), all devices will be connected to AggreGate through a single device account. Registers that belong to different devices should be added to a common Registers table (see below) with different Unit ID values.

Reaching Modbus Devices via IP Network

There are two principal ways of connecting a serial Modbus device to AggreGate via an IP network:

Using a Serial-over-IP converter

In this case, the converter changes physical protocol (from Serial to Ethernet or Wi-Fi), but doesn't change application-level protocol. Therefore, Modbus ASCII or Modbus RTU data is transferred through an IP network "as is". On the server side, a Virtual Serial Port Driver is required to "catch" the IP traffic and expose it through a classic serial port. On the AggreGate Server side, a device account should be configured to work in Modbus Serial mode, communicating through the above virtual serial port.

Tibbo offers a wide range of Serial-over-IP converters (such as a DS1206 programmable controller running Serial-over-IP firmware), as well as Virtual Serial Port Driver for Windows and Linux operating systems.

Third-party converters paired by third-party virtual serial port drivers can be used for serial-over-IP conversion as well.

Using a Modbus Serial to Modbus TCP Converter

In this case, the converter changes both physical protocol (from Serial to Ethernet or Wi-Fi) and application-level protocol (Modbus ASCII or RTU to Modbus TCP). Thus, Modbus TCP data is transferred through an IP network. On the server side, AggreGate's Modbus Device Driver should be configured to work in Modbus TCP mode and directly connect to the device (or multiple devices on a bus) via an IP network.

Any of Tibbo's programmable controllers (such as a DS1206 ) that can run Modbus Converter application performing conversion physical and application protocol.

Third-party converters can be used for Modbus Serial to Modbus TCP conversion as well.

Configuring AggreGate Server For Serial Communications

See Enabling Serial Communications if you have troubles connecting to Modbus Serial devices.

Driver Information

Driver Plugin ID:

com.tibbo.linkserver.plugin.device.modbus

Global Settings

None defined.

User Level Settings

None defined.

Device Account Properties

Connection PROPERTIES

Connection settings define how AggreGate Server communicates with a certain Modbus device. These settings may be accessed using the Edit Device Properties action of Device Context. The following connection properties are available:

Property

Description

Modbus Version

A choice of Modbus TCP, Modbus UDP and Modbus Serial.

IP address or host name

Address of Modbus device (for Modbus TCP/UDP).

Port

Modbus device port (IP port number defaulting to 502 for Modbus TCP/UDP; Serial port name for Modbus Serial).

Encoding

A choice of RTU, ASCII or BIN (for Modbus Serial).

Baud Rate

Baud Rate (for Modbus Serial).

Incoming Flow Control

Incoming flow control type: None, CTS/RTS, or XON/XOFF (for Modbus Serial).

Outgoing Flow Control

Outgoing flow control type: None, CTS/RTS, or XON/XOFF (for Modbus Serial).

Data Bits

Serial data bits (for Modbus Serial).

Stop Bits

Serial stop bits (for Modbus Serial).

Parity

Serial parity (for Modbus Serial).

Timeout

Command timeout (default is 5 seconds).

Retries

Number of retries for each command.

Reconnect on every command

Forces every Modbus TCP transaction to be performed in a separate connection.

Write Mode

Defines what Modbus protocol commands will be used for setting register values:

  • Auto. Write Single Coil and Write Single Register commands will used if Size property in Device Registers equals to one. Write Multiple Coils and Write Multiple Registers commands will be used otherwise.
  • One register per command (Write Single). Write Single Coil and Write Single Register commands will used for all writes. Device Registers entries with Size greater than one will be written by multiple commands.
  • Multiple registers per command (Write Multiple). Write Multiple Coils and Write Multiple Registers commands will be used for even a single register (even Device Registers entries with Size equals to one).

Device Registers

This property contains a list of Modbus device registers that are accessed and managed by AggreGate. Once a new Modbus device is added, one or more registers have to be configured to make device data available for the system. Each Modbus register is represented by a single variable of Device Context.

Modbus devices do not provide metadata, so AggreGate Server cannot learn about available Modbus registers of a particular device. That is why it's necessary to configure Device Registers manually.

Here is a list of properties of each Modbus register:

Property

Description

Name

Register name. This will be used as a Device Context variable used to access the register, so it may contain only letters, digits and underscore.

Description

Register textual description. Will be used as the description of the Device Context variable.

Type

Modbus register type. Possible values are Coil, Discrete Input, Input Register and Holding Register.

Format

Defines how to interpret value of one or more adjacent Input or Holding Registers. See type conversion section for details.

Register Address (decimal)

Address (offset) of the Modbus register in decimal form.

This address is not an absolute address of a Modbus register. It indicates register offset from the beginning of the address space for registers of selected Type.

For example, Address (offset) 1 for a register of a Holding Register type will match to:

  • Protocol address 40000
  • Data model address 40001

Size

Number of registers to read by a single Modbus I/O operation and store in one AggreGate Server context variable. It may be useful to read multiple registers at once in the following cases:

  • If they logically represent an array
  • If they logically represent a string
  • If they logically represent different parts of a complex data item that should be read in one atomic operation

The actual number of registers read in a single I/O operation will be N * M, where

  • N is the number of registers required to hold one AggreGate Server-side value depending on Type and Format
  • M is the value of Size parameter

For example:

  • if Type is Input Register, Format is 8-byte Float, and Size is 4, server will read 32 registers and represent them as a 4-element array (single-column Data Table) with Floating point numbers
  • if Type is Holding Register, Format is Varchar, and Size is 64, server will read 64 registers and as a single-cell Data Table containing String value.

This setting has the default value of 1. The default should not be changed in most cases.

Unit ID

Modbus Unit ID. Identification (address) of a remote slave connected on a serial line or on other buses (e.g. RS485).


You can import the list of registers from a file (e.g. CSV file) by using Import function of Data Table Editor component.


If you wish to connect several similar Modbus devices to AggreGate, you could fill in the Device Registers table only once and then copy it to other devices using the Replicate action.

Device Assets

Assets are not supported by the driver.

Device Settings

Modbus device driver creates one Device setting variable per device register.

Type Conversion

The following table shows how Modbus Registers are converted to Device context variables. Note that number of rows in each variable depends on the value of Size parameter. By default, all variables are single-row, i.e. scalar.

Register Type

Format

AggreGate Server Variable Format

Coil

N/A

Readable/Writable, 1 Column of type Boolean

Discrete Input

N/A

Read-Only, 1 Column of type Boolean

Holding Register

2-Byte Int Unsigned

Readable/Writable, 1 Column of type Integer


2-Byte Int Signed

Readable/Writable, 1 Column of type Integer


4-Byte Int Unsigned

Readable/Writable, 1 Column of type Integer


4-Byte Int Signed

Readable/Writable, 1 Column of type Integer


4-Byte Int Unsigned Swapped

Readable/Writable, 1 Column of type Integer


4-Byte Int Signed Swapped

Readable/Writable, 1 Column of type Integer


4-Byte Float

Readable/Writable, 1 Column of type Float


4-Byte Float Swapped

Readable/Writable, 1 Column of type Float


8-byte Int Signed

Readable/Writable, 1 Column of type Long


8-byte Int Signed Swapped

Readable/Writable, 1 Column of type Long


8-byte Float

Readable/Writable, 1 Column of type Double


8-byte Float Swapped

Readable/Writable, 1 Column of type Double


2-byte BCD

Readable/Writable, 1 Column of type Integer


4-byte BCD

Readable/Writable, 1 Column of type Integer


Char

Readable/Writable, 1 Column of type String. Server reads number of registers specified by Size parameter and represents them as a string that will always have 64-characters length.


Varchar

Readable/Writable, 1 Column of type String. Server reads number of registers specified by Size parameter and represents them as a string. This string will be terminated by the first zero-value register.

Input Register

Any

Same to Holding Register with equal Format, but Read-Only.

Device Operations

No operations provided by the driver.

Device Events

No events provided by the driver.

Connection Handling

This driver makes the device Online if:

  • Serial port was opened successfully (for Modbus Serial devices)
  • TCP connection with the device was successfully established (for Modbus TCP devices)
  • Always (for Modbus UDP devices)

Synchronization Details

Synchronization between AggreGate Server and Modbus device includes the following steps:

  • Creating a Settings Cache according to the Device Registers list. Each variable is used to access a single Modbus device register.
  • Reading Modbus register values and storing these values in settings cache.