MODBUS TCP to RTU gateway project

R

Thread Starter

rajendrap

I am working on modbus TCP to RTU gateway project. I have four RTU network on the single machine and on other side, I have TCP connection listening on port 502.

The problem is, many TCP clients doesn't have flexibility to change there TCP port number and I want single TCP client can connect to all my four modbus RTU networks.

I am planning to use 16-bit address where upper byte is for identifying channel Number (or RTU network number) and lower byte for identify slave within RTU network.

Does anybody have better idea/ solution?
 
I'm afraid that the TCP clients will not support this if they even do not support a different port than 502.

My idea would be to write a control register to a special slave/address that will be interpreted by your gateway and switch the connection to one of the RTU connections.

For example you could use slave=1 function=6 (PresetSingleRegister) start_adr=1 to control your TCP/RTU gateway.
 
I think the Unit ID (serial address) is sometimes used for this. The Unit ID is still present in Modbus/TCP even though it doesn't serve any purpose for Ethernet. For example port 1 could have unit IDs 1 to 32, port 2 could have unit IDs 33 to 64, etc. That is a simple solution that works with standard Modbus/TCP. You will need to check whether the client has the ability to specify the Unit ID however.
 
Use the Modbus/TCP Unit ID field, which should be supported by most clients.

Then you have two options based on gateway flexibility:

1. Segment your four RTU networks into Unit ID Groups:

Net1 = Unit ID 1-60
Net2 = Unit ID 61-120
Net3 = Unit ID 121-180
Net4 = Unit ID 181-240

2. Map Unit IDs to RTU network/node address:

Unit ID 1 = Net 1, node 1
Unit ID 2 = Net 1, node 2
Unit ID 61 = Net 2, node 1
etc.

-Mark
http://automatedsolutions.com
 
Top