Configuring WinCC HMI Alarm History for Past Date Viewing

David Krause15 min read
HMI / SCADASiemensTutorial / How-to
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

Configuring WinCC HMI Alarm History for Past Date Viewing

Operators routinely need to review alarm events that occurred hours, days, or weeks before the current HMI session. A failure event from a Monday morning shift, a quality excursion that surfaced only on Wednesday's SPC report, or a sequence of warnings that preceded a weekend shutdown all require deterministic, time-indexed retrieval of historical alarm data. In Siemens WinCC (TIA Portal and WinCC V7.x) and the legacy WinCC flexible (2008 SP5) environment, the Alarm Control supports several distinct historical retrieval mechanisms: the in-memory alarm buffer, the short-term archive (segmented ring buffer), the long-term archive (database-backed), and the SQL-exported archive. This reference details the engineering steps, tag addressing, and runtime selection dialog configuration required to give operators a usable, auditable historical alarm view at the panel.

Platform scope. This article addresses three Siemens HMI/SCADA environments: (1) WinCC flexible 2008 SP5 used with SIMATIC Panels and the WinCC flexible Runtime, (2) WinCC V7.5/V7.4 SCADA on a PC station, and (3) WinCC Professional / WinCC Unified inside the TIA Portal. The selection dialog mechanics differ in each platform but the underlying segmentation and archive philosophy is consistent.

Prerequisites

Before enabling historical alarm viewing, confirm the following engineering prerequisites are satisfied at the project, runtime, and storage layers.

Layer Requirement Notes
Engineering WinCC flexible 2008 SP5, WinCC V7.4 SP1 / V7.5 SP2, or TIA Portal V16+ with WinCC Professional / Unified SP level dictates available alarm control properties and script libraries.
Runtime WinCC flexible RT, WinCC RT, or WinCC Runtime Professional / Unified PC Runtime must be licensed for alarm logging (option "Alarm Logging" / "Alarm Logging RT").
Storage Persistent storage path (local SSD, network share, or SQL Server) Long-term archives require either Microsoft SQL Server (WinCC V7.x) or the internal SQLite-based archive (WinCC Unified).
Authorization Operator logged in with view rights for the relevant alarm class User administration is configured in the project tree under "User Administration".
Time sync HMI station synchronized via NTP or S7 time Out-of-sync panels produce inconsistent segment time stamps.

Alarm Storage Architecture: Buffer vs. Short-Term vs. Long-Term

WinCC separates historical alarm data into three concentric storage layers. Selecting the correct layer for an operator's question is the single most important engineering decision when designing an alarm history view.

Layer Backing Store Default Capacity Retention Typical Use
Alarm Buffer (Runtime) In-memory circular buffer 500–5,000 entries (panel-dependent) Volatile, lost on RT restart Live session scrollback, no archive I/O
Short-term Archive Segmented files (single segment = 1 day, 1 week, or 1 month) 1–500 segments, each 10–100 MB Configurable segment rotation Local-panel history, fast lookup, no database
Long-term Archive (WinCC V7.x) Microsoft SQL Server (CC_AlarmsDB / CC_AlarmsDBLong) SQL-driven, multi-million rows DBA-controlled Multi-station correlation, regulatory retention, SQL reporting

The CCAlgWinCtrl (the WinCC V7.x Alarm ActiveX control) exposes all three layers through a single property interface, allowing the operator to select the source via the toolbar selection dialog. In WinCC flexible, the equivalent dialog is invoked by the Selection toolbar button on the Alarm Control. In TIA Portal WinCC Professional, the HMI AlarmControl V15+ exposes AlarmViewMode = Active, Logged, or Logged+Active.

Configuring Alarm Logging in WinCC flexible 2008 SP5

