Modbus request/response timing

S

Thread Starter

suprita

Hi,

Can i send/pump many request from master (HMI) to the modbus PLC (slave) using TCP/IP connection? I mean for example can i send 10 request at a time one after the other without waiting for the response of the previous request? Whether modbus plc handles all the request simultaneously or one after the other or else it fails to process.
 
L

Lynn August Linse

This is vendor specific. Technically, since the earliest days of MBAP (pre-Modbus/TCP) back in the mid-1990's, Modicon tools did this and called it "pipelining". If the device peels the requests one by one from the TCP buffer, then it works fine & the PLC is not technically aware this is even happening. In fact, any device not supporting this will not work with such Modicon tools.

However, I have ran across a few odd devices which flush the TCP buffer after each read, so they would discard your 9 extra requests.

It is safe to default this true, but have some option to turn it off if required.

Also be aware that this risks building up a huge queue of thousands of stale requests if you queue 10 requests per second, and the end device can only answer 2 or 3 of them. So if you do this, make sure you wait for 10 responses (either good or exception/0x0B timeouts) before sending 10 more!
 
> Can i send/pump many request from master (HMI) to the modbus PLC (slave) using TCP/IP connection?

Yes.

Goto
http://www.modbus.org/specs.php
Read
MODBUS TCP/IP

Implementation Rules :
...
4) Several MODBUS transactions can be activated simultaneously on the same TCP Connection.

Remark: If this is done then the MODBUS transaction identifier must be used to uniquely identify the matching requests and responses.
 
F

Fred Loveless

You could if you had 10 separate Ethernet connections to the device. It will still respond to each message individually but you wont have to wait for the response to each request to make the next one.

Note 1: The controllers will only allow a certain number of simultaneous connections.

Note 2: The more connections you have the slower the responses on all will be because the controller has to do more processing. it is like doing Q&A, one on one you can respond to each question. As you add more questioners you have to start dividing your time between each one so your over all response time to everyone is slower.
 
Hello,

> Implementation Rules:
> ...
> 4) Several MODBUS transactions can be activated simultaneously on the same TCP Connection.

While the specification does contain this line I think it is used out of context. Later in the specification it reads:

Transaction Identifier

...

On TCP/MODBUS, several requests can be sent without waiting for a confirmation to the same server. The MODBUS/TCP to MODBUS serial line gateway is in charge of ensuring compatibility between these two behaviors.

I think that is where the “Transaction Identifier” is applicable, a MODBUS/TCP to MODBUS serial line gateway device.

If you continue to read the paragraph from the above quote, the specification talks about "NumberMaxOfClientTransaction" as 1-16.

There is nothing in the specification that requires a server to accept more than one request at time.

My2c.
Good luck,

Mark
http://peakhmi.com/
 
> On TCP/MODBUS, several requests can be sent without waiting for a confirmation to the same server. The MODBUS/TCP to
> MODBUS serial line gateway is in charge of ensuring compatibility between these two behaviors.

On a serial line this is evident,
because RS485 may only use 2 wires in half duplex.
The master will send a request and the slave will respond.
Thus there will be no collision on the RS485 line.

On TCP this is different because of the TCP buffer.
The gateway will read the first request and the following requests will stay in the buffer.
Then the gateway will forward the request to RS485 and wait for the response.
Once it gets the response from RS485 it will send it back to the TCP client.
Then the gateway will read the next request from the TCP buffer.
 
Top