IMDHMIControls LibraryShop main store

How-to

WinCC Unified connection switching for an S7-1500R/H

SCADA and data logging Published 9 min read

Short answer

Define both CPU addresses as HMI connections, read a tag through each reference connection on a scheduled script before reading its quality, and call ChangeConnection without a rack/slot definition to move the operator connection to the surviving S7-1500R/H CPU. Keep one switching authority: the documented controller-configured automatic reconnection, or this script, never both deciding.

On this page
  1. Choose one owner for the switch
  2. Define the connections in the HMI project
  3. The switching procedure
  4. Read both tags before the quality
  5. Change the connection without rack and slot
  6. Recovered CPU: set the return policy
  7. Prove it before an operator relies on it
  8. Questions asked

When an S7-1500R/H CPU fails, a WinCC Unified runtime keeps polling a dead address unless something moves its connection. The scripted way to move it: define each CPU as an HMI connection in the Unified project, keep two reference connections so a scheduled script can read one tag through each, check the qualities only after both reads have completed, and call ChangeConnection without a rack/slot definition to point the operator connection at the surviving CPU. The application example for HMI communication with the redundant system describes two mechanisms — controller-configured automatic reconnection and HMI-scripted switching — so commit to one owner before writing logic. Everything below needs TIA Portal V16 or later, because WinCC Unified does not exist before V16. The procedure, the decision table, the timing arithmetic and the acceptance test follow.

Choose one owner for the switch #

The application example for HMI communication with an S7-1500R/H documents two ways to keep an operator device on the redundant pair. Controller-configured automatic reconnection: the CPU project is set up so that when one module fails, the HMI operator device connects to the surviving module on its own. HMI-scripted switching: logic in the runtime evaluates which CPU is reachable and changes the connection target itself.

Commit to one. If you can reconfigure the CPU project, automatic reconnection is the simpler owner — no schedule, no script, no state in the HMI. Use the scripted approach when the HMI project is yours but the CPU configuration is fixed, or when the switch must follow conditions evaluated on the HMI side. Letting both run at once leaves two components able to move the same connection, and every connection fault then has two suspects.

A third arrangement exists when the SCADA side reads the pair over OPC UA instead of an HMI connection: the redundant system itself decides which CPU answers, which is covered in when an S7-1500R/H can serve OPC UA directly. The classic pairing — a redundant S7-400H system behind classic WinCC — solves the same failover question with different project mechanics; that setup lives in adding a second redundant S7-400H system to WinCC SCADA.

Version gate: WinCC Unified exists from TIA Portal V16 onward, and there is no V15.1 target, so a Unified project cannot be converted down and the application example cannot be opened in older engineering software. If the HMI device type never appears in the project tree, the engineering installation is missing the option — install WinCC Engineering when TIA Portal shows no HMI option.

Define the connections in the HMI project #

Configure the connections in the HMI device's own connection settings; this implementation does not route them through a NetPro-style network object. Three connections do the work:

  • The operator connection carries process data for the screens and is the connection the script moves.
  • Reference connection A is a separate communication path addressed to CPU 1 and is used only for the availability check.
  • Reference connection B is the same, addressed to CPU 2.

Give each reference connection its own diagnostic tag: a read-only value from each CPU's program that updates whenever that CPU is alive, for example a heartbeat bit or a system status value the program already maintains. Keep the two reference paths strictly separate so the script knows which CPU produced each quality result.

Respect one boundary: a healthy reference path proves only that the CPU answers on that path. It does not prove that the operator connection has already moved, and it does not prove which CPU currently drives the process — those are checked after the switch, at commissioning.

The switching procedure #

