This section describes the network topology of the RAPTOR
as a Modbus Client or Server.
Modbus Client and Server Gateway Responsibilities
RAPTOR
Client and server gateways do the following:
- Translate
TCP messages to serial messages and vise versa.
- Act like a pipe encapsulating serial modbus messages in TCP
packets.
- Do not check the validity of function codes and data inside
messages. This is done in master and slave applications.
- Create exceptions and send them to the proper destination.
The
RAPTOR should be used as a client or a server when the Master and
Slave are not native TCP speakers.
Figure 1. RAPTOR as a Modbus
Client or Server

Modbus Server Role
The RAPTOR when used
as a modbus server can do the following:
- Accept up to
64 connections from clients
- Work with multiple serial interfaces simultaneously
- Support up to 247 slaves on all serial interfaces. Please note
that a much lower number of slaves is recommended for reasons surrounding
serial link contention.
- Receive TCP modbus requests from TCP modbus clients
- Validates received messages for length, function code and slave
ID
- Returns proper exception in the case of validation errors and
if return exceptions are enabled
- If there are no active transactions on the interface:
- Converts
the TCP modbus message to a serial modbus message
- Sends serial messages to the proper serial interface
- Keeps the original message for response validation
- Starts the response timer
- If ther is an active transaction on the interface, stores the
request in a queue that can hold up to 16 requests.
- When the active transaction is over (by receiving a response
or no response in the configured time), initiates new transaction
by pulling the next available request from the requests queue.
- Validates received response (length, CRC, function code, slave
ID) against the stored original request.
- Converts received responses to TCP messages.
- Sends the TCP messages to the proper master.
Figure 2. Modbus
TCP Server Topology

Modbus Client Role
The RAPTOR when used
as a modbus client can do the following:
- Receives serial
commands from the serial master
- Validates received messages (length, CRC, function code, slave
ID)
- Returns the proper exception in the case of validation error
and if return exceptions are enabled.
- Converts the serial modbus message to a TCP modbus message.
- Sends the TCP message to the server while keeping the original
request for the response validation.
- Receives a response, and validates it using the original request.
- Converts received TCP messages to serial messages.
- Sends converted serial messages to the serial master.
- Starts the response timer.
- In case of no response from the server, sends proper exception
to the master.
Figure 3. Modbus TCP Client Topology

Modbus Function and Exception Codes
A
response function code is valid if:
- The response function
code matches the request function code.
- The response function code is an exception created using the
request function code.
The exception function code is
equivalent to the request function code with its most significant
bit set to logic 1. Example: the 0x83 code is the exception for
the function code 0x03.
Table 1. Exception codes generated by a Slave
Name |
Description |
ILLEGAL_FUNCTION |
The function code is not an allowable action
for the slave. |
ILLEGAL_DATA_ADDRESS |
The data address is not an allowable address
for the slave. |
ILLEGAL_DATA_VALUE |
The data field is not an allowable value for
the slave. |
ACKNOWLEDGE |
The slave has accepted the request and is processing
it, but a long duration of time will be required to do so. |
SLAVE_DEVICE_BUSY |
The slave is engaged in processing a long-duration
program command. |
MEMORY_PARITY_ERROR |
The extended file area failed to pass a consistency
check. |
Table 2. Exception
codes generated by a Gateway
Name |
Description |
ILLEGAL_FUNCTION |
The function code is not an allowable action
for the slave. RAPTOR: returned if function code does not match
the broadcast command.
|
SERVER_DEVICE_FAILURE |
An unrecoverable error occurred while the slave was
attempting to perform the requested actions. RAPTOR: not returned
|
SERVER_DEVICE_BUSY |
The server is busy with other commands and
has no place to store the request. RAPTOR: returned if hold time
is over, no place to store the request
|
GATEWAY_PATH_UNAVAILABLE |
The gateway is mis-configured or overloaded. RAPTOR:
returned if slave is not in the slaves list. No connection to a
server.
|
GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND |
No response was obtained from the target device. RAPTOR:
no response was obtained from the target device.
|