WinCC Flexible 2007: Exporting Alarm Logs to USB Flash Drive

David Krause12 min read
SiemensTroubleshootingWinCC
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

The WinCC Flexible 2007 HF4 engineering environment (now superseded by TIA Portal and WinCC Unified, but still in widespread service on legacy lines) supports exporting runtime alarm logs to removable media using the ArchiveLogFile system function. A common field failure mode is the ArchiveLogFile writes an empty CSV even though the operator has acknowledged the trigger and the function reports success at runtime. A second, related problem is the CSV containing valid records but with corrupted non-ASCII characters (e.g., Greek, Cyrillic, or Asian text rendered as ??G???S), caused by the ANSI code-page of the runtime export.

This reference walks through both fault paths, provides configuration-level root-cause analysis, documents the ArchiveLogFile parameter set, and closes with a cross-platform comparison so engineers migrating to TIA Portal / WinCC Unified / non-Siemens HMIs can map the equivalent workflow.

Legacy support note: WinCC Flexible 2007 SP5 / HF5 was the final standalone release. The HF4 build discussed here ships with project file format *.hmi and runtime for the SIMATIC Panels MP 177, MP 277, MP 377, TP 177B, TP 277, OP 277, and Mobile Panel 277(F) IWLAN.

Affected Hardware and Runtime Versions

USB export of alarm archives is supported on the following Siemens panels when running WinCC Flexible 2007 RT (HF4 or later):

Panel USB Host Storage Card Path Recommended Image
MP 177 Touch 1× USB-A (rear) \Storage Card2\ WinCC Flexible 2007 RT ≥ V1.4.0.3
MP 277 Touch / Key 2× USB-A \Storage Card USB\ or \Storage Card2\ WinCC Flexible 2007 RT ≥ V1.4.0.4
MP 377 Touch / Key 2× USB-A \Storage Card USB\ WinCC Flexible 2007 RT ≥ V1.4.0.5
TP 177B 4" / TP 277 6" 1× USB-A \Storage Card USB\ WinCC Flexible 2007 RT ≥ V1.4.0.4
OP 277 6" 1× USB-A \Storage Card USB\ WinCC Flexible 2007 RT ≥ V1.4.0.4
Mobile Panel 277(F) IWLAN 1× USB-A \Storage Card USB\ WinCC Flexible 2007 RT ≥ V1.4.0.4

Verify the runtime image on the panel via Start > Settings > OP Properties > Version. Builds older than HF4 (V1.4.0.x) must be updated before reliable CSV export is possible. The official update utility is part of the SIMATIC ProSave toolkit described in the Siemens entry ID 18796994 for SIMATIC Panels operator-side commissioning.

Root Cause Matrix: Why the CSV File Is Empty

Field experience and Siemens support notes consistently attribute empty CSV output to one of five root causes. The matrix below ranks them by frequency and shows the diagnostic to confirm.

# Root Cause Diagnostic Default Fix
1 Alarm class Logging flag not set Project tree > Logs > Alarm Log > Properties: Logging active unchecked Enable Logging per alarm class
2 Archive not assigned to alarm log Alarm Log > Properties > Archive: "(none)" Assign the alarm log to a Data Log archive with storage location Storage Card USB
3 ArchiveLogFile parameter set incorrectly Compare CSV header row with the log you intended to export Set Log Name exactly (case-sensitive) and File Name with .csv extension
4 Trigger event does not occur or has already fired Add a transient tag to SetBit immediately after ArchiveLogFile Re-trigger the function manually from a button in service screen
5 USB target path does not exist or read-only Browse \\Storage Card USB\\ in the panel file system Format the USB stick as FAT16 / FAT32 (max 4 GB); avoid NTFS / exFAT

The most frequent offender on commissioned systems is root cause #1: in WinCC Flexible 2007, the per-class logging default is disabled. Selecting an alarm class (e.g., Errors, Warnings, System) and opening its property dialog shows a checkbox Logging that must be activated before any record is eligible for archival.

