WinCC Redundancy System Tags: @RedundantServerState Reference

David Krause12 min read
SiemensTechnical ReferenceWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Siemens WinCC (TIA Portal and WinCC V7) provides built-in server redundancy where two HMI/SCADA stations run in parallel, exchanging state information and synchronizing process data. In a redundant pair, only one server is the active master at any given moment; the other operates as a hot standby, ready to take over upon a partner fault, network loss, or operator-initiated failover.

A common engineering requirement is to execute role-sensitive actions only on the active master. Typical examples include:

  • Triggering report printing or PDF archival on the server that actually owns the live process image.
  • Disabling outbound e-mail, FTP, or OPC-UA publishing on the standby to avoid duplicate side-effects.
  • Driving a single-line HMI indicator showing the current redundancy role.
  • Logging audit events tagged with the master/standby context for post-event analysis.

WinCC exposes this role information through internal system tags. The two primary namespaces are:

  • WinCC V7 / WinCC RT (classic): the @RedundantServerState internal tag in Tag Management.
  • WinCC RT Professional (TIA Portal V20): the @RM_MASTER and @RM_MASTER_NAME system tags supplied by the WinCC Redundancy option.

These tags are populated automatically by the WinCC Redundancy runtime; no manual configuration is required beyond enabling the Redundancy option on each server project. The tags refresh in the standard WinCC acquisition cycle and are accessible to both VBScript and ANSI-C scripts in the global script editor.

WinCC V7 Redundancy Architecture

WinCC V7 redundancy is licensed by the "WinCC/Redundancy" optional package. When the package is installed and the project is configured for redundancy, the WinCC Explorer adds a dedicated redundancy node to the project tree and creates a set of internal tags under the Internal Tags folder. The runtime continuously exchanges heartbeats with the partner server over a configurable TCP port (default 56789) and evaluates the partner's state to determine its own role.

Role transitions are governed by three timing parameters found in the computer properties of the redundancy partner dialog:

Parameter Default Description
Partner monitoring time 5 s Maximum time the partner may be silent before WinCC declares it unavailable.
Switchover time 30 s Delay before the surviving server promotes itself to master after a partner loss.
Synchronization interval On change How frequently the standby pulls tag archive and alarm differences from the master.

During normal operation, the first server to come online assumes the master role. If that server fails the heartbeats, the partner waits for the switchover timer to expire and then promotes itself. Once the original server recovers, the operator must choose (via a system dialog or HMI button) whether to swap back to the original master or to leave the roles as they are.

@RedundantServerState System Tag Reference

The @RedundantServerState tag is a 16-bit unsigned integer internal tag created automatically by WinCC when the Redundancy option is enabled. It is read-only; any write attempt from a script or external connection is rejected by the runtime. The tag's value is updated by the Redundancy DLL each time the redundancy state machine transitions.

Typical HMI configuration:

  • Data type: Unsigned 16-bit value
  • Acquisition cycle: 1 s (recommended minimum)
  • Update on tag change: enabled
  • Limits/initial value: 0 (WinCC overwrites on startup)

The tag is available in the internal tag list at Tag Management → Internal Tags → @RedundantServerState and can be dragged onto any process screen, logged to the tag logging archive, or referenced by global scripts.

@RedundantServerState Tag Values

The tag returns one of four discrete values. Any value other than 1, 2, 3, or 4 should be treated as a transient initialization state and ignored by application logic.

Value State Meaning Recommended Application Behavior
1 Master This server owns the active process connection and is the authoritative source of writes to the PLC. Enable report printing, outbound notifications, and write-allowed OPC connections.
2 Standby This server is synchronized and hot-standby; it is the backup for the partner. Suppress side-effect actions; do not initiate reports or send e-mails.
3 Faulty The partner server cannot be reached and the local server has not yet promoted itself; redundancy is currently degraded. Log an alarm; do not assume master privileges until the value changes to 1.
4 Standalone The Redundancy option is enabled but no partner is configured, or the partner is permanently offline and the local server has been promoted to sole master. Treat as a master (1) for application logic, but verify the operator's intent before enabling writes to the PLC.
Important: A common engineering mistake is to test @RedundantServerState = 1 alone. In standalone deployments (no partner available) the tag will report 4, and any conditional logic limited to value 1 will never fire. Combine checks with logical OR: ((State = 1) OR (State = 4)) to cover both active-master and sole-master cases.

WinCC RT Professional Redundancy Tags

WinCC Runtime Professional, configured through TIA Portal, uses a different tag namespace. The official Siemens TIA Portal documentation describes the @RM_MASTER and @RM_MASTER_NAME system tags, which serve the same role-identifying purpose as @RedundantServerState in the V7 runtime.

According to the WinCC Redundancy System Tags (RT Professional) reference in the Siemens TIA Portal documentation, the redundancy option automatically publishes the following internal tags:

Tag Type Description
@RM_MASTER BOOL TRUE on the active master, FALSE on the standby.
@RM_MASTER_NAME String Computer name of the active master server, useful for client-side display and audit logs.
@RM_SLAVE_NAME String Computer name of the standby partner.
@RM_PARTNER_STATE DWORD Combined state word encoding partner reachability and sync status.

These tags are visible in the HMI tag table once the Redundancy option is enabled on the RT Professional device. They can be wired directly to screen objects or evaluated by VBScript actions without manual declaration. Unlike the V7 tag, the RT Professional namespace is boolean-centric, simplifying the conditional logic in HMIs.

Conditional Logic for Master-Only Actions

Two reference implementations are shown below. The first uses the V7 four-state value; the second uses the RT Professional boolean tag. Both evaluate on the local server only, so a global action scheduled on both servers will execute only on the server that currently holds the master role.

VBScript (WinCC V7 / RT Professional)

' Returns TRUE if this server is the active master (state 1) or the
' sole master in a standalone deployment (state 4).
Function IsMaster()
    Dim iState
    iState = HMIRuntime.Tags("@RedundantServerState").Read
    IsMaster = (iState = 1) Or (iState = 4)
End Function

' Example: trigger the daily production report only on master.
Sub TriggerDailyReport()
    If IsMaster() Then
        HMIRuntime.Trace "Master server: dispatching daily report." & vbNewLine
        ' ... call your report generation routine here ...
    Else
        HMIRuntime.Trace "Standby server: report suppressed." & vbNewLine
    End If
End Sub

VBScript for RT Professional (Boolean Tag)

Function IsMasterRT()
    IsMasterRT = HMIRuntime.Tags("@RM_MASTER").Read
End Function

Sub TriggerDailyReportRT()
    If IsMasterRT() Then
        HMIRuntime.Trace "RT master confirmed: " & _
            HMIRuntime.Tags("@RM_MASTER_NAME").Read & vbNewLine
        ' Dispatch report
    End If
End Sub

ANSI-C Script (WinCC V7)

For tag logging actions, scheduled print jobs, or alarm-driven routines, use ANSI-C in the Global Script editor. The GetTagWord function returns the current value of @RedundantServerState; bitwise tests isolate the relevant states.

#include "apdefap.h"

BOOL IsMasterOrStandalone(void)
{
    WORD wState = 0;
    wState = GetTagWord("@RedundantServerState");

    /* State 1 = Master, State 4 = Standalone (treat as master) */
    if (wState == 1 || wState == 4) {
        return TRUE;
    }
    return FALSE;
}

/* Example: print job dispatcher */
void OnPrintEvent(LPCTSTR lpszReportName)
{
    if (IsMasterOrStandalone()) {
        printf("Master server: launching report %s\n", lpszReportName);
        /* Call your report trigger here */
    } else {
        printf("Standby: report %s suppressed.\n", lpszReportName);
    }
}
Best practice: When wrapping the check inside an alarm or event-driven action, capture the state value at the start of the function and avoid re-reading the tag mid-routine. This protects against a role switch between the check and the action (the so-called "role-flip race").

Tag Configuration in WinCC Explorer

To verify that the redundancy tags exist in the project:

  1. Open WinCC Explorer on the configured server.
  2. Right-click Tag Management and select Open.
  3. Expand the Internal Tags node.
  4. Locate the tag name prefixed with @. In V7: @RedundantServerState. In RT Professional: @RM_MASTER, @RM_MASTER_NAME, @RM_SLAVE_NAME, @RM_PARTNER_STATE.
  5. Confirm the data type matches the reference table above. If the tag is missing, the Redundancy option is not installed or the project has not yet been compiled with the redundancy license active.

The tags are read-only at runtime. If the runtime is started in service mode, the tags are visible to OPC-DA, OPC-UA, and WinCC clients regardless of which server they are connecting to; this is the correct mechanism for a client to display the role of the server it is currently attached to.

HMI Display Recommendations

For operator screens, three design patterns are commonly used:

Pattern Implementation Notes
Single color state indicator Bind a circle/rectangle color to @RedundantServerState; map 1=green, 2=blue, 3=red, 4=yellow. Compact; ideal for status bars.
Text role label Use a multi-state text field listing "Master", "Standby", "Faulty", "Standalone". Most readable for operators.
Computer name display Bind a text field to @RM_MASTER_NAME (RT Professional). Useful when clients may be attached to either server and the operator needs to know which one is authoritative.

Verification and Commissioning

