IMDHMIControls LibraryShop main store

Explainer

Multiplexing Modbus TCP clients on an S7-410H PN interface

Industrial networks Published 8 min read By IMDHMI controls team

Short answer

Yes — an S7-410H can multiplex one Modbus TCP connection resource across successive servers on its integrated PN interface: use the redundant Modbus/TCP library built for that interface, set DISCONNECT to release the current server, then load the next partner's configuration and reconnect, and never call TCON or TDISCON yourself because the Modbus block owns them. Each polled server must accept two simultaneous TCP sessions, and the sequential round time must fit each device's data age.

On this page
  1. Why the connection budget forces multiplexing
  2. The interface decides which library you use
  3. The DISCONNECT-driven visit sequence
  4. What redundancy demands from each server
  5. Worked example: the budget and the round
  6. Measure the round before you promise cycle times
  7. The decision for each case
  8. Questions asked

Yes. An S7-410H can multiplex one Modbus TCP connection resource across hundreds of servers on its integrated PN interface, and the redundant library built for that interface carries the whole job: set its DISCONNECT input, the current connection releases, your logic loads the next partner's configuration, and the block reconnects. The Modbus function block calls the TCP connection and disconnection blocks internally, so TCON and TDISCON never appear in your program — a second caller on the same connection resource is the failure mode to design out. This installation makes the case concrete: 250 devices to poll, and 118 connections available on one interface, so permanent connections cannot fit and a sequential round can. What decides success are two gates — every polled server must accept simultaneous sessions from both CPUs of the redundant pair, and the time to walk the full round must fit the data age each device tolerates.

Why the connection budget forces multiplexing #

The PN interface of this S7-410H carries a stated limit of 118 connections — the figure this design is built on; another CPU or interface revision simply substitutes its own figure into the arithmetic below. A permanent connection to every polled device is dead on arrival against it: the device population alone would need 132 more connections than the interface offers, before an HMI, an engineering station or a diagnostics session takes one. The governing rule is arithmetic, and it generalizes: permanent connections plus every other user of the interface must fit inside the interface budget. This population cannot, so every device whose data age tolerates a round shares a connection resource, visited in sequence.

Modbus TCP itself puts no obstacle in the way. The protocol runs client–server over TCP on its registered port 502, and the MODBUS Messaging on TCP/IP Implementation Guide treats connection establishment and closure as a normal part of the exchange — a client may connect, transact and close, and nothing in the document obliges a socket to stay open. A connection here means one live TCP session between the CPU and one server; the budget counts concurrent connections, not device entries in a polling list.

The interface decides which library you use #

Multiplexing lives or dies on the communication path you pick. The PN interface is the port built into the CPU; a CP is a separate communication module with its own connection model. Two different Modbus TCP libraries exist for SIMATIC H CPUs: one for CP connections, whose partners are defined in NetPro and referenced by connection ID only, and one — the block library for redundant Modbus/TCP communication over the integrated PN interface of a SIMATIC H CPU — whose partner data lives in program data. Use the integrated-interface library. NetPro is required only for CP connections, and a CP library will not serve this design.

The same integrated port carries PROFINET I/O and Modbus TCP side by side — see why Modbus TCP and PROFINET I/O can share one interface — so multiplexing needs no second network.

Inside the integrated-interface library, the Modbus function block calls the TCP blocks (TCON, TDISCON) itself, and DISCONNECT is your application-level release control. That is the only handle you get. Adding your own TCON or TDISCON calls against the same resource creates two owners: your logic can open or close a connection while the library is mid-sequence, and the result is stuck connections and refused reconnects. One owner, one scheduler, one connection resource.

The DISCONNECT-driven visit sequence #

