Problem Overview
When a redundant S7-300 station built around the CPU 315-2DP is monitored by a WinCC V7.0 SCADA station over Ethernet, a class of faults appears at the moment the master/reserve role flips. Typical symptoms include:
- The SCADA connection remains registered on the previous master even after the standby CPU has been promoted, producing stale tag values.
- Forced outputs on Station A cannot be released from Station B once Station B becomes the active master.
- The HMI shows the wrong CPU as the live partner, even though the underlying S7 connection terminates correctly at the TCP layer.
- Operator commands to release
FORCEjobs are acknowledged but never reach the new master because the WinCC connection state machine has not been refreshed.
The root cause is not in the CP 343-1 Lean hardware and not in the S7-300 software redundancy library itself. The root cause is in the WinCC V7.0 redundancy glue: the redundant connection is created, but the C script that maps the S7 status word (SWR.Standby) to the WinCC @CPU_x@ForceConnectionState tag is missing or mis-wired. Without that script, WinCC keeps the original TCP/ISO-on-TCP session active against the now-standby CPU and ignores the standby bit from FB101 "SWR_ZYK".
Root Cause Analysis
Three layers must agree on which CPU is currently master:
-
Layer 1 – S7-300 software redundancy:
FB101 "SWR_ZYK"runs in a cyclic interrupt OB (typically OB35) and writes the status of each CPU into its instance DB. BitDBX9.1of the instance DB indicates the Reserve (standby) state. -
Layer 2 – WinCC connection driver: WinCC opens two S7 connections, one to each CPU. The connection state is exposed through the internal tag
@CPU_x@ConnectionState. The driver accepts an external override through@CPU_x@ForceConnectionState. - Layer 3 – WinCC script glue: A C action monitors the standby bit from Layer 1 and toggles the override from Layer 2 so that WinCC terminates the session against the failed master and starts using the new master.
If Layer 3 is missing, Layer 1 correctly reports "Station B is now master," but Layer 2 keeps the original TCP socket bound to Station A. The FORCE/UNFORCE request is sent on the wrong connection, the request either times out or is rejected by the standby CPU, and the operator sees the symptom described in the problem statement.
S7-300 Software Redundancy Architecture
The standard library block set used in this topology is the "Software Redundancy" library delivered with STEP 7 V5.x. The relevant blocks are:
| Block | Type | Call location | Purpose |
|---|---|---|---|
| FB101 "SWR_ZYK" | FB | OB35 (cyclic interrupt) | Cyclic coordination of master/reserve role |
| FB100 "SWR_START" | FB | OB100 (restart) | Initial role assignment at startup |
| Instance DB of FB101 | DB | Generated by STEP 7 | Status and control interface between PLC and WinCC |
| Instance DB of FB100 | DB | Generated by STEP 7 | Startup parameters |
The instance DB of FB101 "SWR_ZYK" exposes the redundancy state of the CPU. The most relevant offsets for WinCC integration are:
| Offset | Bit | Symbolic name | Meaning |
|---|---|---|---|
| DBW/DW8 | - | Status word | Overall redundancy health |
| DBX9.1 | 9.1 | Reserve / Standby | TRUE on the standby CPU, FALSE on the active master |
| DBX9.2 | 9.2 | Master active | TRUE on the CPU currently acting as master |
| DBX9.3 | 9.3 | Partner reachable | TRUE if the redundancy link to the partner CPU is alive |
WinCC cannot read these bits directly through its standard S7 driver unless they are mapped to a tag. The recommended approach is to expose DBX9.1 through a global bit tag named SWR.Standby in the WinCC tag manager. The exact name is user-defined; what matters is that the bit tag in WinCC is wired to DBX9.1 of the instance DB of FB101 "SWR_ZYK".
CP 343-1 Lean Communication Processor Role
The CP 343-1 Lean (catalog family 6GK7 343-1CX10-0XE0) is the entry-level Ethernet CP for the S7-300 family. It provides a 2-port real-time switch on the CPU side and exposes the S7 CPU to the Ethernet network through the following services:
- S7 communication (PG/OP, S7 functions)
- ISO-on-TCP (RFC1006) – the transport used by default for WinCC S7 connections
- TCP and UDP via the SEND/RECEIVE interface
- Limited PROFINET IO controller capability (not used in this redundancy scenario)
Limitations relevant to a WinCC redundant topology:
| Parameter | CP 343-1 Lean value | Impact on redundancy |
|---|---|---|
| S7 connections for PG/OP | Up to 4 (older revisions) / up to 8 (current revisions) | Two of these are consumed by WinCC, one per CPU |
| Max. simultaneous ISO-on-TCP connections | 8 to 16 depending on firmware | Sufficient for two WinCC partners plus diagnostics |
| Integrated switch | 2-port, no external switch required | Simplifies wiring but does not provide redundancy |
| Redundancy support | None at CP level | All redundancy logic stays in WinCC + SWR library |
Because the CP has no native awareness of S7 software redundancy, the CP cannot decide which CPU WinCC should talk to. That decision must be made by WinCC based on the standby bit from FB101.
WinCC V7.0 Redundant Connection Configuration
Two S7 connections must be created in the WinCC project: one pointing to the master (CPU A), one pointing to the reserve (CPU B). The CP that carries the WinCC traffic on each CPU side is the CP 343-1 Lean. Both CPUs must reside in the same IP subnet so that WinCC can reach either partner without re-routing.
Recommended IP layout
| Device | IP address | Subnet mask | Role |
|---|---|---|---|
| WinCC station | 192.168.0.10 | 255.255.255.0 | SCADA |
| CPU A (CP 343-1 Lean) | 192.168.0.1 | 255.255.255.0 | S7-300 station 1 |
| CPU B (CP 343-1 Lean) | 192.168.0.2 | 255.255.255.0 | S7-300 station 2 |
The "Main connection" parameter in the WinCC connection dialog accepts the address of CPU A (192.168.0.1), and the "Reserve connection" parameter accepts the address of CPU B (192.168.0.2). Both fields are independent; do not put the same address in both.
Connection dialog parameters (WinCC V7.0)
| Field | Value | Notes |
|---|---|---|
| Connection name | e.g. CPU_A_Main, CPU_B_Reserve
|
Must be unique per WinCC connection |
| Station address | 192.168.0.1 / 192.168.0.2 | IP of the CP 343-1 Lean on each CPU |
| Rack / Slot | 0 / 2 | CPU 315-2DP is normally in slot 2 of rack 0 |
| Connection type | S7 TCP/IP | Selected in the connection list |
| Used for redundant operation | Yes (both connections) | Set in the connection properties |
Mapping the Standby Bit into WinCC
Create a binary WinCC tag named SWR.Standby with the following properties:
| Property | Value |
|---|---|
| Tag name | SWR.Standby |
| Data type | Binary tag (BOOL) |
| Connection | The connection assigned to the currently active CPU (typically the "Main" connection) |
| Address | DB number of the instance DB of FB101 "SWR_ZYK", byte 9, bit 1 |
| Acquisition mode | Cyclic on demand |
| Update cycle | 1 s (typical) |
The "Reserve / Standby" indicator is at DBX9.1 of the instance DB of FB101 "SWR_ZYK". If you renamed the FB call or assigned a different instance DB number, adjust the DB number accordingly. The bit semantics are: TRUE on the CPU that is currently the reserve, FALSE on the CPU that is currently the master.
FB100 "SWR_START" and FB102/FB103 for partner-handshake and link monitoring, the same instance DB offsets apply. Do not create a separate WinCC tag at the same offset on a different DB.C Script for Master-Reserve Changeover
The script below is the canonical solution referenced in the Siemens application documentation for S7-300 software redundancy. It must be scheduled on a WinCC global action with a cycle of 1 second.
// WinCC global C action, cycle 1 s
// Adjust the connection name to match your project.
if (GetTagDWordWait("@CPU_3@ConnectionState") == 0)
{
// No live S7 connection to the main CPU.
// Force WinCC to switch to the reserve connection.
SetTagDWord("@CPU_3@ForceConnectionState", 1);
}
else
{
// Main CPU is reachable. If it has become the reserve, release the override.
if (GetTagBitWait("SWR.Standby") == TRUE)
{
SetTagDWord("@CPU_3@ForceConnectionState", 0);
}
}
Mechanics of the script
-
@CPU_3@ConnectionStateis an internal DWord WinCC tag.0means the S7 connection to the partner currently marked as "Main" is down or not established. -
@CPU_3@ForceConnectionStateis an internal DWord WinCC tag.1tells WinCC to ignore the failed main connection and use the reserve connection instead. -
SWR.Standbyis the user-defined binary tag wired toDBX9.1of the instance DB ofFB101 "SWR_ZYK".TRUEindicates that the CPU we are currently talking to is the standby.
The combined logic guarantees that:
- If the main CPU dies, the S7 connection collapses to
ConnectionState == 0, the override flag is set to1, and WinCC switches to the reserve CPU. - If the main CPU comes back and is now the standby (because the other CPU was promoted), the override flag is reset to
0and WinCC returns to the original main once it recovers.
Where to place the script
Open the WinCC Explorer, right-click "Global Scripts" → "C-Actions", create a new action of type "Project function" or "Global action" depending on the preferred reuse scope, paste the code above, and set the trigger to "500 ms" or "1 s". The action must be enabled; verify that the small green traffic-light icon shows green at runtime in WinCC Explorer.
Dynamic Wizard: Create Redundant Connection
If the WinCC side has not been wired through the Dynamic Wizard, perform the following sequence:
- In WinCC Explorer, start the Dynamic Wizard "Create redundant connection".
- Select the existing main connection (for example
CPU_A_Main). - Define a new partner connection pointing to the reserve CPU (for example
CPU_B_Reserve). - Confirm that both connections are now flagged as "redundant pair" in the WinCC Explorer connection list.
- Insert the C action above into the global action list.
If the wizard is not run, the two connections exist as independent logical units and WinCC will never automatically hand over traffic between them. The wizard is what tells the WinCC runtime that the two connections are a pair.
Network and IP Addressing Rules
The original symptom "force not working after switchover" can also be triggered by a network misconfiguration. Validate the following before commissioning the script:
- Both CP 343-1 Lean modules must be on the same IP subnet. If you used 192.168.0.1 and 192.168.9.2 with a typo (192.168.9 instead of 192.168.0), WinCC will silently fail to connect to one of the partners and the redundancy state will be undefined.
- The WinCC station must be on the same subnet. A router between WinCC and the S7-300 station is supported, but the script assumes that any lost TCP/ISO-on-TCP session surfaces as
ConnectionState == 0within a few seconds; long paths through routers can delay that detection. - The CP 343-1 Lean must allow OP connections on the configured TSAP. By default the CP opens TSAP 03.01 on the S7-300 side. If you changed the TSAP, the WinCC connection parameters must match.
- If you use a managed switch, disable IGMP snooping or pin the multicast used by S7 redundancy diagnostics to a known port, otherwise the standby detection can be delayed by 30 s or more after a fail-over.
Force / Unforce Output Behavior Across Switchover
The S7 CPU retains force jobs in its retentive memory and re-applies them after a restart. When the master role flips from CPU A to CPU B, the forced outputs on the I/O side are no longer driven by CPU A. CPU B does not inherit the force table from CPU A automatically.
| Scenario | Force state on CPU A | Force state on CPU B | Expected behavior after switchover |
|---|---|---|---|
| Force set on master A | Active | Not set | Output goes to undefined value until operator re-applies force on B |
| Force set on master A, then CPU A becomes reserve | Active but ignored | Not set | CPU B drives the output with the program value, not the forced value |
| Operator unforce on master A | Cleared | Not set | Output returns to program value on A |
| Operator unforce on reserve B (mistaken scenario from problem statement) | Active | Not applicable | Unforce is rejected because B is not the active master of the output |
For a force/unforce operation to succeed after a switchover, the WinCC client must issue the command on the active master. The C script in the previous section guarantees that the WinCC connection state tracks the S7 redundancy state, so the operator client always issues the unforce on the right partner.
FB104 / FB105 in the extended library), forcing on CPU A will never be visible on CPU B. The force/unforce behavior described in the problem statement is correct: unforce on the new master does not release a force that was issued on the previous master.Step-by-Step Commissioning Procedure
- Compile and download the STEP 7 project with
FB101 "SWR_ZYK"inOB35andFB100 "SWR_START"inOB100. Verify that the instance DB ofFB101is generated and that the DB number is recorded. - Open the WinCC project, open "Tag Management", add the binary tag
SWR.Standbypointing atDBX9.1of the recorded DB number on the main connection. - Open "Tag Management" again and verify that the internal tags
@CPU_3@ConnectionStateand@CPU_3@ForceConnectionStateexist. These are added automatically by the Dynamic Wizard "Create redundant connection". If absent, run the wizard. - Create the C action shown in the previous section, paste the script, schedule it on a 1 s trigger.
- Download the WinCC project and start Runtime.
- From the WinCC station, ping both CP 343-1 Lean addresses. Confirm
192.168.0.1and192.168.0.2both respond. - Open the online diagnostics of the S7 connection in WinCC. Verify that the main connection shows "Established" and that the standby CPU shows "Standby" in the S7 redundancy status.
- Force an output from WinCC on the active master. Confirm that the output is forced.
- Stop the active master CPU (power off or stop the CPU). Wait 3 s.
- Verify that WinCC switches the active connection to the reserve CPU and that the previously forced output is no longer driven to the forced value.
- Release the force from WinCC on the new master. Confirm that the output returns to the program value.
Verification Checklist
| Check | Expected | How to verify |
|---|---|---|
| ConnectionState on main CPU | Non-zero when reachable | WinCC diagnostics view or GetTagDWordWait from a test C action |
| ConnectionState on reserve CPU | Non-zero | Same as above, partner connection |
| SWR.Standby on master CPU | FALSE | Tag monitor in WinCC tag management |
| SWR.Standby on reserve CPU | TRUE | Tag monitor in WinCC tag management |
| ForceConnectionState value | 0 normally, 1 during failover | Online trace of the C action |
| Switchover time | < 5 s typical | Stopwatch test during commissioning |
| Forced output after switchover | Released unless re-applied on new master | Visual check + PLC online monitor |
Troubleshooting Matrix
| Symptom | Likely cause | Corrective action |
|---|---|---|
| WinCC never switches after master fail-over | C action not scheduled, or @CPU_x@ForceConnectionState not created |
Run the Dynamic Wizard "Create redundant connection" and enable the C action |
| WinCC switches but loses tag values | Tags not configured on the reserve connection | Duplicate the tag list on the reserve connection or set the redundancy flag on tags so WinCC reads them through both connections |
| Force cannot be released after switchover | SWR.Standby tag points to wrong offset or wrong DB | Re-check the DB number of the instance DB of FB101 and the address DBX9.1 |
| Both CPUs report Standby = TRUE | Redundancy link between the two CPUs not working | Check the MPI/Profibus link between the two S7-300 stations, the SWR partner handshake parameters, and the cable |
| Neither CPU reports Standby = TRUE | FB101 "SWR_ZYK" not called in OB35 | Add the FB101 call in OB35 with the correct instance DB |
| ConnectionState stays 0 even when both CPUs are reachable | CP 343-1 Lean TSAP mismatch or wrong Rack/Slot | Verify Rack 0 / Slot 2 and TSAP 03.01 in the WinCC connection |
| C action fires but ForceConnectionState never goes to 1 | Tag name typo, e.g. @CPU_3@ForceConnectionState vs @CPU_2@ForceConnectionState
|
Confirm the connection number in WinCC Explorer (CPU_1, CPU_2, CPU_3, ...) and align the tag name in the script |
| WinCC runtime stops with error "Connection failed" after switchover | The C action triggers a connection switch before the standby CPU is ready | Increase the connection timeout in WinCC and delay the override with a small counter (e.g. require ConnectionState == 0 for 2 cycles before forcing) |
| WinCC 7.4 short-term archive not found | Short-term archive not configured in the project | Open "Tag Logging", create a "Short-term archive" of the desired duration in the archive configuration; the wizard that creates it lives under "Archive Configuration" → "Timed Tag Logging" |
Performance and Timing Considerations
The 1 s cycle of the C action is a reasonable default. Shorter cycles (250 ms, 500 ms) reduce the visible switchover delay but increase the load on the WinCC dispatcher. Longer cycles (2 s, 5 s) reduce load but extend the window during which the operator sees stale values after a fail-over.
| C action cycle | Typical switchover latency | CPU load on WinCC station | Recommended use |
|---|---|---|---|
| 250 ms | < 1 s | Moderate | Fast process plants with critical operator control |
| 1 s | 1 to 2 s | Low | Standard WinCC V7.0 deployments |
| 5 s | 5 to 7 s | Negligible | Non-critical monitoring only |
Migration to WinCC 7.4
WinCC 7.4 inherits the redundancy architecture from WinCC 7.0 with two notable differences:
- The internal tag namespace uses
@ConnectionStateand@ForceConnectionStateprefixed with the connection name as in WinCC 7.0, but the C action may require updated signatures if you migrate an existing project. - The short-term user archive is configured under "Tag Logging" → "Archives" → "New archive" with the type "Short-term"; the duration is set in the archive properties. This is the location referenced in the original query.
The redundancy C action shown above works unchanged in WinCC 7.4 against CPU 315-2DP stations with CP 343-1 Lean, provided the same Dynamic Wizard has been run.
Documentation References
For deeper coverage, refer to the official Siemens documentation:
- SIMATIC WinCC V7.0 Communication Manual – section "Configuring redundant S7 connections"
- SIMATIC S7-300 Software Redundancy – application description for FB100/FB101 and the partner-handshake blocks
- SIMATIC NET CP 343-1 Lean – Operating Instructions, configuration of S7 connections and ISO-on-TCP TSAPs
- SIMATIC Programming with STEP 7 V5.x – description of OB35 cyclic interrupt and instance DB offsets
All of the above are available through the Siemens Industry Online Support portal at support.industry.siemens.com under the SIMATIC product family.
What does the SWR.Standby tag represent in WinCC and where do I create it?
It is a binary WinCC tag that mirrors bit DBX9.1 of the instance DB generated for FB101 "SWR_ZYK" in the S7-300 software redundancy library. Create it under Tag Management with the address pointing to that DB, byte 9, bit 1, and use it as the input to the master/reserve switchover C action.
Why does forcing an output on master A and then unforcing on master B fail?
The force table is local to each CPU. When master A becomes reserve, CPU B does not inherit the force jobs from CPU A. The unforce command on B has no matching force to release. Re-apply or release the force on the CPU that currently owns the output.
What IP addresses should I assign to the two CP 343-1 Lean modules?
Use the same subnet, for example 192.168.0.1 for CPU A and 192.168.0.2 for CPU B with mask 255.255.255.0. The WinCC station must also be on the same subnet, for example 192.168.0.10. Do not put the same address in the main and reserve fields of the WinCC connection dialog.
Why is the tag @CPU_x@ForceConnectionState missing from my project?
The Dynamic Wizard "Create redundant connection" has not been run, or it was run on a connection that was later deleted. Run the wizard again on the main connection; WinCC will regenerate the internal tags and update the connection pair flag.
How do I locate the short-term user archive in WinCC 7.4?
Open WinCC Explorer, right-click "Tag Logging", select "Archive Configuration", create a new archive, and choose the "Short-term archive" type. Set the duration (for example 24 hours) in the archive properties. The archive then appears under the same Tag Logging node and is selectable as the destination of any tag logging process.