After deployment, follow this sequence to confirm that the role tags behave as expected:

  1. Power on Server A. Wait for the Redundancy tray icon to report Master. Verify @RedundantServerState = 1 on Server A using the Tag Simulator or a temporary I/O field on a screen.
  2. Power on Server B. Both servers should report synchronized state; Server A remains master, Server B reads @RedundantServerState = 2 (Standby).
  3. Trigger a controlled failover from Server A. Confirm that Server B transitions to 1 within the switchover timer (default 30 s) and that Server A reports 3 (Faulty) while it is offline.
  4. Restore Server A. Allow the redundancy synchronization to complete, then initiate a swap-back. Verify both tags return to the expected pre-test values.
  5. Disconnect Server B's network cable to simulate a partner loss. Confirm that after the partner monitoring time, Server A reports state 4 (Standalone) and that any master-only actions continue to fire.
  6. Inspect the alarm log for the role-transition messages generated by the Redundancy channel; these confirm the timing of the state machine.
Safety: Never write to PLC outputs from a script that checks the redundancy role without an additional write-permission interlock. A role-flip race during a write could cause the standby to issue a write that the master has also just issued, producing a double-trigger. Use a write authorization tag in addition to the role check.

Edge Cases and Caveats

Several field-encountered situations warrant explicit handling:

  • Project mismatch after partial restore: if a restored project on one partner has a different tag archive layout, the redundancy state machine can settle into a 3 (Faulty) state indefinitely. Always re-deploy both partners from the same exported source.
  • Switchover during scheduled task: if a global script starts on the master and the partner promotes itself mid-execution, the script may complete on the now-standby server. Wrap critical actions in a single transaction or use a database write that includes the server's ComputerName for post-hoc dedup.
  • Standalone on a system that expects a partner: state 4 is correct, but a system that performs license-sensitive actions should be tested in standalone mode before commissioning, since some license-bound services behave differently when no partner is reachable.
  • Tag logging startup window: at runtime startup, @RedundantServerState may briefly hold 0. Scripts that read the tag in their startup event should defer the first read by at least one full acquisition cycle.
  • Client visibility: a WinCC client connected to a redundant server pair will see the role tag of the server it is currently attached to, not the global role. Use the @RM_MASTER_NAME tag (RT Professional) to disambiguate the active master from the client's perspective.

Comparison: V7 Tag vs. RT Professional Tags

Aspect WinCC V7 / WinCC RT WinCC RT Professional
Primary role tag @RedundantServerState @RM_MASTER
Tag type WORD (unsigned 16-bit) BOOL
Number of states 4 (Master, Standby, Faulty, Standalone) 2 (Master TRUE, Standby FALSE)
Master name Not directly exposed; query @LocalComputerName @RM_MASTER_NAME
Partner state Derived from @RedundantServerState on the partner @RM_PARTNER_STATE
Script API GetTagWord / HMIRuntime.Tags(...).Read HMIRuntime.Tags(...).Read (boolean)

Related Internal Tags Worth Knowing

Beyond the role tag, WinCC exposes additional internal tags that interact with redundancy:

  • @RedundantServerState — the role itself (described above).
  • @RM_MASTER_NAME — computer name of the active master (RT Professional).
  • @RM_SLAVE_NAME — computer name of the standby partner (RT Professional).
  • @RM_PARTNER_STATE — encoded partner reachability (RT Professional).
  • @LocalComputerName — useful to identify the local server in scripts and log messages.
  • @CurrentUser — combine with role checks to audit which user triggered a master-only action.

Which tag identifies the active master in a Siemens WinCC redundant pair?

In WinCC V7 and WinCC RT, read the internal tag @RedundantServerState; a value of 1 means this server is the master. In WinCC RT Professional (TIA Portal), read the boolean internal tag @RM_MASTER; TRUE indicates this server is the master. The RT Professional namespace also publishes @RM_MASTER_NAME, which contains the computer name of the active master for client-side display.

What is the difference between values 1, 2, 3, and 4 of @RedundantServerState?

Value 1 = Master (this server is authoritative), 2 = Standby (hot backup of the partner), 3 = Faulty (partner unreachable, not yet promoted), and 4 = Standalone (no partner configured or partner permanently offline; this server is the sole master). Application logic that should run on the active master must accept both 1 and 4.

How do I trigger a report print job only on the master server?

Wrap the print trigger in a VBScript or ANSI-C function that reads @RedundantServerState (V7) or @RM_MASTER (RT Professional) and only calls the print routine when the value indicates master. In V7, the check should be (state = 1) OR (state = 4); in RT Professional, check @RM_MASTER = TRUE. The example VBScript in this article shows a complete implementation.

Why does my script not fire even though the partner server is online?

The most common cause is a check limited to @RedundantServerState = 1 on a server that is actually the standby (value 2). Confirm the role by reading the tag from the runtime diagnostics or a temporary I/O field. Another frequent cause is a typo in the tag name; the tag is @RedundantServerState (note the American spelling "Server") and is case-sensitive in some scripting contexts.

Can a WinCC client see the role of the server it is connected to?

Yes. A client receives the same internal-tag set as the server it is attached to, so reading @RedundantServerState or @RM_MASTER on the client returns the role of the connected server. To determine which physical server is the active master regardless of where the client is attached, read @RM_MASTER_NAME on the RT Professional client; it returns the computer name of the authoritative master.

Back to blog