WinCC flexible stores alarm archives in segmented files at the path defined in the project. Enable and configure the archive in the project tree before commissioning.

  1. Open the project in WinCC flexible 2008 SP5.
  2. In the project tree, right-click Alarms → Alarm Logging and select Settings.
  3. Open the Archives tab and enable Alarm Logging Archive.
  4. Configure the storage path: \Storage Card\Logs\Alarms for a Multi Panel, or a network share such as \\HMI-ARC01\Alarms\ for PC-based Runtime.
  5. Set the segment length. For daily review use cases, set Single segment = 1 Day. For monthly review, set Single segment = 1 Month.
  6. Set the number of segments to retain. 30 daily segments or 24 monthly segments are typical starting points.
  7. Click Apply, then transfer the project to the panel.
Storage media warning. On Multi Panels using SD cards, do not exceed 4 GB of total alarm archive size, as some panels impose a 2 GB single-file limit per segment. For larger histories, switch to PC-based Runtime with a dedicated SSD, or use the segmented ring buffer and export older segments via the ExportFile button in the Alarm Control toolbar.

Configuring Alarm Logging in WinCC V7.x (WinCC 7.4 / 7.5)

WinCC V7.x uses Microsoft SQL Server as the backing store for both the short-term and long-term alarm archive. Configuration occurs in the WinCC Explorer and the SQL Server Management Studio.

  1. Open WinCC Explorer and right-click Alarm Logging.
  2. In the Message Archive tab, enable archiving. Set the archive type to WinCC Database (SQL Server).
  3. Configure the segment size. Default is 250,000 messages per segment, but for high-volume plants reduce to 50,000 to limit single-file size.
  4. Open Computer → Properties → Startup and enable Alarm Logging Runtime.
  5. For multi-station systems, configure the long-term archive by right-clicking Alarm Logging → Archive Configuration → Long-term Archive. Point it to a central SQL Server instance.
  6. Restart the WinCC Runtime to initialize the archive tables.

Verify the archive tables exist in SQL Server by querying SELECT TOP 10 * FROM dbo.AlgView. The AlgView view joins the active and archived message tables and is the standard retrieval view for the WinCC OLE-DB provider.

Using the Alarm Control Selection Dialog (Toolbar Method)

The fastest path to give operators a past-date alarm view is to enable the standard selection dialog on the Alarm Control toolbar. The dialog supports time-range, priority, class, and text filtering without any custom scripting.

  1. In the Graphics Designer, insert the CCAlgWinCtrl ActiveX control (WinCC V7.x) or the Alarm Control (WinCC flexible) onto the screen.
  2. Open the control's Toolbar Configuration and enable the Selection Dialog button (icon: filter funnel).
  3. For WinCC flexible, ensure the Toolbar property is set to Show; for WinCC V7.x, set the ShowToolbar property to TRUE.
  4. Transfer the project and start Runtime.
  5. At runtime, click the Selection Dialog button. A new window opens.
  6. In the Selection window, navigate to System Blocks → Date and System Blocks → Time.
  7. Enter the desired start and end timestamps (e.g., 2024-03-04 06:00:00 to 2024-03-04 14:00:00).
  8. Click OK. The Alarm Control populates with the historical events in the requested range.
Time-zone consideration. The selection dialog uses the time zone of the local WinCC station. If the panel and the SQL archive server are in different time zones, configure the Time Base property in the Alarm Control to either Local or UTC consistently, and document the choice in the project HMI documentation.

Custom Date Selection with I/O Fields

Operators often want a single-screen entry that accepts a date, a button that triggers the historical view, and immediate output, without the multi-click toolbar dialog. This is implemented in WinCC flexible by combining two I/O fields with a small VBScript function attached to a button's Click event.

  1. Add two I/O fields to the screen: Date_From and Date_To. Configure both as Input/Output, data type String, length 19 (format YYYY-MM-DD HH:MM:SS).
  2. Add a button labeled Show Historical Alarms.
  3. Attach the following VBScript to the button's Click event:
' VBScript for WinCC flexible 2008 SP5
' Bound to button: Show_Historical_Alarms
Sub Show_Historical_Alarms()
    Dim sFrom, sTo, oCtrl
    sFrom = SmartTags("Date_From")
    sTo = SmartTags("Date_To")

    If sFrom = "" Or sTo = "" Then
        ShowSystemAlarm "Enter both start and end timestamps."
        Exit Sub
    End If

    Set oCtrl = HmiRuntime.Screens("AlarmScreen").ScreenItems("AlarmControl")
    oCtrl.SetFilterDateTime sFrom, sTo
    oCtrl.Activate = True
