IMDHMIControls LibraryShop main store

How-to

Linking Modbus RTU BMS SCADA to a redundant S7-1500R

Industrial networks Published 10 min read

Short answer

Use one Modbus RTU-to-TCP gateway as the Modbus TCP client, and run the Modbus TCP server on the S7-1500R system IP address that switched communication moves to the surviving CPU. The BMS keeps polling its RS-485 link unchanged; on a switchover the TCP session drops and the gateway reconnects. Set the comm-fail timeout to the measured gap plus one poll interval: 3 s at a 1 s rate in the example.

On this page
  1. How should a Modbus RTU BMS connect to a redundant S7-1500R?
  2. Does the Ethernet side handle the redundancy by itself?
  3. Does a BMS setpoint write reach both CPUs?
  4. Do you need two gateways for a redundant link?
  5. How do you configure the Modbus TCP server on the S7-1500R?
  6. How do you set up the RTU-to-TCP gateway?
  7. How long is the gap on switchover, and what comm-fail timeout fits?
  8. What should you check when the BMS reports a communication fault?
  9. Questions asked

Put one Modbus RTU-to-TCP gateway between the BMS and the redundant pair, with the gateway as the Modbus TCP client and the S7-1500R system as the Modbus TCP server on its system IP address. That virtual address belongs to whichever CPU is primary, so the PLC system itself covers failover on the Ethernet side and the gateway only has to reconnect. The steps below cover switched communication, the server and gateway settings, the timeout arithmetic with a worked example, and the symptoms you will see at the BMS when any part of it is wrong.

How should a Modbus RTU BMS connect to a redundant S7-1500R? #

Put one Modbus RTU-to-TCP gateway between them: the S7-1500R pair runs a Modbus TCP server bound to its system IP address, and the gateway works as the Modbus TCP client on port 502 and the RTU slave on the serial side.

Confirm the BMS role from its points list or integration specification before you choose the gateway, because that role decides the whole architecture:

BMS role on RS-485 Gateway role S7-1500R role Verdict
Master: it polls the link RTU slave on serial, Modbus TCP client on Ethernet Modbus TCP server on the system IP Use this. The gateway reconnects after a switchover and the BMS changes nothing.
Slave: it expects to be polled RTU master on serial, Modbus TCP server on Ethernet Modbus TCP client aimed at the gateway Workable. The client runs in the PLC and must re-open its connection after a switchover, so the program needs connection-state handling.

A BMS that polls as RTU master is the first row, and the rest of this article assumes it. Dedicated serial-to-Ethernet converters do this job; if you would rather run the conversion in software, an industrial mini PC as the protocol converter host belongs in the same cabinet as the switch. Either way, keep protocol conversion outside the redundant pair, where switched communication already covers failover and the CPUs stay on plain Ethernet. If a serial module inside the R rack comes up as an alternative, the S7-1500R/H system documentation states which modules are released for redundant operation.

Does the Ethernet side handle the redundancy by itself? #

Yes: switched communication does it. The S7-1500R pair shares one virtual system IP address that only the current primary CPU answers on, so the gateway always talks to one fixed address and never manages the failover itself.

Four terms carry the rest of this article. The primary CPU executes the program and services communication; the backup CPU is synchronized and ready to take over. Each CPU keeps its own device IP on its PROFINET interface. The system IP is an additional virtual address that belongs to the primary role, and switched communication is Siemens' name for talking to it.

Siemens implements the system IP with the Virtual Router Redundancy Protocol: the pair backs it with a virtual MAC address from the 00-00-5E-00-01-xx range. When the backup takes over, the system IP and its virtual MAC move with the primary role, so switches and the gateway keep valid ARP entries and nothing on the network has to relearn an address. The two CPUs sit on a PROFINET ring running MRP, and the redundancy synchronization runs over that ring.

A switchover tears down the TCP sessions that terminate on the system IP. The new primary's server returns to its listening state and the client re-establishes the session, so the gateway sees the PLC drop off the network and come back. A connection aimed at a device IP terminates on that one CPU and does not follow the primary role, which is why the gateway must never target a device IP.

Does a BMS setpoint write reach both CPUs? #

Yes. The write arrives through the system IP at the primary, lands in the primary's data block, and redundancy synchronization copies it to the backup, so both CPUs hold the same setpoint before and after any switchover.

Program the write path deliberately. The BMS writes into a small set of writable registers in the Modbus data block; your logic validates each value and moves it to the real setpoint tag. Nothing in the program may write to those writable registers, or a BMS write is overwritten on the next scan. Reads and writes share that one register image, and synchronization keeps it identical on both CPUs.

No. The BMS gives you one RS-485 port and one serial segment, so that leg is single-channel by definition; a second gateway adds bus arbitration problems and no availability.