The steps, in order:

  1. Add the Unified runtime and the two CPUs to a project in a TIA Portal version with Unified engineering, and create the three connections above in the HMI device's connection settings.
  2. Create one diagnostic tag per reference connection and confirm that each updates while its CPU runs.
  3. In the runtime's Schedules editor, create a recurring script with an interval you choose; that interval is the first input in the timing example below.
  4. In the script, read the tag through reference connection A and the tag through reference connection B, let both reads complete, then read the quality attached to each value — always in that order.
  5. Apply the decision table in the next section: request a change only when the current target's quality is bad and the alternate's is good.
  6. Make the change with ChangeConnection configured without a rack/slot definition, setting the surviving CPU's IP address as the new connection address; keep the intended target in a script variable that persists between cycles, and call the function only when the decision requires a different target than the stored one.
  7. Verify the switch by reading a tag through the operator connection before any operator write is enabled, so the change is confirmed, not merely requested.

Read both tags before the quality #

Quality is the runtime's statement about whether a tag value is usable, and it travels with the value the last read produced. Read the stored quality without reading the tag in the same cycle and the script judges a value that may no longer be fresh — the reason step 4 orders both reads ahead of both quality checks every cycle. The implementation notes for this approach compress the same rule into one line: the tags of both reference connections are read before their qualities are.

The decision itself has four cases:

Current target quality Alternate quality Action
good good Keep the current target; no call
bad good Request the change to the alternate address
good bad Keep the current target; no call
bad bad Raise a communication alarm; no target is proven reachable

Timing comes from two inputs — the schedule interval you set and the time the path takes to report dead. Worked example: schedule the script every 2 s and assume the path reports dead 5 s after the last reply; worst case is one full interval plus detection, so the script decides 2 s + 5 s = 7 s after the CPU drops, and the reconnect of the moved connection adds its own time on top. Both inputs are example values, not Unified defaults: the interval is yours to set, and detection depends on your network and the runtime's connection behavior, so measure both on your installation before quoting a switch time to operations.

Change the connection without rack and slot #

ChangeConnection is the documented runtime function that changes an HMI connection's parameters at runtime: its IP address, its slot number and its rack number. For this implementation configure the call without a rack/slot definition — the two CPUs are addressed by IP, so the switch moves exactly one parameter, the target address, and leaving slot and rack out keeps the call consistent with the connections defined in the HMI project.

Make the selection stateful. The stored intended target from step 6 is what makes that possible: a change is requested only when the decision table demands a different target than the one stored. Reissuing the change every cycle muddies recovery, because a request still in flight is replaced by the next one and you lose track of which request landed.

Requested is not completed. A call that returns without error says the request was issued; it does not say the operator connection now carries fresh data from the new address. That is what the post-switch tag read in step 7 is for, and it is also why operator writes stay disabled until that read returns live process data.

One caution about rack and slot addressing: third-party clients that address a CPU by rack and slot fail in their own way when that addressing is wrong — why an Ignition S7-400 device stays disconnected by CPU slot is the worked case. Keeping the Unified side on IP addressing avoids that class of fault here.

Deployment note: if this runtime runs on a PC mounted at the line rather than on a panel, the machine-side SCADA client for that position is an industrial panel PC.

Recovered CPU: set the return policy #

A scripted switch does not switch back on its own; the recovered CPU simply answers its reference connection again. Decide the return policy explicitly: hold the surviving target until the next maintenance window, or return to a preferred target after recovery. Either is workable; pick one and code it.

Guard against oscillation. A flapping network path alternates good and bad quality, and a policy that returns on the first good sample chases it. Require the recovered reference to hold good quality for several consecutive cycles before switching back: with a 2 s schedule, 10 consecutive cycles × 2 s = 20 s of holdoff. Scale the holdoff from your measured path behavior, and keep it conceptually separate from the schedule interval — the holdoff is a policy number, the interval is a sampling number.

After failover the pair runs on one CPU, and the controller side of that state carries its own configuration decisions; see configuring S7-1500R/H single-CPU operation correctly for that side. On the HMI side, confirm before operator commands flow again that the CPU the script selected is the one actually driving the process under the redundancy arrangement.

Prove it before an operator relies on it #

Exercise every row of the decision table, on the real pair where possible:

  1. Both CPUs running: both diagnostic tags update, both qualities read good, no change request appears.
  2. Take one path down in a controlled test — stop that CPU or break its network segment: its reference goes bad, the other stays good, and the connection moves to the surviving address within the timing you measured.
  3. Restore the failed side while the alternate stays healthy: the HMI follows the return policy, holdoff included, instead of flipping immediately.
  4. Take both paths down: the communication alarm appears and no target change is requested.

