Problem Overview
When an S7-400H redundant PLC pair (for example CPU 410-5H or CPU 414-5H PN/DP) communicates with a SENTRON PAC3200 power monitoring device over Modbus TCP using the S7-OPENMODBUS/TCP REDUNDANT PN-H library, both H-CPUs attempt to open a Modbus TCP client connection to the same server IP and to TCP port 502. Only one of these connections (typically connection 0A from CPU0) is established successfully. The second connection (1A from CPU1) returns a connection error and remains inactive.
If the active CPU is disconnected from the network (cable pull, switch port down, or CPU STOP/STOP-with-redundancy-loss), the standby CPU eventually establishes its connection after approximately one minute. Until that interval has elapsed, the redundant system has no live Modbus TCP path to the meter, and any read or write service issued through the failed connection returns an error code from the STATUS output of the MB_RED_CLIENT or openModbusTCP PN-H block.
This behavior is not a bug in the S7-OPENMODBUS/TCP REDUNDANT PN-H library. It is a hard architectural constraint of the SENTRON PAC3200 integrated Ethernet port when used as a Modbus TCP server on port 502.
Affected Hardware and Firmware
| Component | Order Number / Designation | Minimum Firmware | Behavior |
|---|---|---|---|
| SENTRON PAC3200 (integrated Ethernet port) | 7KM2112-0BA00-3AA0 | V 2.3.5 | Accepts two simultaneous Modbus TCP connections on port 502 only when a Switched Ethernet PROFINET module is fitted. Integrated port alone holds one connection. |
| SENTRON PAC3200 with 7KM9300-0AE01-0AA0 | 7KM2112-0BA00-3AA0 + 7KM9300-0AE01-0AA0 | V 2.3.5 | Holds two simultaneous Modbus TCP connections on port 502 via the expansion port. |
| SENTRON PAC4200 (integrated Ethernet port) | 7KM4212-0BA00-3AA0 | V 1.4.0 (any production build) | Accepts two simultaneous Modbus TCP connections on port 502 from the integrated port. |
| S7-OPENMODBUS/TCP REDUNDANT PN-H | Library included in STEP 7 V5.5 / TIA Portal HSP | Library V2.x | Opens two client connections (0A, 1A) to the configured server. Requires server-side support for two TCP sockets. |
| SIMATIC S7-400H CPU 410-5H | 6ES7410-5HX08-0AB0 | Firmware V8.x | Runs the openModbusTCP REDUNDANT PN-H block. Standard H-system behavior. |
| SIMATIC S7-400H CPU 414-5H PN/DP | 6ES7414-5HM06-0AB0 | Firmware V6.x | Verified with two simultaneous connections to PAC3200 port 502 when expansion module fitted. |
Root Cause Analysis
Modbus TCP is a request/response protocol that uses a single TCP port (502) on the server. The IP stack on the server distinguishes individual client sessions by the source IP and source TCP port tuple. A server that supports N simultaneous clients must maintain N independent TCP sockets bound to port 502.
The SENTRON PAC3200 with the integrated Ethernet port implements exactly one such socket. A second CONNECT from a different client IP is answered with a TCP RST, which the S7-OPENMODBUS/TCP REDUNDANT PN-H block surfaces as an ERROR = TRUE with status word STATUS = 16#8381 (connection could not be established) on connection 1A. CPU0 owns connection 0A, which the PAC3200 already has in its accept queue, so that connection is the only one that stays alive.
When the active CPU loses its physical link, its TCP session times out (default 1 second FIN_WAIT retransmit per the Siemens Modbus/TCP REDUNDANT support article, plus the configured keep-alive). Only after the PAC3200 has closed the half-open socket from its end can the standby CPU complete its CONNECT. With typical 1-second TCP re-transmit and PAC3200 close latency, the recovery window is between 30 and 90 seconds under normal conditions. This matches the symptom described in the original report.
Diagnostic Steps
- Confirm the meter model and firmware. Read the firmware version on the PAC3200 display (Settings → Info → Firmware) or via the device Web server. If the value is below V 2.3.5, the device will not accept two connections even with the expansion module fitted.
-
Confirm whether the PAC3200 has the Switched Ethernet PROFINET module. Open the device Web page (Communication → PROFINET) or check the physical rear slot. Module order number
7KM9300-0AE01-0AA0must be present and the device restarted so that the expansion port is the active Modbus TCP interface. -
Capture the TCP exchange with Wireshark. Filter on
port 502from the IP of CPU0. You will see aSYN→SYN,ACK→ACKfor connection 0A. From the IP of CPU1 you will seeSYN→RST,ACKreturned by the PAC3200, confirming server-side rejection. -
Inspect the connection status outputs of the openModbusTCP REDUNDANT PN-H block. In STEP 7 / TIA Portal online view, the
CONNECTION_0A_OKandCONNECTION_1A_OKbits confirm the asymmetry. If only one is TRUE, the server is single-connection. - Pull cable on CPU0 and time the failover. A working single-connection workaround has a 30 to 90 second blackout. A correctly redundant system has 0 to 2 seconds (one TCP retransmit) of blackout.
Resolution Paths
Select the resolution that matches the hardware you have on site. Do not attempt a software-only patch; the limit is enforced by the PAC3200 TCP stack.
Option A - Replace PAC3200 with PAC4200
Replace the meter with a SENTRON PAC4200 (7KM4212-0BA00-3AA0). The PAC4200 integrated Ethernet port supports two simultaneous Modbus TCP server connections on port 502. No code or block changes are required in the S7-400H. The IP address, subnet mask, and gateway can be cloned 1:1 from the PAC3200. The Modbus register map of the PAC4200 is a superset of the PAC3200 map, with extra input and holding registers for harmonics, THD, and energy counters.
Key parameters to re-check after replacement:
- Modbus TCP port: still 502 by default.
- Unit ID: 255 (default, same as PAC3200).
- Byte order: Big-Endian (most significant word first), same as PAC3200.
- Register 1 (Voltage L1-N), register 13 (Active power total), register 25 (Energy import) used in most PAC3200/PAC4200 projects are at the same addresses.
Option B - Add the Switched Ethernet PROFINET Module
Fit the expansion module 7KM9300-0AE01-0AA0 into the PAC3200 and update the firmware to at least V 2.3.5. The expansion port becomes the Modbus TCP server. Two simultaneous connections from two different H-CPUs will be accepted. The integrated port of the PAC3200 is then disabled for Modbus TCP traffic and is reserved for the device Web server and parameterization with SENTRON powermanager.
Option C - Accept Single-Connection Mode and Tune Recovery Time
If a hardware change is not feasible, configure the S7-OPENMODBUS/TCP REDUNDANT PN-H block to retry the failed connection aggressively. The block exposes a RETRY_TIME input (default 1000 ms) and a connection supervision timer. Setting RETRY_TIME to 250 ms brings the failover window from approximately 60 seconds down to approximately 15 seconds on a PAC3200. The TCP layer of the PAC3200 enforces a minimum of one second between connection close and new CONNECT accept, so a value lower than 250 ms does not yield further improvement.
Connection Re-establishment Timing
| Stage | Default Value | Tunable | Effect on PAC3200 |
|---|---|---|---|
| TCP keep-alive interval | 30 s (S7-400H PN interface) | Yes, via PROFINET interface parameters | Determines when CPU1 sees the half-open socket as dead. |
| TCP retransmit on lost SYN | 1 s, exponential to 60 s | OS-dependent, not user-tunable on S7-400H | Sets the floor on the first retry. |
| Modbus server socket close latency (PAC3200) | 1 s after FIN or RST received | No (firmware- enforced) | Hard 1 s gap before next CONNECT is accepted. Documented in the Siemens Modbus/TCP REDUNDANT support article. |
| OpenModbusTCP REDUNDANT retry interval | 1000 ms (RETRY_TIME input) | Yes, 100 ms to 60000 ms | User-side retry after the previous attempt returned ERROR. |
| End-to-end failover (Option A/B) | 1 to 2 s | n/a | Healthy redundant system. |
| End-to-end failover (Option C, tuned) | 10 to 15 s | RETRY_TIME = 250 ms | Acceptable when hardware upgrade is blocked. |
| End-to-end failover (Option C, default) | 45 to 90 s | RETRY_TIME = 1000 ms | Out-of-the-box behavior reported in the original incident. |
Sample TIA Portal Configuration (MB_RED_CLIENT)
For S7-1200/1500 retrofits using MB_RED_CLIENT, the equivalent parameters are configured in the instruction's background DB. The following values mirror a tuned single-connection failover against a PAC3200:
// MB_RED_CLIENT background DB (TIA Portal V17 or later)
// Used when the standby connection is not yet established
REQ := TRUE; // Triggered cyclically
ID := 1; // Connection ID, must match MB_SERVER side
CONNECT_MODE := 0; // 0 = TCP (Modbus TCP)
IP1..IP4 := 192,168,10,50; // PAC3200 IP
RemotePort := 502;
LocalPort := 0; // Any
ActiveEstablished := TRUE; // Client opens the socket
ConnectionType := B#16#0C;// TCP/IP native
ConnectTimeout := 5000; // 5 s connect timeout
RetryTime := 250; // 250 ms between retries (Option C tuning)
MbReqTimeout := 1000; // 1 s per Modbus request
MbConnectionType := B#16#03;// Modbus TCP, 1 = TCP client
The same parameter layout applies to the S7-OPENMODBUS/TCP REDUNDANT PN-H block on S7-400H, except the parameter is RETRY_TIME on the RED_OPEN_MODBUS_PN_H FB input pin rather than on a TIA Portal instruction.
Alternative Architectures
Serial Modbus RTU via Gateway
If only one Modbus TCP socket is acceptable at the meter, run Modbus RTU on the PAC3200 RS485 port (available on the PAC3200 base unit) and terminate it into a PROFINET-to-Modbus-RTU gateway that supports two parallel TCP server sockets on the H-CPU side. The PAC3200 RS485 port supports up to 31 slave addresses and is fully independent of the Ethernet port.
OPC UA Aggregation in Ignition
For supervisory layers, an Ignition OPC UA server can aggregate a single Modbus TCP connection from the PAC3200 and expose the values redundantly to both H-CPUs and the SCADA. The active connection is mirrored to a backup tag set, and a tag expression on the SCADA side picks the set whose ConnectionState quality is Good. This does not give the PLC a redundant read path - the SCADA does. Use this only when PLC-level redundancy is not a hard requirement.
PROFINET Energy Metering
The SENTRON PAC3200 and PAC4200 both expose their measured values over PROFINET when the 7KM9300-0AE01-0AA0 module is fitted. With PROFINET you get one PROFINET IO connection per H-CPU, both with sub-100 ms failover, and you can avoid Modbus TCP altogether. This is the recommended path on new installations.
Verification and Commissioning
- Bring both H-CPUs to RUN and confirm the S7-OPENMODBUS/TCP REDUNDANT PN-H block shows
CONNECTION_0A_OK = TRUEandCONNECTION_1A_OK = TRUEin online view. - Read register 1 (Voltage L1-N) on both connections and confirm the values match to the last digit. A mismatch indicates you are polling two different meters or one connection is reading a stale buffer.
- Pull the PROFINET cable of CPU0. The
CONNECTION_0A_OKbit must go FALSE within 2 seconds. TheCONNECTION_1A_OKbit must remain TRUE. Register 1 must continue to be updated. - Restore the CPU0 cable. The 0A connection must re-establish within 2 seconds and resume polling without a controller STOP/START.
- Force a H-system failover (CPU0 STOP). The system must remain in RUN-redundant on CPU1 and the Modbus TCP service must not interrupt more than the configured
RETRY_TIME.
Troubleshooting Matrix
| Observed Symptom | Likely Cause | Action |
|---|---|---|
| 0A establishes, 1A rejected with STATUS 16#8381 | PAC3200 integrated port, single Modbus TCP socket | Apply Option A (replace with PAC4200) or Option B (add 7KM9300-0AE01-0AA0) |
| 0A and 1A both rejected with STATUS 16#8381 | PAC3200 has wrong IP or firewall on managed switch blocks port 502 | Ping from each H-CPU; check switch ACL |
| Failover takes 45 to 90 seconds | Default RETRY_TIME = 1000 ms on single-connection meter |
Lower RETRY_TIME to 250 ms (Option C) |
| Connection 0A drops repeatedly every few minutes | TCP keep-alive conflict between H-CPU PROFINET interface and PAC3200 firmware < V 2.3.5 | Update PAC3200 firmware to at least V 2.3.5 |
| Web server of PAC3200 unreachable after installing 7KM9300-0AE01-0AA0 | Module took over the only Ethernet interface; web server moved to expansion port | Point browser to the new IP of the expansion port |
| 0A and 1A both work for 5 minutes, then both drop | PAC3200 internal socket table overflow when too many half-open sessions accumulate | Reduce RETRY_TIME below the PAC3200 1-second close latency; check for scanners in the same broadcast domain |
Standards and Documentation References
Verify the following manufacturer manuals and standards on the official Siemens support site before commissioning:
- SIMATIC Modbus/TCP Redundant Communication via PROFINET - documents the 1-second close latency on the partner side and the connection termination behavior of S7-OPENMODBUS/TCP REDUNDANT PN-H.
- MB_RED_CLIENT - Redundant Communication over PROFINET as a Modbus TCP Client - S7-1200 equivalent of the S7-400H redundant Modbus block.
- ProSoft Technology Modbus and Modbus TCP Protocol Solutions - reference for third-party gateways (MVI69L-MBS and similar) when a hardware bridge is needed between the S7-400H and the PAC3200.
How many simultaneous Modbus TCP connections can a SENTRON PAC3200 accept on port 502?
One. The integrated Ethernet port implements a single Modbus TCP server socket. A second TCP CONNECT from a different source IP is rejected with a RST. To accept two simultaneous connections, fit the Switched Ethernet PROFINET module 7KM9300-0AE01-0AA0 and run firmware V 2.3.5 or higher, or replace the meter with a SENTRON PAC4200.
Why does the S7-400H failover to the standby CPU take 45 to 90 seconds against a PAC3200?
The PAC3200 enforces a 1-second gap after the previous TCP session is closed before it accepts a new CONNECT. Combined with the S7-OPENMODBUS/TCP REDUNDANT PN-H default RETRY_TIME of 1000 ms and TCP retransmits, the end-to-end window is typically 45 to 90 seconds. Lowering RETRY_TIME to 250 ms brings the window to 10 to 15 seconds. A correctly redundant system with the expansion module or a PAC4200 fails over in 1 to 2 seconds.
Can I use the S7-1200 MB_RED_CLIENT block against a SENTRON PAC3200 in the same way?
Yes, with the same single-connection constraint. The MB_RED_CLIENT instruction on S7-1200 is functionally equivalent to the S7-400H openModbusTCP REDUNDANT PN-H block. Configure the connection in the instruction's background DB with IP1..IP4 of the PAC3200, RemotePort = 502, and RetryTime tuned to match the PAC3200 close latency.
What is the difference between PAC3200 and PAC4200 for Modbus TCP redundancy?
The PAC4200 integrated Ethernet port supports two simultaneous Modbus TCP server connections on port 502 without any expansion module. The PAC3200 supports two connections only when the 7KM9300-0AE01-0AA0 Switched Ethernet PROFINET module is fitted and firmware V 2.3.5 or higher is installed. The Modbus register map of the PAC4200 is a superset of the PAC3200, with extra registers for harmonics, THD, and per-phase energy.
Can I read the PAC3200 over PROFINET instead of Modbus TCP to get redundancy?
Yes. With the 7KM9300-0AE01-0AA0 module fitted, the PAC3200 becomes a PROFINET IO device. Each H-CPU opens an independent PROFINET AR to the meter and reads measured values with sub-100 ms failover. This is the recommended path on new installations where redundant communication is required.