Restricting WinCC Report Printing to Active Master OS Server Using @RM_MASTER Internal Tag
In a redundant SIMATIC PCS 7 OS Server pair, time-triggered print jobs configured identically across both servers will execute simultaneously on both nodes, resulting in duplicate printouts. To ensure that scheduled reports execute strictly on the active Master server, the print job script must evaluate the internal system tag @RM_MASTER. In WinCC Global Script (C or VBS), querying @RM_MASTER verifies server status: when @RM_MASTER == 1, the local server is operating in the active Master state and initiates RPTJobPrint(); when @RM_MASTER == 0, the server is in Standby and suppresses execution.
Table of Contents
- The Duplicate Print Challenge in Redundant OS Architectures
- WinCC Redundancy Internal Tags and Master/Standby States
- Implementation via Global Script (C and VBS Examples)
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
The Duplicate Print Challenge in Redundant OS Architectures
Redundant WinCC OS server pairs are engineered with identical project configurations, databases, and runtime scripts to ensure seamless hot-standby failover. When an automated report (such as a shift production log, daily alarm summary, or process value journal) is scheduled using the WinCC Print Job Editor or Global Script cyclic timers, both Server A and Server B execute the schedule simultaneously. If both servers output to the same physical network printer or shared network archive folder, plant operators receive duplicate physical paper copies or duplicate file entries with identical data.
To resolve this issue without creating asymmetrical project configurations (which would break OS Project Duplicator synchronization), engineers must implement conditional script logic that evaluates runtime redundancy status before invoking the WinCC reporting engine.
WinCC Redundancy Internal Tags and Master/Standby States
When the WinCC Redundancy option package is enabled, WinCC automatically instantiates specialized internal tags prefixed with @RM_ within the internal tag management hierarchy.
@RM_MASTER1 = Active Master, 0 = Standby@RM_SERVER_NAME@RM_MASTER_NAME@RedundancyServerState0 = Fault, 1 = Master, 2 = StandbyBy querying @RM_MASTER synchronously before invoking the print command, the standby server peacefully bypasses the report generation routine while the master server processes the print pipeline.
Implementation via Global Script (C and VBS Examples)
To implement master-only report printing, create a Global Script action triggered cyclically or via a scheduled time event.
ANSI-C Script Implementation:
#include "apdefap.h"
int gscAction(void)
{
#define MasterTag "@RM_MASTER"
BOOL isMaster = FALSE;
// Synchronously read the master redundancy tag
isMaster = GetTagBitWait(MasterTag);
if (isMaster)
{
// Execute print job only on active master
if (!RPTJobPrint("Shift_Report_Job"))
{
printf("WinCC Report Print Failed: Shift_Report_Job\r\n");
RptShowError(NULL, NULL);
}
else
{
printf("WinCC Report Successfully Dispatched by Master Server\r\n");
}
}
return 0;
}
VBScript Implementation:
Sub PrintMasterReport()
Dim objTag, isMaster
Set objTag = HMIRuntime.Tags("@RM_MASTER")
isMaster = objTag.Read
If isMaster = True Then
' Trigger report print job via WinCC Report Engine
HMIRuntime.Execute "RPTJobPrint.exe Shift_Report_Job"
End If
End Sub
Configure the Global Action trigger for the desired schedule (e.g., daily at 06:00:00). Because both servers share identical code, project synchronization remains 100% compliant.
Verification
Perform the following verification steps on the redundant server cluster:
- Tag Value Inspection: Open WinCC Tag Simulator or WinCC Explorer status bar on Server A and Server B. Confirm that
@RM_MASTERequals1on Server A and0on Server B. - Scheduled Execution Test: Temporarily set the script trigger to fire every 2 minutes. Verify that a single printout is generated by the master server and no output is produced by the standby server.
- Failover Execution Test: Simulate an OS server failover by stopping runtime on Server A. Verify that Server B's
@RM_MASTERtag switches to1. Confirm that subsequent scheduled print cycles execute successfully from Server B.
Limitations and Operational Precautions
When configuring master-dependent print scripts, adhere to these operational precautions:
- Network Printer Accessibility: Ensure that both physical server nodes have identical printer drivers installed, identical Windows default printer names configured, and equivalent network routing permissions to the target printer.
- Failover Mid-Print Considerations: If a failover occurs during the precise moment a multi-page print job is rendering, the newly designated master might re-evaluate the trigger and re-dispatch the job. Use timestamp verification tags if strict once-only daily enforcement is mandatory.
- GSC Runtime Activation: In the Computer Properties -> Startup tab, verify that
Global Script Runtimeis checked on both redundant servers, otherwise the background C/VBS action will not execute.
Engineer FAQ
Why should I use GetTagBitWait instead of GetTagBit for @RM_MASTER?
GetTagBitWait() performs a synchronous read directly from the data manager cache rather than relying on an asynchronous callback. This ensures that the conditional branch evaluates the true instantaneous state of the redundancy manager.
Does the WinCC Print Job Editor have a built-in checkbox for Master-only execution?
Standard WinCC Report Layout print jobs triggered via the native Report Designer scheduler do not include an automatic redundancy filter. Wrapping the print call in a Global Script action conditioned on @RM_MASTER is the standard solution.
What happens if both servers report @RM_MASTER == 0 during startup?
During initial synchronization or network split-brain recovery, @RM_MASTER may temporarily read 0 on both servers. The print script simply skips execution until the Redundancy Manager resolves mastership, preventing duplicate outputs.
Technical References
- SIMATIC WinCC V7.4 / V7.5 WinCC Redundancy System Manual (A5E40838386)
- SIMATIC WinCC V7.4 Scripting: VBS, ANSI-C, VBA Manual (A5E37536061)
- Siemens Industry Online Support: 'How do you print a report only on the active WinCC Redundancy server?' (Entry ID: 22534289)
Related Articles
- Resolving WinCC User Archive Synchronization Failures Across Redundant OS Servers in SIMATIC PCS 7.md
- Evaluating Legacy SIMATIC PCS 7 V6.1 on Windows XP in VMware Fusion on macOS - Virtualization Boundaries and Lifecycle Rules.md
- Activating WinCC OS on an Engineering Station Without Dedicated OS Servers - Resolving Disconnected Named Connections.md
Related Tags
- WinCC Redundancy
- @RM_MASTER
- Global Script
- ANSI-C
- Report Designer
- Print Job