Overview
WinCC Alarm Logging Runtime ships a fixed-format Line Layout named @CCAlgRtSequence.RP1 that drives the print job Report Alarm Logging RT Message Sequence. The layout is intended for character-cell line printers connected to the station's parallel (LPT) port, and it is auto-activated by the WinCC startup list function Message Sequence Report. Whenever Alarm Logging Runtime queues an event, the layout emits one formatted line to the configured line printer queue.
Modern stations rarely expose an LPT port. The most common field situation is a USB-connected line printer (Epson TM-series, Star Micronics SP-series, OKI ML-series) or a USB-connected page printer being repurposed as a sequential event logger. This article documents how the .RP1 line layout works, how to re-route it to a USB device, and how to substitute or extend it with a Global Script C action when the built-in layout is too restrictive.
Architecture: Alarm Logging RT, Print Jobs, and Line Layouts
WinCC separates the alarm data path from the print path through three coordinated objects:
- Alarm Logging Runtime (CS/RT) — the message archive and event source. The RT component evaluates incoming tags, OPC alarms, or system messages and pushes events into the active message buffer.
- Print Job — a named configuration entry under WinCC Explorer > Report Designer > Print Jobs. A print job binds a layout file to a Windows print queue and a trigger (time, event, hotkey).
-
Line Layout (.RP1) — a fixed-column text layout, one event per line, optimized for line printers. The counterpart Page Layout files use the extension
.RPLand target page printers.
The runtime entry @CCAlgRtSequence.RP1 belongs to the system layout set delivered with every WinCC installation. It is referenced by the print job @Report Alarm Logging RT Message Sequence and is selected by the startup-list function Message Sequence Report. Removing or renaming the file disables the function silently because the startup list call is by string name.
Prerequisites
- WinCC V7.x or WinCC Professional (TIA Portal) with Alarm Logging Runtime licensed and activated on the engineering station or a dedicated OS server.
- The Windows printer driver installed and a working Windows print queue named consistently across reboots (avoid dynamic names like
EPSON TM-T20 (Copy 2)). - For LPT-style logging on USB hardware, an active
net use LPT1mapping established before WinCC Runtime starts. - For scripted printing, Global Script Runtime with C interpreter enabled (default in WinCC V7).
- Read/write permission to
<WinCC project>\Printfor layouts and to<WinCC project>\ScriptLibfor action libraries.
@CCAlgRtSequence.RP1 in place. The leading @ marks it as a system file and WinCC will overwrite the file on project migration or hotfix install. Copy it to a user layout such as UserAlgRtSequence.RP1 and re-bind the print job.The @CCAlgRtSequence.RP1 Line Layout File
An .RP1 file is a plain-text column definition. Each line in the file declares one output column for one event row. The runtime concatenates columns in declaration order until the line reaches the printer's width (commonly 80, 96, 120, or 136 columns). The default sequence report layout defines the columns shown below; field widths are characteristic for a 132-column line printer:
| Order | Column | Typical Width | Source |
|---|---|---|---|
| 1 | Date (DD.MM.YYYY) | 10 | MsgFilter: DateTime |
| 2 | Time (HH:MM:SS) | 8 | MsgFilter: DateTime |
| 3 | State (+/-) | 1 | MsgFilter: State |
| 4 | Priority | 2 | MsgFilter: Priority |
| 5 | Class | 6 | MsgFilter: ClassName |
| 6 | Number | 10 | MsgFilter: Number |
| 7 | Source (Tag / PLC) | 20 | MsgFilter: Source |
| 8 | Event text (formatted) | 50 | MsgFilter: Text |
| 9 | Operator station | 8 | MsgFilter: Station |
| 10 | Trailing CR/LF | 2 | Implicit |
If the runtime encounters a column whose source value exceeds the declared width, it truncates by default. Some WinCC builds support a Wrap flag in the column properties that inserts a CR/LF and continues on the next line; this is undesirable for line printers because it desynchronizes the printed log from the audit trail.
Step-by-Step Configuration of the Print Job
- Open WinCC Explorer on the engineering station and load the runtime project.
- Right-click Report Designer > Print Jobs and select New Print Job. Name it exactly
Report Alarm Logging RT Message Sequenceif you are creating a project-local override; the system print job is identified by this string. - In the print job properties, set the Layout field to the user copy
UserAlgRtSequence.RP1(or@CCAlgRtSequence.RP1for stock behavior). - Set the Printer dropdown to the desired Windows queue. For raw line printing, choose the queue with Print directly to the printer enabled and spooling disabled.
- Open the Properties > Trigger tab. Enable Event-driven and bind to the Alarm Logging event source
ALG. - Compile and download the project. Verify the new
Print.inientry:[Print]should containRP1=UserAlgRtSequence.RP1under the alarm section. - Start Runtime. The first queued alarm should print within one polling interval of the Alarm Logging service.
Mapping LPT1 to a USB Printer
The legacy @CCAlgRtSequence.RP1 layout emits raw bytes to whatever queue the print job points at. WinCC stores the queue assignment per project in <project>\Print\Print.ini. If the project still references the legacy parallel device LPT1, redirect with one of the following methods.
Method 1 — Windows Print Sharing (Persistent)
- Share the USB printer on the WinCC station as
AlarmPrinterwith the share nameAlarmLP. - From an elevated command prompt, run:
net use LPT1 \\<hostname>\AlarmLP /persistent:yes - Restart the WinCC Runtime service. Confirm with
net usethat the LPT1 mapping persists across logon.
Method 2 — Windows Printer Pool (No Network Share)
- Open Devices and Printers > Add a printer > The printer that I want isn't listed > Add a local printer.
- Select Create a new port > Local Port and enter the UNC path
\\<hostname>\AlarmLP. - Complete the wizard using the USB printer's driver. The local port appears in the print queue properties and accepts raw text the same way LPT1 would.
Method 3 — Direct Reassignment in Print.ini
Edit <project>\Print\Print.ini while Runtime is stopped. Replace the legacy device reference:
[AlarmLoggingRT]
Printer=AlarmLP
Layout=UserAlgRtSequence.RP1
Format=RP1
Save the file, restart the Alarm Logging service, and verify the assignment with type Print.ini.
Print.ini is rewritten by the WinCC configuration dialog. Prefer Method 2 for production.Printing Multiple Alarms via Global Script C
When the operator wants a per-shift summary rather than a one-line-per-event stream, or when the printer only supports USB page-mode output, the recommended pattern is to suppress the system print job and emit a custom report from a Global Script C action.
Action: Dump All Pending Alarms to a USB Printer
- Open WinCC Explorer > Global Script > C-Editor.
- Create a new action of type Print Job / Project Function named
PrintAlarmBatch. - Insert the following body, adapted from the Siemens WinCC V7 Global Script reference:
#include "apdefap.h"
void PrintAlarmBatch(const char* lpPrinterName)
{
DWORD dwFlags = 0x0000; // no time/status filters
long lMsgCount = 0;
CMN_ERROR Error;
memset(&Error, 0, sizeof(Error));
// Get the snapshot of currently active alarms
lMsgCount = MSRTGetMsgCount(dwFlags, NULL, NULL);
for (long i = 0; i < lMsgCount; ++i)
{
MSG_RTDATA_STRUCT msg;
memset(&msg, 0, sizeof(msg));
if (MSRTGetMsg(&msg, i, dwFlags, NULL, NULL) == 0)
{
char szLine[256];
_snprintf_s(szLine, sizeof(szLine),
_TRUNCATE,
"%02d.%02d.%04d %02d:%02d:%02d %c P%-2d %-12s %-10lu %-24s %s\r\n",
msg.stMsg.wDay, msg.stMsg.wMonth, msg.stMsg.wYear,
msg.stMsg.wHour, msg.stMsg.wMinute, msg.stMsg.wSecond,
(msg.dwMsgState == MSG_STATE_CAME) ? '+' : '-',
msg.stMsg.wPriority,
msg.stMsg.szClassName,
msg.stMsg.dwMsgNumber,
msg.stMsg.szSource,
msg.stMsg.szText);
// Raw write to the named printer queue
HANDLE hPrinter;
if (OpenPrinter((LPSTR)lpPrinterName, &hPrinter, NULL))
{
DOC_INFO_1 di = { (LPSTR)"AlarmBatch", NULL, (LPSTR)"RAW" };
DWORD dwJob = StartDocPrinter(hPrinter, 1, (LPBYTE)&di);
if (dwJob)
{
StartPagePrinter(hPrinter);
DWORD dwWritten = 0;
WritePrinter(hPrinter, szLine, (DWORD)strlen(szLine), &dwWritten);
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
}
ClosePrinter(hPrinter);
}
}
}
}
- Add a button on the alarm view that calls
PrintAlarmBatch("AlarmLP"). - Disable the system print job Report Alarm Logging RT Message Sequence in the WinCC startup list to avoid duplicate output.
MSRTGetMsgCount and MSRTGetMsg prototypes are declared in the WinCC C-API header apdefap.h. They are available with WinCC V7.0 SP3 and later. Earlier builds require the older MSG_RTDATA union form.Switching from Line Printer to Windows Printer
If the station no longer has a continuous-feed printer and the operator only needs on-screen acknowledgement plus a Windows print spool archive, replace the line layout with a page layout:
- In WinCC Explorer, navigate to Report Designer > Page Layouts and create
UserAlgRtSequence.RPL. - Add a dynamic table bound to the Alarm Logging connection
ALG; set the time range to Last 1 hour for a default shift report. - Edit the print job and replace the layout reference from
UserAlgRtSequence.RP1toUserAlgRtSequence.RPL. - Select a Windows print queue that supports RAW or EMF pass-through. EMF is preferable when using a laser printer because the spooler can re-paginate.
- Trigger the job manually with the hotkey configured on the print job's Hotkey tab.
Verification and Test Procedure
- Force a known alarm by toggling the configured trigger tag in the PLC or via Tag Simulation in WinCC.
- Confirm the message appears in the Alarm Logging on-screen view within 500 ms.
- Confirm one line is printed at the target queue within the next polling interval (default 1 s).
- Repeat with a GO (clear) event; the column State should show '-'.
- Disconnect the printer queue and observe whether Alarm Logging drops the event, queues it, or surfaces an error in WinCC Alarm Logging Diagnostics. Expected behavior is event buffering with no Runtime stop.
- Restart the station and confirm the LPT1 mapping (Method 1) or local port (Method 2) is restored before WinCC Runtime initializes.
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Fix |
|---|---|---|---|
| No output at all | System print job disabled or renamed | Inspect Print.ini; check Startup List dialog |
Re-create job with exact name Report Alarm Logging RT Message Sequence
|
| Output only first 80 columns | Layout width mismatch | Compare printer driver line width vs. layout sum | Adjust driver to 132-column mode or rebuild layout |
| Garbled text on USB thermal printer | Spooler inserts PCL/Escape sequences | Capture raw bytes with a sniffer printer | Enable Print directly to printer on the queue; disable EMF |
| Events arrive but no print line | Layout file missing or 0 bytes | Check <project>\Print\@CCAlgRtSequence.RP1 size |
Recopy from WinCC installation media; restart service |
| Duplicate lines | Both system and Global Script action emit | Count lines per event; check startup list | Disable one of the two print paths |
| Slow spool after network printer share | Authentication on share lost | Check net use output |
Re-map LPT1 with stored credentials |
| Truncated message text | Column width too narrow | Inspect line vs. message text in Alarm Logging tool | Increase column width in user layout |
| Page breaks inserted every event | Page layout bound instead of line layout | Check Print.ini Format= field | Switch Format from RPL to RP1 |
Performance and Sizing Notes
A single line printer can absorb roughly 800 to 1,200 lines/minute depending on character density and serial-vs-parallel transport. Burst alarm rates above this threshold will back up the WinCC print spool. Alarm Logging Runtime buffers up to 1,000 unprinted messages in the queue; overflow messages are written to <project>\Logs\AlarmLog.bak with a timestamp. Plan the alarm class structure so that high-frequency nuisance alarms (e.g. communication retries) are filtered from the sequence report before they hit the printer.
For USB thermal printers the realistic throughput drops to 250 to 400 lines/minute because of USB latency and FIFO buffering at the controller. If the alarm class exceeds 100 events/minute sustained, switch from line logging to periodic page-logging instead.
Migration Checklist from Legacy LPT to USB
- Inventory every project print job that references an LPT device.
- Map each LPT device to a named local port or persistent share.
- Replace any direct LPT references in startup-list functions with the Windows queue name.
- Run a 24-hour soak test with the alarm simulator generating 10 events/minute.
- Validate the audit trail matches the printed log byte-for-byte.
- Update the plant documentation: the printer is no longer a hardware asset of the PLC panel; it is a peripheral of the WinCC station.
FAQ
What is the @CCAlgRtSequence.RP1 layout used for?
It is the system Line Layout bound to the print job "Report Alarm Logging RT Message Sequence". It produces one fixed-width line per Alarm Logging Runtime event and is selected by the WinCC startup-list function "Message Sequence Report".
Why does the layout fail when I switch from LPT1 to a USB printer?
The layout is printer-agnostic, but the print job's queue assignment is not. If the queue still points to LPT1, Windows drops the data because no LPT port exists. Re-route via a shared printer (net use LPT1), a local UNC port, or by editing Print.ini to reference the USB queue directly.
Can I print a batch of alarms instead of one line per event?
Yes. Disable the system print job and use a Global Script C action that calls MSRTGetMsgCount and MSRTGetMsg to iterate the active message buffer, format each entry, and write it through WritePrinter to the named USB queue.
What is the maximum line width supported by RP1 layouts?
RP1 layouts support up to 255 columns per logical line, but line printers are physically limited (80, 96, 120, or 136 columns). Keep the sum of declared column widths at or below the printer's hardware column count to avoid truncation or wrap.
How do I avoid duplicate printing after adding a custom C action?
Disable the startup-list function "Message Sequence Report" or remove the print job "Report Alarm Logging RT Message Sequence" from the project before activating your scripted path. The two paths do not coordinate; both will fire on every event.