Scheduling Non-Standard Cyclic Print Jobs (Every 4 or 8 Hours) in WinCC Report Designer
In SIMATIC PCS 7 WinCC Report Designer, standard Print Job execution properties only provide fixed cyclic intervals of hourly, daily, weekly, or monthly. To execute non-standard cyclic print jobs—such as printing a shift summary every 4 hours or every 8 hours—engineers must configure the Print Job for event-driven or on-demand execution, and trigger it via an external scheduler. The standard solution is creating a cyclic C-action in WinCC Global Script that executes hourly, checks whether the current hour modulo 4 is zero, and invokes the reporting function RPTJobPrint. Alternatively, an S7 controller clock pulse tag can trigger the print job upon a rising edge.
Table of Contents
- Architecture of WinCC Print Jobs and Scheduling Limitations
- Why Multi-Hour Cycles (4-Hour, 8-Hour) Are Missing in Print Job Properties
- Implementing 4-Hour Shift Triggers via Global Script C-Actions
- Implementing Controller-Driven Tag Triggers from S7-400 Logic
- Comparison Table: Multi-Hour Print Triggering Techniques in WinCC
- Step-by-Step Procedure to Implement a 4-Hour Cyclic Print Job
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Architecture of WinCC Print Jobs and Scheduling Limitations
In SIMATIC PCS 7, the Report Designer subsystem manages the scheduled generation and physical printing of production logs, alarm journals, and shift summaries. The execution of a report is controlled by a Print Job:
* The Print Job Definition: Binds a Page Layout (.rpl), a target printer destination (e.g., a physical line printer, a network PostScript printer, or Microsoft Print to PDF), and an Execution Trigger.
* Trigger Options in WinCC Explorer:
When configuring a Print Job's properties under the Job Parameters tab, the Start Time options include:
1. Immediately on Command: Triggered manually or by script calls.
2. Line/Page by Line: Used for real-time continuous message sequence logs.
3. Cyclic: Designed for recurring periodic printouts.
* The Cyclic Trigger Constraint: The built-in cyclic dropdown menu strictly exposes only five fixed intervals: Hourly, Daily, Weekly, Monthly, and Yearly. There is no configurable integer field to specify intermediate intervals like "Every 4 Hours" or "Every 8 Hours".
Why Multi-Hour Cycles (4-Hour, 8-Hour) Are Missing in Print Job Properties
The internal scheduling service in WinCC (CCPrintJob.exe / gcsrv.exe) was designed around calendar-aligned reporting intervals (top of the hour, midnight, end of week, or end of month). In process manufacturing, however, industrial shifts rarely divide neatly into simple daily logs:
* Plants frequently operate on 4-hour monitoring cycles, 8-hour operator shifts (06:00, 14:00, 22:00), or 12-hour operational shifts (06:00, 18:00).
* Selecting "Hourly" would cause excessive paper waste and print queue congestion (printing 24 times a day instead of 6 times).
* Selecting "Daily" prints only once in 24 hours, failing shift handover requirements.
* Consequently, to achieve a 4-hour cycle, the print job must be decoupled from the native cyclic scheduler and driven programmatically via Global Script or Tag Triggers.
Implementing 4-Hour Shift Triggers via Global Script C-Actions
The most robust software method inside WinCC is utilizing a project-level C-action within Global Script:
- Action Architecture: A C-action is scheduled with a standard 1-hour cyclic trigger.
- Time Evaluation Logic: At every hourly trigger, the script queries the operating system's local time using standard C runtime functions (
time()andlocaltime()from<time.h>). - Modulo Division: The script evaluates whether the current hour modulo 4 is zero:
if (timeinfo->tm_hour % 4 == 0 && timeinfo->tm_min == 0)
This condition evaluates to TRUE exactly at 00:00, 04:00, 08:00, 12:00, 16:00, and 20:00. - Executing the Print Command:
Upon a true condition, the script executes the standard WinCC API function:
RPTJobPrint("@My_4Hour_Report");
where@My_4Hour_Reportis the exact name of the configured print job.
Implementing Controller-Driven Tag Triggers from S7-400 Logic
An alternative, deterministic architecture shifts the scheduling intelligence into the Automation Station (AS):
- Controller Implementation:
In CFC, an engineer uses a real-time clock block (such asTIME_TCor an SFC 1READ_CLKroutine) in a cyclic organization block (e.g., OB35). When the CPU clock crosses a 4-hour boundary, the logic generates a 2-second boolean pulse on a global tag (e.g.,Trigger_4Hour_Print). - WinCC Print Job Configuration:
In WinCC Explorer, open the Print Job Properties: - Set Start Time to Tag-Triggered.
- Select the PLC tag
Trigger_4Hour_Print. - Set the trigger condition to Upon Change or Upon Rising Edge.
- Benefits: Guarantees perfect synchronization between controller batch cycles, plant shift changes, and report generation, even across timezone daylight saving shifts.
Comparison Table: Multi-Hour Print Triggering Techniques in WinCC
The following table compares the different engineering methods for triggering non-standard cyclic print jobs:
Step-by-Step Procedure to Implement a 4-Hour Cyclic Print Job
Follow this verified engineering workflow to implement a 4-hour cyclic print job:
- Create the Print Job in WinCC Explorer:
* In WinCC Explorer, expand Report Designer > Print Jobs.
* Right-click and create a new print job named@Report_4Hours.
* Assign the desired Page Layout (.rpl).
* Select the physical printer or set the output to File (PDF / EMF).
* Under Start Time, select On Demand / By Script (do not select Cyclic).
* Save and close the print job. - Author the Cyclic C-Action:
* Open Global Script > C-Editor.
* Create a new Project Action namedCyclic_4Hour_Trigger.pas.
* Set the trigger to Timer > Cyclic > 1 Hour (start at :00 minutes).
* Insert the following C-code:
```c
#include "apdefap.h"
void Cyclic_4Hour_Trigger()
{
time_t rawtime;
struct tm *timeinfo;time(&rawtime); timeinfo = localtime(&rawtime); // Check if current hour divides evenly by 4 if ((timeinfo->tm_hour % 4 == 0)) { // Execute the configured print job RPTJobPrint("@Report_4Hours"); }}
```
* Compile the script (verify 0 Errors) and save.
3. Verify WinCC Startup Configuration:
* Open Computer Properties > Startup.
* Ensure the checkbox Global Script Runtime is checked.
* Restart WinCC Runtime to initialize the action.
Verification
Verify that the 4-hour print job executes deterministically:
1. In WinCC Explorer, right-click the @Report_4Hours print job and select Print Preview; verify that layout and data bindings render without formatting errors.
2. For testing, temporarily modify the modulo line in the C-action to match the upcoming hour or test manually by invoking RPTJobPrint("@Report_4Hours"); from an HMI button. Confirm the printer spools the job immediately.
3. Check the Windows Print Queue and verify that the document header displays the exact 4-hour timestamp.
4. Inspect <WinCC_Project>\Diagnostics\WinCC_Sys_01.log and verify that the C-action executes without script queue overflow warnings.
Limitations and Operational Precautions
- Print Queue Overload: If a print job takes longer to spool than the trigger frequency, or if the printer is offline, print jobs will accumulate in the Windows spooler. Set print timeout policies in printer properties.
- Daylight Saving Time (DST): Standard
localtime()logic can repeat or skip an hour during autumn/spring DST transitions. If exact shift accounting is required, evaluate UTC time or synchronize via SICLOCK / NTP master clocks. - Global Script Runtime Required: If Global Script Runtime is disabled in WinCC Computer Properties, the C-action will never run, and no printouts will occur.
- Commercial Accuracy: Standard WinCC reporting utilizes built-in Report Designer capabilities. For enterprise web reporting across multiple servers, consider the SIMATIC Information Server package (
6AV6371-1DH07-5AX0). Validate software options with an authorized Siemens distributor quotation.
Engineer FAQ
Can I print at specific non-modulo hours, such as 06:00, 10:00, 14:00, 18:00, and 22:00?
Yes. Instead of using the modulo operator (% 4), explicitly enumerate the target hours in the if-statement: if (timeinfo->tm_hour == 6 || timeinfo->tm_hour == 10 || timeinfo->tm_hour == 14 || timeinfo->tm_hour == 18 || timeinfo->tm_hour == 22).
Can RPTJobPrint output directly to a PDF without showing print dialogs?
Yes. If the print job printer setup is configured to an automated PDF printer (e.g., PDFCreator, Adobe PDF, or Microsoft Print to PDF configured with automated output naming), RPTJobPrint generates the PDF file silently in the background.
What happens if the OS server is rebooted right at the scheduled 4-hour mark?
If the PC is powered off during the exact trigger minute (e.g., 08:00), that specific printout will be skipped. If miss-protection is required, implement a startup check in Global Script that inspects the timestamp of the last printed file.
Does calling RPTJobPrint freeze the WinCC operator screen?
No. WinCC executes RPTJobPrint asynchronously via the background print manager subsystem (CCPrintJob.exe), leaving operator faceplates and graphics completely responsive.
Technical References
- SIMATIC WinCC V7.4 / V7.5 Report Designer System Manual - Siemens AG
- SIMATIC WinCC V7.4 / V7.5 Scripting and Global Script Guide
- SIMATIC Process Control System PCS 7 Operator Station Configuration Guide
Related Articles
- Designing Shift Reports with 8-Hour Statistical Calculations in WinCC Report Designer
- Restoring Missing Menus and View Toolbars in PCS 7 APL Faceplates in WinCC Runtime
- Optimizing WinCC Graphics Performance and Cyclic Tag Communication
Related Tags
- Report Designer
- Print Jobs
- Global Script
- RPTJobPrint
- Shift Reporting
- WinCC Scheduling