Disconnecting and changing partners are separate actions. DISCONNECT is not an address-change command: it releases the current connection, and only after the release completes does the next partner's configuration apply. The vendor's application example for reaching several servers from one connection shows the pattern — connect, exchange, disconnect, advance — and per device it runs as:

  1. Complete the exchange with the current server; read only the registers this visit needs.
  2. Set DISCONNECT and wait until the block reports the connection released.
  3. Write the next partner's connection configuration — IP address, TCP port and the partner data the library's documentation defines — through the library's documented configuration interface.
  4. Request the connection and wait for the block's completion signal.
  5. Read or write the register block, then return to step 2 for the next device.

Each device's address and register map live in a partner record your scheduler steps through, and exactly one scheduler owns the connection resource. One safety rule belongs here: keep devices that feed an interlock or a closed control loop out of the round, because during the visit cycle their data is as stale as the entire round, and a stalled server waits out the connection timeout before the sequence can move on.

What redundancy demands from each server #

In redundant Modbus TCP operation, both CPUs of the H system hold sessions to the polled server, so every polled device must accept two simultaneous TCP connections. Multiplexing does not relax this: the visited server still sees a session from each CPU during its visit. A device that takes the first session and refuses or drops the second cannot be connected directly — leave it out of the redundant poll rather than bolting workarounds onto it.

When the remote device is itself a PLC serving Modbus, check how many simultaneous connections its listening port accepts. Servers are normally addressed on TCP port 502, and depending on the CPU the port 502 listener can be configured for multiple connections at once. Count the other clients too — a historian or a maintenance tool holding a session to the same device can consume the slot the second CPU needs. Accept a device into the redundant poll only when two sessions demonstrably run alongside its existing clients; how Modbus TCP client roles split across a redundant S7-1500 pair shows the client side of the same arrangement.

Worked example: the budget and the round #

Take example numbers through both gates. On the connection side, the multiplexed round holds one live connection per CPU to the currently visited server — 2 connections in redundant operation — and assume 8 more for HMI clients, engineering access and diagnostics: 10 connections used, leaving 108 of the budget unused, and that load stays flat no matter how long the device list grows.

On the time side, take example visit values: 10 ms to connect, 20 ms for the read exchange, 10 ms to release, on a switched 100 Mbit/s LAN. These are example values, not measured results — your trace decides, and the formula is round time = device count × (connect + read + release). Per visit: 10 + 20 + 10 = 40 ms. Full round: 250 × 40 ms = 10,000 ms = 10 s. A device whose data may be 30 s old meets its requirement with a factor of three to spare. A device that needs data no older than 1 s fails the gate: if 20 devices are that tight, they take permanent connections, and the arithmetic still closes — 20 + 2 + 8 = 30 connections, 88 unused.

Meters and loggers are the natural residents of a sequential round, and the port work is ordinary Modbus TCP — why a PROFINET port can also poll Modbus TCP power meters shows the same kind of interface pulling power-meter data.

Measure the round before you promise cycle times #

Successful individual reads say nothing about the round. Before committing any update interval, measure the visit on the real network: time from connection request to data valid, plus the release, per device, then multiply by the device count and compare the result against each device's data age. If the round comes out too long, shrink what each visit carries or split the population: tolerant devices ride the round, tighter devices take permanent connections, and the permanent set goes back through the budget arithmetic above.

When several devices genuinely need fast, simultaneous updates, the trade flips and parallel clients each hold a permanent session — why parallel Modbus TCP clients beat one sequential poller covers that side of the trade, at a connection cost this interface's budget cannot absorb at the full device count.

The decision for each case #

  • Meters and loggers with loose data ages: multiplex on the integrated PN interface with the redundant library. The example budget holds with 108 connections unused, and the example round meets a 30 s staleness requirement without strain.
  • A server refuses the second session: it cannot join the redundant poll directly. Leave it out and treat its data as single-source, or resolve the limitation on the device side.
  • A device needs data fresher than the round delivers: give it a permanent connection, then re-run the budget with the permanent set, the redundant sessions and the other interface users included.
  • The round is too slow for the whole population: shorten each visit to the registers that device actually needs, or split the population by data age. Parallel clients are the wrong tool at this device count; their permanent sessions overrun the budget.
  • In no case: your own TCON or TDISCON calls against the library's connection resource, a CP library on the integrated interface, or NetPro entries steering it.