Configuring the Alarm Log for USB Export

Before the ArchiveLogFile function is wired to a button, the underlying data store must exist. The procedure below creates a CSV-compatible archive bound to the USB stick.

  1. Open the WinCC Flexible 2007 project and select Project > Logs > Alarm Log.
  2. Right-click and choose Add Log if none exists. Default name: AlarmLog_1.
  3. Open Properties > Storage Location. Choose Storage Card (USB). The literal path the runtime writes to is \\Storage Card USB\\<File>.
  4. Open Properties > Archive. Click Add and select Data log (not Tag log) — the alarm log must be tied to a data archive.
  5. Set the File format drop-down to CSV (ANSI). The legacy format is fixed to ANSI code-page 1252; UTF-8 selection is not available in WinCC Flexible 2007 and is the root of the Greek-text corruption described later.
  6. Open Project > Logs > Alarm Classes. For each class (Errors, Warnings, System, etc.) open the property dialog and tick Logging.
  7. Set Logging active at runtime start in the alarm log properties — this is the parameter the original question referred to as "enable logging at runtime start".
  8. Compile and transfer the project. Confirm in the panel control panel under OP > Information > Project Information > Alarms that each class is reported as "Logging active".
If only the alarm log is configured but the per-class flag is off, the runtime quietly swallows incoming alarms. The ArchiveLogFile function still reports success because it wrote a valid (but empty) CSV header.

ArchiveLogFile Function Reference

The ArchiveLogFile system function is the operator-driven or scheduler-driven trigger that closes the active CSV segment and copies it to the target path. The full signature as documented in the WinCC Flexible 2007 help is:

BOOL ArchiveLogFile(
    LPTSTR  lpszLogName,        // Logical log name, e.g. "AlarmLog_1"
    LPTSTR  lpszFileName,       // Target file with path, e.g. "\\Storage Card USB\\alarms.csv"
    BOOL    bOverwrite          // TRUE = replace existing file
);

From the WinCC Flexible UI it appears as a script element under Functions > System Functions > Logs with three configurable fields:

Parameter Type Required Example
Log Name String Yes AlarmLog_1
File Name (incl. path) String Yes \Storage Card USB\alarms_$(date).csv
Mode Enum No Overwrite / Append (Append available from HF4)

Typical wiring: a button "Export Alarm Log" on a service screen calls ArchiveLogFile("AlarmLog_1", "\\Storage Card USB\\alarms.csv", FALSE) in the Press event. The runtime creates the file only after at least one record has been logged; calling the function on a freshly started panel with no events still produces an empty CSV with only the header row.

Solution: Step-by-Step Fix for an Empty Export

Apply the following procedure when the CSV header is created but no data rows appear.

  1. Verify the USB stick is formatted as FAT16 or FAT32 (right-click in Windows > Properties > File system). NTFS-formatted drives are recognized by the panel but the file system filter rejects write operations; the panel returns error code 0x031C in the system log.
  2. Insert the USB stick in the rear port of the panel and wait for the on-screen USB device detected toast.
  3. Open Project > Logs > Alarm Log > Properties > Storage Location. Confirm the path \Storage Card USB\. If only \Storage Card2\ is offered, the active storage media is the SD slot, not USB; switch the storage media in the project to Storage Card (USB) and re-transfer.
  4. Generate at least one alarm by simulating the trigger condition (e.g., force a tag that drives an alarm bit). Wait until the alarm view shows the new entry.
  5. Click the button wired to ArchiveLogFile. The CSV file should now contain header + at least one data row.
  6. If the file is still empty, open the panel System Log via Start > Control Panel > OP > Information > System Log and look for error codes 0x0301 (path not found), 0x0310 (write protect), 0x031C (filesystem error), or 0x0320 (archive not assigned).
Path spelling: WinCC Flexible 2007 expects backslashes doubled when entered from VBScript but single backslashes when entered via the function dialog. Mismatched escaping is the third most common cause of 0x0301 Path not found.

Non-ASCII Text Corruption in the CSV

