Meter interfaces

Protocol gateway vs transparent bridge

What a device called a gateway can do: tunnel serial bytes, convert Modbus RTU to Modbus TCP, or translate data between protocols such as BACnet and Modbus. How to test each one.

"Gateway" can mean three very different devices. A transparent bridge carries bytes over another path. A transport gateway converts one form of a protocol to another, such as Modbus RTU to Modbus TCP. A data translator reads values in one protocol and publishes them in another, such as BACnet to Modbus. Ask which of the three a product does, because each one needs a different specification and a different test.

This guide is part of the Modbus and RS-485 series.

The three functions

FunctionWhat changesWhat stays the sameExample
Transparent bridge (tunnel)The path of the bytesThe protocol, framing and addressesA serial device server that sends RS-485 bytes over TCP
Transport gatewayFraming and addressingThe function codes and register meaningsModbus TCP to Modbus RTU
Data translatorProtocol, identifiers, data types, perhaps unitsOnly what the map saysBACnet objects published as Modbus registers

One product can do more than one of these. Marketing words such as "transparent" are used loosely. Ask for the configuration screens and an example request and response.

A transparent bridge

A bridge moves the original byte stream from one path to another. A serial device server can carry an RS-485 stream over an IP network, and software on the other side presents it as a serial port. The protocol does not change. A serial IEC 60870-5-101 stream carried over TCP is still IEC 101, not IEC 104, and raw Modbus RTU bytes on a TCP socket are not Modbus TCP.

Because nothing is translated, both ends must agree on everything. Check these points:

  • the added delay, which can break the character timing that Modbus RTU uses to find the end of a frame;
  • what happens when the network connection drops and returns;
  • whether two clients can open the same serial stream at once, which puts two masters on one bus.

Commission the original protocol end to end, through the bridge.

A transport gateway

A Modbus TCP to RTU gateway understands Modbus. A TCP client sends a request to the gateway, with the address of the serial device in the unit identifier. The gateway removes the 7-byte MBAP header, adds the RTU address and CRC, sends the request on the bus and returns the reply over TCP. The register map of each device does not change. The Modbus TCP vs RTU guide explains both framings.

The capacity does change. Several TCP clients can reach one gateway, but the serial bus still carries one request at a time. The Ethernet speed does not add capacity to the bus. Ask how the gateway handles this:

  • Pass-through. Each client request goes onto the bus. Three clients polling ten meters make three times the bus traffic, and slow replies delay every client.
  • Cache. The gateway polls the bus itself and answers clients from memory. Bus traffic stays constant, but each value is as old as the last poll, and the gateway may keep answering after a meter has stopped.

Size the bus with the Modbus RTU timing calculator, and set the client timeouts longer than the gateway's serial timeout.

A data translator

A translator reads values in one data model and publishes them in another. It needs an explicit map for every point. For a BACnet temperature published as a Modbus register, the map must state:

FieldExample
SourceDevice 1201, analog-input 3, present-value
DestinationHolding register 40101
Data typeint16
Scale and unit0.1 °C, so 215 means 21.5 °C
Invalid or out-of-servicePublished as −32,768
Update ruleRead every 60 s; the register keeps its value between reads

Some information does not survive the translation. A Modbus register has no unit, no timestamp and no quality flag. BACnet status flags and priority arrays, and OPC UA status codes, have no Modbus equivalent. Decide how the receiver learns that a value is stale: a separate status register, an age register, or a heartbeat value that changes on every update.

Reading and writing are different paths

A gateway that publishes a measurement does not automatically accept control in the other direction. Writing to a published register can do one of three things: change only the gateway's memory, be rejected, or trigger a command to the field device that someone configured on purpose. The specification must say which.

Before any write test, get the command map, the permitted values, the owner of the equipment and the feedback that proves the equipment responded. Never test control by writing to a register that holds a measurement. The BACnet priority array guide explains why a BACnet write can also stay in force after you expect it to end.

Test the function you are buying

  1. Use known source values that expose errors: a negative number, a value with decimals, a large counter and a status change.
  2. Compare the source reading with the value at the receiver, at the same moment.
  3. Stop the source device while the gateway stays on. Check that the receiver sees the value as stale, not as a steady reading.
  4. Restart the gateway. Check what the receiver sees before the first fresh read: a default, zero or the old value.
  5. If writes are in scope, test them separately with the equipment owner.

Edge as a data translator

Edge, on the ZGW-20 Gateway, works as a data translator. It reads Zigbee and LoRaWAN devices, Modbus TCP and RTU equipment, BACnet/IP objects and OPC UA servers into one data model, with a unit and timestamp on every reading. It then publishes that data to energy platforms over MQTT or HTTP, or as Modbus TCP registers for a BMS or SCADA system. Treat each published point as a mapped point and test it as above. Connecting Edge to your platform describes how Edge sends data to a platform.

Common questions

What is the difference between a protocol gateway and a bridge?

A bridge (or serial tunnel) moves bytes from one path to another without understanding them, so both ends must speak the same protocol. A protocol gateway understands the protocol: it can change the framing, route requests by address, or translate values into a different protocol.

How does a Modbus TCP to RTU gateway work?

A Modbus TCP client sends a request to the gateway's IP address, with the serial device's address in the unit identifier. The gateway removes the TCP header, adds the RTU address and CRC, sends the request on the serial bus, and returns the reply over TCP. The register map of the device does not change.

What does a BACnet to Modbus gateway do?

It reads BACnet objects, such as an analog input, and publishes their present values as Modbus registers, or the reverse. Each point needs a mapping: the source object, the register, the data type, the scale and the unit. Status and priority information may not survive the translation.