End Sub

For WinCC V7.x, the equivalent uses the IMessageFilter COM interface exposed by CCAlgWinCtrl:

' VBScript for WinCC V7.x Graphics Designer
' Bound to button: Show_Historical_Alarms
Sub Show_Historical_Alarms()
    Dim oCtrl, oFilter
    Set oCtrl = ScreenItems("AlarmControl")
    Set oFilter = oCtrl.GetMessageFilter()

    oFilter.FilterDateFrom = CDate(SmartTags("Date_From"))
    oFilter.FilterDateTo = CDate(SmartTags("Date_To"))
    oFilter.ApplyFilter

    oCtrl.Refresh
End Sub

Tag-Based Filtering with Predefined Selection Strings

For frequently used historical windows (e.g., "yesterday's shift," "last week," "this month"), pre-stored selection strings save operator time. In WinCC flexible, populate internal tags SelDateFrom and SelDateTo from the PLC using a STEP 7 function block, and bind them to the Alarm Control's filter properties.

Internal Tag Data Type Bound To PLC Source (S7-1500)
SelDateFrom String[19] Alarm Control FilterDateFrom DB_HMI.Date_From (DT)
SelDateTo String[19] Alarm Control FilterDateTo DB_HMI.Date_To (DT)
SelPreset Int Dropdown preset index DB_HMI.Preset (0=Today, 1=Yesterday, 2=LastWeek)

SQL Archive Query for Custom Reports

When operators need a report that the Alarm Control cannot render directly (e.g., a Pareto of alarm classes for a date range), use the WinCC OLE-DB provider. The connection string for the alarm archive is:

Provider=WinCCOLEDBProvider.1;
Catalog=CC_AlarmsDB_<ServerName>_<ProjectName>;
Data Source=<SQLServer>;
User ID=<User>;
Password=<Password>;

Sample query for the alarm Pareto between two timestamps:

SELECT ClassName, COUNT(*) AS EventCount
FROM dbo.AlgView
WHERE DateTime BETWEEN '2024-03-01 00:00:00.000' AND '2024-03-31 23:59:59.999'
  AND State = 1   -- 1 = CameIn, 2 = WentOut, 3 = Ack
GROUP BY ClassName
ORDER BY EventCount DESC;

Bind the query to a WinCC Online Table Control or export the result set to CSV via a button-driven VBScript that uses ADODB.Recordset.

Verification and Commissioning Checklist

After configuring the historical view, perform the following verification steps before releasing the project to operations.

  1. Trigger a known event. Force a real or simulated alarm at a known timestamp and confirm it appears in both the live buffer and the archive.
  2. Selection dialog test. Open the selection dialog, enter the timestamp from step 1, and verify the alarm appears.
  3. I/O field test. Use the custom I/O field method to retrieve the same alarm. Confirm byte-for-byte equality with the toolbar method output.
  4. Cross-boundary test. Request a window that crosses a segment boundary (e.g., 23:50 to 00:10 the next day). Verify that alarms from both segments are merged seamlessly.
  5. Time-zone test. If the panel and SQL server differ in time zone, force an alarm 5 minutes before and after a DST transition and verify the displayed timestamp matches the configured time base.
  6. Permission test. Log in as an operator without archive rights and confirm the toolbar's selection dialog is greyed out.
  7. Performance test. Request a 30-day window on a high-volume plant (>5,000 alarms/day) and measure the query time. Target: <3 s for the selection dialog, <10 s for a SQL-based report.

Troubleshooting Matrix