The original poster observed the panel rendering Greek text correctly on screen but the exported CSV containing question marks and stray Latin glyphs. This is a code-page mismatch: WinCC Flexible 2007's CSV writer hard-codes Windows-1252 (ANSI Latin-1). Any character outside code-page 1252 — Greek, Cyrillic, Arabic, Hebrew, CJK — is replaced by a ? placeholder at write time. The Greek word ΣΦΑΛΜΑ therefore becomes ?G???S S???FO?.

Three practical workarounds exist for legacy systems where an upgrade is not feasible:

  1. Pre-process in Excel via VBA. Read the CSV as ANSI, then transcode the column to UTF-8 using ADODB.Stream with Charset = "windows-1253" (Greek) and re-save as UTF-8 with BOM. This is the route most field engineers eventually adopt.
  2. Switch the panel to English alarm text for the export. Use a separate Alarm Class whose Text Library is English; export that class only and maintain the Greek mapping in the engineering database.
  3. Add a VBScript wrapper. In WinCC Flexible 2007 a VBS procedure can read the CSV via FileSystemObject, write a parallel _UTF8.csv using Stream.Type = adTypeText, Stream.Charset = "UTF-8". Note that this only re-encodes what is left of the original; characters already destroyed by the ANSI writer cannot be recovered.

The clean long-term remedy is migrating to WinCC Unified (TIA Portal V21), which exports alarms as UTF-8 with an explicit Unicode Byte Order Mark. The Unified alarm control exposes an Export button directly in the runtime HMI; engineers no longer need a separate ArchiveLogFile-style trigger. See the Siemens TIA Portal help entry "Exporting alarms (RT Unified)" for the canonical procedure.

Storage Layout on the Panel

The WinCC Flexible runtime writes alarm archives to one of three logical mount points. The mapping differs by panel family and must be selected during project engineering.

Logical Name Physical Target Typical Use
\Storage Card MMC\ MMC / SD slot Recipes, permanent archives
\Storage Card CF\ CompactFlash slot (PC-based panels) Long-term logs
\Storage Card USB\ External USB stick Operator-triggered export
\Network\ SMB / NFS share (where supported) Centralized archiving

The runtime resolves the logical prefix to the first mounted media of the matching type. If the engineer specifies \Storage Card USB\alarms.csv but the operator has inserted an SD card into the front slot, the runtime silently selects the first available mount that satisfies the prefix, leading to "export appeared to succeed but file isn't on the USB" complaints. Always confirm in the panel's File Browser under Start > Programs > File Browser before relying on the operator workflow.

Cross-Platform Equivalent Procedures

Engineers moving between vendor stacks can use the following mapping when porting an alarm-export workflow:

Vendor / Platform Trigger Function Default Encoding USB Path Reference
Siemens WinCC Flexible 2007 HF4 ArchiveLogFile ANSI CP-1252 \Storage Card USB\ This article
Siemens WinCC Unified (TIA V21) Alarm control Export button or scripting API HMIRuntime.Alarms UTF-8 with BOM Configured via Unified archive settings WinCC Unified alarm export
Allen-Bradley PanelView Component PanelView Explorer > File Transfer > Alarm Log (project-side, not runtime) UTF-8 USB enumerated as removable drive in Windows host Rockwell KB 62141
Pro-face (Schneider Electric GP / SP series) Event-triggered Export Alarm Data action UTF-8 (CSV) \\usb\<file>.csv Pro-face Operation: Export Alarm Data
NI FlexLogger Alarm History pane Export button UTF-8 Local host disk; USB mapping is the OS's responsibility FlexLogger: Exporting Alarm History

The dominant pattern across vendors is the same: a runtime trigger function or UI button, a CSV file format, and a USB or removable-media sink. The two implementation differences that bite engineers in mixed fleets are (a) ANSI vs UTF-8 encoding, and (b) trigger placement (script-driven vs UI-driven).

Verification Checklist