The chain is as available as its weakest link, and here that is the serial leg, not the gateway or the CPUs. Duplicating the gateway puts two transmitters on one RS-485 bus and buys nothing. Terminate and bias the RS-485 segment exactly as the gateway and BMS installation instructions specify, because the usual serial faults start there, not in the redundancy.

How do you configure the Modbus TCP server on the S7-1500R? #

Work through nine steps in TIA Portal: three addresses, one released server instruction, one dedicated data block, a connection bound to the system IP on the default Modbus port, and one server instance per concurrent client session.

  1. Give each CPU its device IP on PROFINET interface X1.
  2. On the same interface, enable the system IP address for switched communication, in the subnet the gateway will use. Write down all three addresses: CPU 1, CPU 2, system IP.
  3. Open the Modbus TCP server instruction help and confirm it lists the CPU 1515R-2 PN at your installed firmware version, together with any restrictions it states for redundant systems.
  4. Create one dedicated data block as the Modbus register image; do not scatter registers across blocks the program reuses.
  5. Copy process values into the read-only registers every cycle or on change.
  6. Validate and move BMS setpoints out of the writable registers; the program never writes into registers the BMS owns.
  7. Bind the server connection to the system IP, not a device IP, on local port 502 unless the BMS integration specifies another port.
  8. Call one server instance per concurrent connection the gateway opens; some gateways open a session per RTU slave ID or per request queue, so check the gateway's session behavior.
  9. Download to the redundant system and confirm both CPUs report synchronized operation before any communication test.

Pack the register map contiguously: a BMS read that steps over an unmapped gap comes back with an exception instead of data, the same failure mode as why a Modbus read that crosses a register map gap returns exception 02.

How do you set up the RTU-to-TCP gateway? #

Match the serial side to the BMS exactly — baud rate, parity, stop bits and the RTU slave ID or IDs it polls — then give the Ethernet side a static address in the system IP's subnet and point its client at the system IP.

  • Serial settings: mirror the BMS one for one. A parity mismatch on RTU fails quietly until you scope the line.
  • Slave mapping: map the RTU slave ID the BMS polls to the single Modbus TCP server. If the BMS polls several IDs, map each to its own register range or session as the gateway allows.
  • Ethernet settings: static address in the system IP's subnet, on the same switch segment as both CPUs.
  • Reconnect behavior: set the client reconnect retry to 1 s, so the session returns promptly once the new primary starts listening.
  • First check: ping the system IP from the gateway's subnet, then confirm the TCP session shows established on the gateway before the BMS starts polling.

If your integration is the second table row instead, every setting flips with it: the gateway becomes the server, the PLC runs the client, and the client code owns the reconnect after a switchover.

How long is the gap on switchover, and what comm-fail timeout fits? #

Budget the BMS comm-fail timeout at three poll intervals or the measured switchover gap plus one poll interval, whichever is larger; with a 1 s poll rate and a measured 2.0 s gap, both rules land on 3.0 s, so set 4 s.

The gap has three parts: the switchover itself, the new primary returning to listening, and the gateway's reconnect retry. You measure the total from outside at commissioning, and no datasheet number replaces that measurement. What you can size on paper today is the serial leg and the timeout rule.

Worked example, with illustrative inputs you replace at commissioning: the BMS polls 40 holding registers in four reads of 10 registers, once per second, at 9600 baud with even parity and one stop bit, so every character is 11 bits on the wire.

  • Character time: 11 bits ÷ 9600 bit/s = 1.146 ms.
  • Request frame, 8 bytes: 8 × 1.146 ms = 9.2 ms.
  • Reply frame, 10 registers: 1 + 1 + 1 + 20 + 2 = 25 bytes, so 25 × 1.146 ms = 28.7 ms.
  • Framing silence of 3.5 characters at each frame edge in the exchange: 2 × 3.5 × 1.146 ms = 8.0 ms.
  • One poll: 9.2 ms + 28.7 ms + 8.0 ms = 45.9 ms, plus the slave turnaround you measure on the link.
  • Full scan: 4 × 45.9 ms = 183.6 ms, call it 184 ms, which is 184 ms ÷ 1000 ms = 18% of the 1 s cycle.

The serial leg fits the poll rate with more than five times the scan time to spare, so the timeout, not the wire, decides whether a switchover alarms. Three missed replies at a 1 s interval give a 3.0 s window, and the example's measured 2.0 s gap plus one interval also gives 3.0 s, so a 4 s comm-fail timeout lets one switchover pass silently. If your measured gap comes in above 3.0 s, widen the timeout to gap plus one interval, or accept a single alarm that clears itself and alarm on stale data instead, the pattern in creating a SCADA PLC communication alarm for link loss. Slow serial settings and long point lists stretch this arithmetic the same way they do in why Modbus RTU drive polling on one serial port is slow.