Symptom Likely Cause Corrective Action
Selection dialog button missing Toolbar button not configured Open the Alarm Control properties, navigate to Toolbar → Selection, and enable the button.
Selection dialog opens but no alarms appear Archive not enabled, or segment path missing Confirm the archive path in Alarm Logging → Settings → Archives exists and is writable. Check for the *.lbf segment file in the configured folder.
Alarms appear with a 1-hour offset Daylight Saving Time mismatch Set Time Base property to UTC and convert at the operator display, or correct the OS time zone of the HMI station.
Error code 0x80004005 from CCAlgWinCtrl SQL Server connection lost or insufficient rights Verify the WinCC user has read rights on the archive database. Restart the SQL Server service if it has stopped.
VBScript fails with "Object required" Alarm Control name mismatch or screen not active Verify the ScreenItems name matches the control's Name property. Use HmiRuntime.Screens(...).ScreenItems(...) only when the screen is loaded.
Archive folder fills up too fast Segment size too small or no rotation configured Increase the segment size, reduce the number of segments retained, and configure an automatic export of old segments to a NAS share.
Filter returns alarms from outside the requested range Filter not applied after VBScript Call oCtrl.ApplyFilter (WinCC V7.x) or oCtrl.Activate = True (WinCC flexible) after setting the filter properties.
Time stamp in archive is in server time, not panel time Long-term archive on a different time zone Configure the long-term archive server with the same time zone as the local station, or store timestamps as UTC and convert on display.

Cross-Platform Notes and Comparable Implementations

Engineers standardizing alarm history design across multiple HMI/SCADA vendors should expect minor functional differences in past-date selection mechanics. For example, the Siemens SIMATIC HMI product line, with WinCC flexible, WinCC V7.x, and TIA Portal WinCC Professional, all implement segmented ring-buffer archives with a selection dialog that exposes System Blocks for date and time filtering. Comparable alarm-history navigation patterns can be found in vendor-neutral SCADA platforms that pair an in-memory active alarm list with a database-backed historical table, and the engineering principles of time-range selection, class filtering, and segmented retention translate directly.

For plants that operate Siemens HMIs side-by-side with AutomationDirect C-more panels, the C-more project editor exposes a similar Alarm History object that stores past alarm events on a configured SD card; the object has its own date-range filter dialog with comparable selection semantics. While the database and storage format differ from WinCC, the operator workflow of "pick start, pick end, click Show" is identical and can be standardized across panels in a heterogeneous plant.

For multi-server TIA Portal environments using Siemens Industry Online Support documentation for WinCC Unified (V17+), the same historical retrieval is achieved with the Alarm Control V15+ property AlarmViewMode = Logged in combination with a logged-alarm query bound to a date-range tag. Refer to the WinCC Unified Programming and Reference Manual for the latest tag interface.

Security and Audit Considerations

Historical alarm data is often used as evidence in regulatory audits (FDA 21 CFR Part 11, IATF 16949, GxP). When commissioning a historical alarm view, address the following:

  • Audit trail. Configure the Alarm Logging audit log to record filter changes and export actions. In WinCC V7.x this is enabled under Alarm Logging → Audit → Configuration.
  • Read-only archive role. Define a dedicated OS user (e.g., wincc_audit_read) for archive queries. Grant SELECT-only rights on CC_AlarmsDBLong and revoke INSERT/UPDATE/DELETE.
  • Data integrity. Enable SQL Server checksums on the archive database. Verify nightly DBCC CHECKDB runs succeed.
  • Time integrity. Configure the WinCC station to synchronize with an NTP source that itself is traceable to a UTC(k) laboratory. Document the time source in the system architecture.
  • Retention policy. Define a written retention policy (e.g., 7 years for life-sciences, 3 years for general manufacturing) and configure the long-term archive segment count accordingly.

Field-Commissioning Acceptance Test

A repeatable acceptance test for a historical alarm view consists of the following five-step protocol executed once per shift during SAT (Site Acceptance Test):

  1. Note the current WinCC station time T0.
  2. Trigger three known alarms at T0, T0 + 30 min, T0 + 60 min with distinctive text.
  3. Open the selection dialog. Enter T0 - 1 h to T0 + 2 h. Verify all three alarms are listed, in chronological order, with correct class and state.
  4. Export the result to CSV via the Alarm Control toolbar. Verify the CSV row count matches the displayed row count.
  5. Compare the CSV timestamps against T0; deviations greater than 1 second indicate a time-sync issue and require investigation before the project is signed off.