After applying any of the fixes above, run the following verification on the live panel before signing off the change.

  1. Force at least three alarm events of different classes (Error, Warning, System).
  2. Click the export button. The CSV must contain one header row and at least three data rows with timestamps in the configured format (default yyyy-MM-dd HH:mm:ss).
  3. Remove the USB stick and reinsert it in a Windows PC. The CSV must open in Notepad without NUL bytes and in Excel with correct column alignment.
  4. Repeat step 2 with a 1-second scheduler trigger; confirm the Append mode in HF4 creates one CSV per cycle rather than overwriting.
  5. Open the panel system log and confirm no error codes 0x0301, 0x0310, 0x031C, 0x0320 are present since the change.
  6. For Greek / non-ASCII sites: open the CSV in Notepad++, switch the encoding to ANSI > Greek (1253), and verify the column reads back cleanly. If not, schedule a migration to WinCC Unified.

Field-Proven Edge Cases

The following conditions have been reported by maintenance teams on installed bases and are worth pre-empting:

  • USB stick with multiple partitions. The WinCC Flexible runtime binds to the first FAT partition only. Use single-partition sticks under 8 GB to avoid confusion.
  • USB stick with LED activity indicator that never blinks. Indicates a power-management issue on MP 277 panels manufactured before 2009 — use a self-powered hub or a stick under 4 GB (lower inrush current).
  • Export succeeds but file is locked. The runtime holds a write lock for up to 30 seconds after ArchiveLogFile. Pulling the stick too early truncates the file. Add a 5-second wait or an Eject USB button that calls the DisableUSB system function before physical removal.
  • Scheduled daily export with date-named file. WinCC Flexible 2007 supports $(date), $(time), and tag-substitution placeholders in the File Name field. Combine with a daily scheduler to produce rolling CSVs without manual intervention.
  • Project re-transfer wipes the existing log. Backup the \Storage Card MMC\ or \Storage Card USB\ archive before each transfer; otherwise alarm history accumulated between transfers is lost.

Migration Path to Modern Platforms

When the pain of ANSI-only CSV export, the absence of Unicode, or the lack of remote diagnostics forces an upgrade, the migration matrix below helps scope the effort. WinCC Flexible 2007 projects migrate to TIA Portal via the Port Project wizard; WinCC Unified requires a partial rewrite of alarm scripting but accepts the same logical alarm model. Reference the Siemens Industry Online Support portal for migration guides tied to specific panel replacements, and the WinCC Unified alarm export documentation for the target-side procedure.

FAQ

Why does my WinCC Flexible 2007 CSV export contain only the header row?

The most common cause is that Logging is disabled on the alarm class. Open Project > Logs > Alarm Classes, select each class, and tick Logging; also confirm that the alarm log is bound to a data archive assigned to \Storage Card USB\.

Which file system should the USB stick use for Siemens panels?

Format the USB stick as FAT16 or FAT32. NTFS and exFAT partitions are partially recognized but write attempts return error code 0x031C. Keep partitions under 8 GB and avoid multi-partition layouts for predictable behavior.

How do I export Greek (or other non-Latin) text correctly from WinCC Flexible 2007?

WinCC Flexible 2007's CSV writer is fixed to ANSI code-page 1252, so non-Latin characters are replaced with ?. Recover the original text by reading the CSV in Excel VBA with Charset = "windows-1253" (or the matching code page) and re-saving as UTF-8, or migrate to WinCC Unified which writes UTF-8 natively.

Can I schedule automatic alarm exports without operator action?

Yes. Use the WinCC Flexible scheduler to call ArchiveLogFile at a fixed interval (for example, every 24 hours). Use the $(date) and $(time) placeholders in the file name to avoid overwriting previous exports; set the mode to Append (available from HF4) if you want a single rolling log.

What panel firmware do I need for reliable USB export?

Use WinCC Flexible 2007 RT image V1.4.0.4 or later (HF4 minimum, HF5 recommended). Update older panels with the SIMATIC ProSave toolkit and verify the build under OP Properties > Version. Images older than HF4 may write the file but silently truncate the contents.

Back to blog