Modbus Server

From HSYCO
Jump to navigation Jump to search

The Modbus Protocol is a messaging structure. It is used to establish master-slave/client-server communication between intelligent devices. It is a de facto standard. The Modbus RTU specification defines the default communication protocol over serial lines. The Modbus TCP/IP specification takes the Modbus instruction set and wraps TCP/IP around it.

HSYCO’s MODBUS TCP SERVER I/O Server implements a Modbus TCP/IP server, allowing external Modbus clients to connect to HSYCO and perform any standard Modbus function.

This support is implemented as a simple Java API.

HSYCO Configuration

Options

ID Default Values Description
eventslog false true if the general eventsLog option is also true in hsyco.ini, Modbus events for this gateway are written in the log files
false Modbus events for this gateway are not written in the log files, even if the eventsLog option is true in hsyco.ini

Modbus Server Integration

The Modbus TCP Server is implemented as a multi-threaded socket server that can accept multiple concurrent connections.

There are no hard-coded limits to the number of concurrent connections and no idle time-out mechanism to disconnect connections that don’t do any traffic for a certain amount of time. A socket-level keepalive mechanism is in place to ensure that a socket thread is closed and resources freed if the client drops the connection without a graceful close.

It is the clients’ responsibility to ensure the correct handling of connections to the server.

Whenever a client sends a Modbus request to the HSYCO server, the Modbus TCP Server will execute a Java callback method passing the complete PDU as a byte array, and respond with a PDU based on the returned byte array or, if the callback method is not defined or returns null, it will execute the Modbus read or write function using its internal data tables.

Datapoints

The naming convention HSYCO uses for the events is closely related to the Modbus addressing standards and data types.

The data point names always begin with the same format: <ioserver_id>.unitid.address, where unitid is the Modbus slave device address, from 1 to 247, and address is the initial register address you are reading.

The supported public function codes are:

  • 01: Read Coils
  • 02: Read Discrete Inputs
  • 03: Read Holding Registers
  • 04: Read Input Registers
  • 05: Write Single Coil
  • 06: Write Single Register
  • 15: Write Multiple Coils
  • 16: Write Multiple Registers
  • 22: Mask Write Register

These functions read and write data on four distinct data tables:

Table Suffix Object Type Mode Functions
Discrete Inputs .di Single bit Read Only 02
Coils .co Single bit Read Write 01 05 15
Input Registers .ir 16-bit word Read Only 04
Holding Registers .hr 16-bit word Read Write 03 06 16 22

Operations on Input Registers and Holding Registers tables support the following data types:

Type code Description Return range Number of registers
ushort unsigned short integer 0 ... 65535 1
uint unsigned integer 0 ... (232 - 1) 2
ulong unsigned long integer 0 ... (264 - 1) 4
short signed short integer
1
int signed integer
2
long signed long integer
4
float signed IEEE 754 floating point
/- 2-149 ... (2-2-23)x2127 2
ID Value R/W Description

User Interface

Airzone Object

The user interface for the Airzone control framework:

File:UI Object airzone.png

The (airzone) object is listed in the Project Editor’s new object list only when at least one Airzone I/O Server is defined.

Parameters

  • server id: the server ID. Supports Redirect variables
  • zone: the zone. Supports Redirect variables
  • position: the object's position. Use the pixels or rows and columns coordinates format

Syntax

(airzone <server id>; <zone>; <position>)

E.g.

(airzone serverid; zone; x10y20)

UISET Actions

You can use any object that accepts a text attribute, usually text, but also marquee and others, to display the status of the system according to the following table:

USER Commands

The CSx75 I/O Server supports a few system commands to be inserted within the Web interface. The controls are directly supported as ordinary user objects, by setting the name and param fields according to the following table:

ID Attribute Set to
Name Param Action

Release Notes