What should you check when the BMS reports a communication fault? #

Read the symptom before touching the PLC: a link that dies permanently at the first switchover means the gateway targets a device IP, and an alarm that clears by itself means the BMS timeout is shorter than the reconnect time.

  • Works until the first switchover, then dead: the gateway targets a device IP. Compare the gateway's target address against the system IP in TIA Portal.
  • Comm-fail alarm on every switchover, self-clearing: the BMS timeout is shorter than the gap. Measure the gap and apply the rule above.
  • Values freeze with no alarm: the gateway serves cached registers while its TCP session is down. Pull the gateway's Ethernet cable during a test; the BMS must alarm, and if it does not, its side has no freshness check.
  • No connection at all: system IP not enabled, wrong subnet, or the server not listening. Ping the system IP from the gateway subnet, then read the connection status on both ends.
  • A write is accepted, then the value reverts: the program overwrites the writable registers every scan. Watch the data block online while the BMS writes.
  • Intermittent connection refusals: the gateway opens more sessions than you called server instances. Compare its session count with the instances in the program.

Two commissioning checks close this out. Force a switchover and time the reply gap at the BMS; that number sets the timeout. Then pull the gateway's Ethernet cable and confirm the BMS alarms on stale data rather than reading a cache. Force the switchover only with the process in a safe state: a test switchover is a real one, and the outputs follow the program straight through it.

Questions asked

Can the gateway hold two TCP sessions open, one to each CPU, for faster failover?

No. A session aimed at a device IP terminates on that one CPU and does not follow the primary role, so a second session to the other CPU just recreates the single-CPU problem while doubling server load. Keep one session aimed at the system IP: the address and its virtual MAC move to the new primary in one step, so there is no ARP wait before the reconnect.

What changes if the BMS expects to be polled instead of polling?

The gateway flips: RTU master on the serial side and a Modbus TCP server on Ethernet, and the S7-1500R side runs a Modbus TCP client instruction aimed at the gateway address. Because the client lives in the PLC program, the code must detect a failed connection and re-open it, and after a switchover the new primary has to re-establish the session itself. Poll the gateway no faster than the serial leg allows.

Is a Modbus write lost if the switchover lands mid-transaction?

Treat it as unknown, not lost. If the session tears before the reply, the gateway times out, retries, and the retried write lands on the new primary. Once a reply comes back, the value sits in the primary's data block and synchronization carries it to the backup. Have the BMS re-send any write that timed out once communication recovers, which is standard client practice.

Can you use a serial Modbus module in the redundant rack instead of a gateway?

Not as the design path. The S7-1500R/H system documentation defines which modules are released for redundant operation, so any module must be checked there first. Even a released module leaves the single RS-485 leg at the BMS as the weakest link, and it moves protocol work inside the pair that an external gateway does just as well while keeping the CPUs on plain Ethernet.

How do you measure the real switchover gap during commissioning?

With the process in a safe state, force a switchover or pull the primary's PROFINET cable, and time the outage from the outside: ping the system IP once a second from a laptop and count missed replies, or read the timestamps of the comm-fail alarm and its clear at the BMS. That measured number, not a datasheet figure, sets the timeout budget.

Keep reading

  • How-to

    How to build a virtual PLC test bench for protocol practice

    One laptop runs the whole bench: a Modbus TCP server simulator, a master test client, a Node-RED OPC UA server and a SCADA trial connect over loopback, so you can practice addressing, sessions, scaling, alarms and fault diagnosis without a PLC. Work through three bounded projects and finish with seven pass criteria you can defend.

    Industrial networks

  • Troubleshooting

    Reading Modbus TCP from a ControlLogix PLC without a gateway

    Yes — ControlLogix reads Modbus TCP without a gateway card through Rockwell's sample Modbus TCP driver, but only on controller firmware version 20 or later with socket-capable Ethernet hardware such as a 1756-EN2xx module at firmware 5.007 or later. If either side misses the gate, use a standalone EtherNet/IP to Modbus TCP converter. When the driver runs, prove one request against a known-good PC client and match unit ID, start address and count field by field.

    Industrial networks

  • Troubleshooting

    How a SCADA client reads a small PLC over EtherNet/IP

    An Ethernet link to a MicroLogix is not a working SCADA read: the controller serves data through PCCC commands carried over EtherNet/IP, and a client without that application service gets every read rejected. Check the driver's documented controller list for PCCC over EtherNet/IP or use the controller's documented Modbus TCP server, then prove one read-only value end to end.

    Industrial networks