Document the result of each shift's test in the project's Commissioning Log. A failed test blocks project acceptance and triggers a CAPA (Corrective and Preventive Action).

Performance Tuning for High-Volume Plants

Plants with continuous processes (petrochemical, power, water/wastewater) routinely generate 10,000+ alarms per day. Without tuning, a 30-day query can take 30 s or more, which is unacceptable for operator workflow. Tune the following parameters:

Parameter Default Recommended for High Volume Rationale
SQL Server segment size (WinCC V7.x) 250,000 messages 50,000 messages Smaller segments allow faster partial queries.
Number of segments 500 365 (1 year daily) Avoids scanning 5+ year-old segments for recent queries.
Index on DateTime column Clustered (default) Non-clustered on DateTime + ClassName Range queries benefit from a non-clustered index on the filter columns.
Alarm Control page size 100 500–1,000 Reduces paged fetch operations for long result sets.
Archive statistics update Every 1 s Every 5 s Reduces SQL Server CPU at the cost of marginal UI latency.

Related Documentation and References

For deeper coverage of alarm logging, segmented archives, and the Alarm Control programming interface, refer to the official Siemens documentation portal. The Siemens Industry Online Support portal hosts the current WinCC V7.5, WinCC flexible 2008, and TIA Portal WinCC Professional / Unified manuals, including the WinCC Alarm Logging programming reference and the WinCC V7 Communication manual for OLE-DB provider details. Application examples, FAQ entries, and firmware version compatibility matrices are searchable by manual number (e.g., WinCC V7.5 SP2 Manual Collection, 6AV2 100-0AA05-0AA0) on the same portal.

How do I enable the historical alarm selection dialog at runtime in WinCC flexible?

Open the Alarm Control's property sheet, navigate to Toolbar, and enable the Selection button. At runtime the operator clicks the funnel icon, navigates to System Blocks → Date and Time, enters the desired range, and confirms. The Alarm Control populates with the historical events from the configured archive path.

Where is the alarm buffer for classic WinCC (WinCC V7.x)?

The buffer is held in the CC_AlarmsDB SQL Server database, joined to the active and archived message tables via the dbo.AlgView view. The CCAlgWinCtrl ActiveX control on a WinCC V7.x screen exposes this view through its Selection Dialog button. Older segments are moved to CC_AlarmsDBLong by the long-term archive service.

Can operators type a starting date in an I/O field instead of using the toolbar dialog?

Yes. Add two I/O fields bound to internal String tags Date_From and Date_To, and attach a small VBScript to a button. The script reads the tags, validates the format (YYYY-MM-DD HH:MM:SS), and calls the Alarm Control's filter method (SetFilterDateTime in WinCC flexible, IMessageFilter in WinCC V7.x). Activate the filter after assignment to commit the change.

Why does the selection dialog open but show no alarms?

The most common cause is that alarm archiving is not enabled, or the archive path is missing or unwritable. Confirm Alarm Logging → Settings → Archives is enabled, that the configured storage folder exists on the runtime station, and that the WinCC runtime service has write permission. On classic WinCC, also confirm the SQL Server service is running and the CC_AlarmsDB database is online.

What is the recommended segment size for a high-volume plant?

For plants generating more than 5,000 alarms per day, set the segment size to 50,000 messages and the segment count to 365 (one year of daily segments). This balances query performance against the overhead of segment rotation. Add a non-clustered index on the DateTime and ClassName columns of the AlgView view for further improvement.

How do I display alarms from a specific day such as "Monday last week" with one click?

Pre-compute the start and end timestamps in a STEP 7 function block (using DTL arithmetic on the S7-1500, or FC conventions on the S7-300/400) and write them to internal String tags Date_From and Date_To. Bind a button to a VBScript that reads the tags and calls the Alarm Control filter method. The operator selects a "Last Monday" preset from a dropdown, the tags update, and the button refreshes the Alarm Control view in one click.

Back to blog