With one owner on the connection resource and both gates tested on the real servers, the multiplexed design closes.

Questions asked

Does the connection ID parameter choose which server I talk to?

No. The connection ID is a handle for one connection inside the CPU's communication resources; it selects the connection, not the partner. The remote address lives in the connection configuration the library reads, so a new server is reached by releasing the connection and loading a different configuration — never by writing a new ID into the call. On a communication processor that configuration sits in NetPro and is fixed; on the integrated PN interface the redundant library carries it in your program data.

A server takes the first TCP session but refuses the second — can it still be polled?

Not directly in redundant mode, because redundant Modbus TCP needs the server to hold two simultaneous TCP connections, one from each CPU of the H system. The honest options are to fix the server side so two sessions run alongside its other clients, or to leave that device out of the redundant poll and treat its data as single-source. Do not connect it and hope: a refused or dropped second session surfaces as a communication fault on one CPU at an arbitrary time.

How many devices can one multiplexed connection serve?

The protocol sets no cap; the round time does. Divide the staleness your slowest device accepts by the measured time per visit: a 30 second budget with a 40 millisecond visit serves 30,000 / 40 = 750 visits per round, far more than 250. If the visit time triples on a loaded network, the same budget serves 250 visits and the design still closes, which is why the measured visit time, not the device count, is the number to carry into the design review.

Why not keep all 250 connections open and poll in parallel instead?

Because the interface budget closes first: 250 permanent connections against a stated budget of 118 leaves a shortfall of 132 before any HMI, engineering station or diagnostic session is counted. Parallel polling buys speed with connection resources, and this interface has none to spare at that device count. The workable split is by data age: devices that tolerate the round join the sequential visit, devices that do not take permanent connections, and the permanent set is re-checked against the budget with the redundant sessions and the other users included.

Do I need a NetPro connection for the multiplexed Modbus TCP links?

No. NetPro connection tables belong to communication processor paths, and the CP-based Modbus TCP library is the one that references them by connection ID. This design uses the redundant library for the integrated PN interface, which carries its partner data in program data and needs no NetPro entry for the Modbus links. Mixing the two is the classic trap: a CP library call on the integrated interface, or NetPro entries expected to steer it, selects the wrong communication path entirely.

Keep reading

  • Explainer

    Why Modbus TCP and PROFINET I/O can share one interface

    Yes. On an S7-1500 or ET200SP CPU interface that supports both services, PROFINET I/O cyclic frames and Modbus TCP request/response run on the same port because they are separate communication services. A slow PROFINET update time saves wire time only: every Modbus peer still needs its own TCP connection, connection ID, instance data and scan-driven handshake inside the CPU's documented limits.

    Industrial networks

  • How-to

    Can one S7 CPU PN port run Modbus TCP and S7 comms together

    Yes. A 414-5H's integrated PN interface runs a Modbus TCP server for the DCS and S7 communication for the operator station on the same port, because both are TCP-based services on one IP stack. What decides the project is the CPU's connection-resource total, the station's transport type, the loaded response delay against each timeout — and on an H pair, the fact that Modbus sessions break at switchover unless you use the redundant option on a CP 443-1 pair.

    Industrial networks

  • Selection guide

    Choosing a ControlLogix path to a Modbus TCP Schneider PLC

    ODVA Volume 7 defines how Modbus devices integrate into CIP; it is not a ControlLogix feature, so no stock 1756 Ethernet module speaks Modbus TCP natively. Choose from four paths: an in-rack or standalone gateway, Modbus TCP written over generic sockets on a 1756-EN2T at firmware 5 with RSLogix 5000 v20 (or a 1756-EWEB), an OPC bridge on a PC, or EtherNet/IP on the Schneider side where the CPU supports it.

    Industrial networks