Keep one scope limit straight: the sample project behind this approach used two non-redundant S7-1500s so it could be exercised in PLCSIM Advanced. That proves the HMI-side logic — target selection, the change call, the holdoff — not the redundant system's own failover behavior. Acceptance happens on the actual R/H pair with the redundancy configuration active.

Safety note: leave HMI write functions disabled until the switch has been proven on the real pair and a tag read through the moved connection returns fresh process data — a switch that lands on the wrong CPU lets an operator command reach hardware that no longer drives the process.

Decision, case by case: both references good — hold the current target; current bad and alternate good — request the change; current good and alternate bad — hold; both bad — alarm and hold. When the CPU project is open to you, controller-configured automatic reconnection does the job without a script; when it is not, this scheduled script with a single owning decision, an IP-only change call and a verified post-switch read is the way to run WinCC Unified against an S7-1500R/H.

Questions asked

Can I convert the WinCC Unified sample to TIA Portal V15.1?

No. WinCC Unified was introduced with TIA Portal V16, so there is no V15.1 target to save into. Moving the scripted-switch approach onto a V15.1 station means changing the HMI platform and reworking the implementation, not converting the file. Plan the engineering station, and any panel or PC runtime for it, on V16 or later before the project begins.

Why does ChangeConnection have to be configured without a rack/slot definition?

Because in this implementation the two CPUs are addressed by IP address, and the switch moves exactly that one parameter. Rack and slot numbers describe a hardware-slot position, which is not how these HMI connections are defined. Leaving the rack/slot definition out keeps the change call consistent with connections defined in the HMI project and gives the fault hunt one scheme, not two.

How quickly does the HMI notice that one CPU has failed?

Roughly the schedule interval plus the path's failure-detection time. With a 2 s schedule and a path that reports dead 5 s after the last reply, the worst case is 2 s + 5 s = 7 s before the script decides, plus the reconnect time of the moved connection. Both inputs are example values, not fixed defaults, so measure your own interval and detection time on the installation before quoting a switch time.

Does the HMI switch back automatically when the failed CPU recovers?

Not by itself. Scripted switching follows the return policy you code: either hold the surviving target until a maintenance window, or return to a preferred target once the recovered reference has held good quality for a set number of consecutive cycles. Without that holdoff, one flapping network path makes the connection switch back and forth on alternating samples.

Can the switching logic be tested in PLCSIM Advanced?

The HMI-side logic can. The sample arrangement used two non-redundant S7-1500s so each reference connection had a reachable target, which exercises target selection, the change call and the holdoff. It does not exercise the redundant system's own failover, so final acceptance, including confirming that the selected CPU actually drives the process, happens on the real R/H pair.

Keep reading

  • Troubleshooting

    Unified Comfort Panel to S7-300 over PROFIBUS gateway

    Connect a Unified Comfort Panel to a PROFIBUS-only S7-300 through a SIMATIC CloudConnect 716 gateway: an S7 connection over PROFIBUS into the controller, OPC UA over Ethernet out to the panel. Troubleshoot the controller link, the gateway's exposed variables and the panel's OPC UA connection as three independent layers, bottom-up.

    SCADA and data logging

  • How-to

    Adding a second redundant S7-400H system to WinCC SCADA

    Yes — one WinCC SCADA can run two independent redundant S7-400H systems. Inventory the installed WinCC version, channel and licensed external tag count, add a redundancy-aware connection set for the new pair instead of copying the first system's connections, and accept the work with a forced switchover test before go-live.

    SCADA and data logging

  • How-to

    Connecting a CODESYS HMI on Windows to an S7-1500 PLC

    Yes, it works. Use OPC UA with the S7-1500 as server and the CODESYS HMI as client when the PC only supervises; use a CODESYS Control Win runtime with target visualization over a PROFINET controller/device link when the PC must also run logic. The PROFINET path adds one single-device license on top of the runtime; the OPC UA path adds none.

    SCADA and data logging