Overview
SIMATIC WinCC V7.0 SP3 exposes the WinCC Alarm Control Classic as the OCX-based viewer for the Alarm Logging runtime database. The control is a live window onto the configured message buffer or alarm archive; it is not a paginated or "Top-N" widget. When you place a WinCC Alarm Control Classic on a process picture (.pdl) and configure it to draw twenty message lines, the control will render twenty rows — but those rows reflect the entire filter set defined by the Selection property, not a ranking of the "top twenty" messages by occurrence. The user-reported symptom (more than 20 rows showing "based on frequency") is therefore a consequence of selecting the alarm view with an unbounded filter and then drawing as many rows as fit inside the control rectangle, not a violation of any internal ranking rule.
This article documents four engineering methods that, in combination, yield a stable 20-message view in WinCC V7.0 SP3:
- Selection-string filtering to bound the source message set.
- Control geometry sizing to fix the rendered row count.
- Hit List mode to rank the bounded set by frequency.
- VBS scripting for dynamic Top-N behavior at runtime.
All paths assume a licensed WinCC Runtime with Alarm Logging enabled, project-side access via the WinCC Explorer, and the Graphic Designer used for picture editing. Refer to the official Siemens Industry Online Support portal for the WinCC V7.0 Information System (F1 help inside WinCC Explorer) and the SIMATIC HMI WinCC V7.0 - Configuration Manual for canonical field definitions.
Prerequisites
- SIMATIC WinCC V7.0 SP3 installed on the engineering station and the runtime station.
- Valid WinCC Runtime license plus the Alarm Logging license. For systems with 9000 configured messages, the AS messages >= 8K powerpack must be installed (license key).
- WinCC project opened in the WinCC Explorer with at least one process picture (.pdl) in the active project folder.
- Graphics Designer launched, with the target picture open in edit mode.
- Configured message classes and message types (Error, Warning, System, etc.) and at least one configured alarm source (PLC, internal tag, or user-generated C-script alarm).
- Local administrator privileges on both the engineering and runtime stations to start WinCC Runtime and to register OCX controls if needed.
How the WinCC Alarm Control Classic Renders Messages
The Alarm Control Classic is bound at runtime to a WinCC Alarm view object exposed by Alarm Logging. The view contains a SQL-like data set over the configured message buffer (and optionally the alarm archive, when archive queries are enabled in the selection). The control reads the view rows in the configured SortOrder, applies the Selection filter, then draws the rows into the control rectangle using the configured row height.
The visible row count is therefore:
visible_rows = floor(control_height / row_height) - header_rows
where control_height is the vertical extent of the OCX in pixels, row_height is the configured message-line height (typically 16 to 24 px depending on font), and header_rows is the number of header / status rows drawn above the message body (commonly 1 to 2). If the filter returns more rows than fit, the control shows a vertical scroll bar; it does not clip the data set.
Why There Is No Built-In "Top 20" Property
WinCC Alarm Control Classic exposes a fixed set of COM properties. The properties relevant to "limiting" are documented in the WinCC Information System under Alarm Control > Properties > Display > Selection and Alarm Control > Properties > Display > Hit List.
| Property | Effect on the visible set | Suitable for "Top 20 by count"? |
|---|---|---|
| Selection | SQL-like WHERE clause over message fields | Yes — bounds the source set |
| SortOrder | ASC / DESC sort over selected field | Yes — orders the source set |
| HitList | Switches view from message buffer to the frequency-ranked hit list | Yes — closest native facility |
| TimeBase / TimeRange | Restricts the query to a time window | Yes — bounds by time |
| WindowHeight / RowHeight | Geometry of the rendered control | Indirect — fixes displayed count, not the data set |
| MaxRows (alarm archive only) | Limits rows returned by the archive query | Yes, archive-side only |
The property Selection is therefore the only mechanism that lets you bound the data set; the property HitList is the only mechanism that ranks by frequency. There is no single property named "Top20" or "RowLimit" in the OCX type library.
Method 1 — Filter the Source Set with the Selection String
The Selection string is the recommended first step. It is entered in the Alarm Control Classic's property dialog under Properties > Display > Selection. The string uses a constrained SQL-WHERE dialect over WinCC message fields.
Selection string syntax (WinCC 7.0 SP3)
SELECT * FROM <view> WHERE <expression> ORDER BY <field> ASC|DESC
The default view is implicit when the control is bound to a single alarm source. Supported field names (case-insensitive):
| Field | Type | Description |
|---|---|---|
| MSGNR | Integer | Configured message number |
| CLASS | Integer | Message class ID |
| TYPE | Integer | Message type ID (alarm, warning, fault) |
| STATE | Integer | Bitmask of message state (Came In, Went Out, Ack, etc.) |
| PRIORITY | Integer | Message priority |
| MSGTIME | DateTime | Time the message was raised |
| TEXT1 .. TEXT9 | String | Configured user text blocks |
| AGNR | Integer | AS / source number |
| CPUNR | Integer | CPU / channel number |
Example selection strings
-- Only show active errors from the last 24 hours
CLASS IN (1) AND TYPE = 1 AND STATE = 1
-- Restrict to a specific message number range
MSGNR BETWEEN 1000 AND 2000
-- Restrict to messages raised today (relative to WinCC server clock)
MSGTIME >= '2024-01-15 00:00:00.000' AND MSGTIME < '2024-01-16 00:00:00.000'
-- Combine class and text filter
CLASS IN (1,2) AND TEXT1 LIKE '%Pump%'
Use the Test Selection button (where available in SP3) to validate the string against the configured message classes before activating Runtime. A malformed selection string will cause the control to render no rows, not an error dialog.
Method 2 — Limit Visible Rows via Control Geometry
After bounding the data set with the selection string, the rendered row count is fixed by the control rectangle. To draw exactly twenty message lines:
- Open the process picture in Graphics Designer.
- Select the Alarm Control Classic object.
- Note the configured row height under Properties > Display > RowHeight (default ~18 px in SP3 with the standard font).
- Resize the control to:
height = (row_height * 20) + header_height. For 18 px rows and a 20 px header, set height to18 * 20 + 20 = 380px. - Disable vertical scroll under Properties > Display > ShowScrollbar = FALSE to make the bounding effect explicit.
Method 3 — Hit List (Frequency-Based Top-N)
The Alarm Control Classic supports a Hit List view that ranks messages by occurrence frequency within a configurable time window. This is the native facility closest to a "Top 20 by frequency" feature.
Configuring the Hit List
- In WinCC Explorer, open Alarm Logging.
- Select Message Classes in the navigation tree.
- For each class you want ranked (typically Error and System, with acknowledgment), open the properties dialog and enable Hit List.
- Set Hit List - Number of Entries to 20 (or 20 per class, depending on the SP3 build you are running).
- Confirm with OK. The Hit List data is now maintained by Alarm Logging as messages come in and go out.
Displaying the Hit List in the Alarm Control
- In Graphics Designer, select the Alarm Control Classic.
- Open Properties > Display > HitList.
- Set HitList = TRUE.
- Configure the message blocks (Properties > Display > MessageBlocks) to include Hit Count and Hit Last Came In alongside the standard text.
- Apply geometry sizing per Method 2 so that exactly twenty hit-list rows render.
The Hit List is calculated by Alarm Logging based on the Hit List - Evaluation Time setting. For an unbounded rolling count, set the evaluation time to 0 (no expiration) or to a long interval (e.g. 30 days) for a more stable ranking.
Method 4 — VBS Script for Dynamic Top-N at Runtime
For projects that require a true runtime-configurable Top-N (e.g. operator-entered "show top 20" prompt), use the WinCC scripting interface to manipulate the Alarm Control properties from a button-click handler.
Example: button-click VBS handler
' Place on a button named btnTop20
Sub btnTop20_Click(ByVal Item)
Dim objAlarm
Set objAlarm = ScreenItems("AlarmControlClassic1")
' Filter to active errors raised today, ordered by priority desc
objAlarm.Selection = "CLASS IN (1) AND TYPE = 1 AND STATE = 1 " & _
"AND MSGTIME >= '" & Date & " 00:00:00'"
' Order by occurrence time descending (most recent first)
objAlarm.SortOrder = "MSGTIME DESC"
' Force a refresh
objAlarm.Refresh
Set objAlarm = Nothing
End Sub
Example: dynamic row count via geometry
Sub btnResize_Click(ByVal Item)
Dim nRows
nRows = CInt(InputBox("Enter number of rows to display:", "Row Limit", "20"))
If nRows < 1 Or nRows > 200 Then
MsgBox "Row count must be between 1 and 200.", vbExclamation
Exit Sub
End If
Dim objAlarm
Set objAlarm = ScreenItems("AlarmControlClassic1")
' 18 px row height, 20 px header
objAlarm.Height = 18 * nRows + 20
objAlarm.ShowScrollbar = (False)
objAlarm.Refresh
Set objAlarm = Nothing
End Sub
Example: switching to Hit List mode at runtime
Sub btnHitList_Click(ByVal Item)
Dim objAlarm
Set objAlarm = ScreenItems("AlarmControlClassic1")
objAlarm.HitList = True
objAlarm.Selection = "CLASS IN (1,2)"
objAlarm.SortOrder = "HITCOUNT DESC"
objAlarm.Refresh
Set objAlarm = Nothing
End Sub
All three snippets assume a single Alarm Control Classic named AlarmControlClassic1 on the active process picture. Adjust the object name to match your project's naming convention.
Recommended Configuration for the User's 9000-Message Project
For a project with ~9000 configured messages and a requirement to display only the most frequent twenty, the recommended combination is:
- Enable Hit List for the Error and System, with acknowledgment message classes, set entry count to 20.
- Configure the Alarm Control Classic with HitList = TRUE.
- Use a Selection string restricted to the relevant class set, for example
CLASS IN (1,2). - Set the control geometry to draw twenty rows (380 px tall with default row height).
- Include the message blocks Hit Count, Hit Last Came In, Message Text, and Number.
Verification Procedure
- Save the process picture in Graphics Designer.
- Open WinCC Explorer and start Runtime (or use Activate for a single station).
- Open the picture containing the Alarm Control Classic.
- Confirm the control draws exactly twenty message rows with no scroll bar.
- From the WinCC Alarm Simulator (or by triggering real PLC alarms), generate at least thirty different message numbers.
- Wait for the configured Hit List evaluation cycle to elapse (default 60 s in SP3).
- Verify the top twenty rows correspond to the twenty highest Hit Count values, in descending order.
- Open WinCC Channel Diagnosis and confirm zero alarm archive query errors under Diagnostics > Alarm Logging.
- Cycle Runtime and re-verify; the Hit List should persist if archive backup is enabled.
Troubleshooting Matrix
| Symptom | Likely cause | Resolution |
|---|---|---|
| Control renders more than 20 rows | Control height is taller than 20 * row_height + header; scroll bar enabled | Reduce height to 380 px (or 18 * 20 + 20 px) and disable ShowScrollbar |
| Hit List column is empty | Hit List not enabled on the message class | Open Alarm Logging editor, edit message class properties, enable Hit List |
| Selection string accepted but no rows render | Field name typo or wrong class ID | Validate against message class ID list; test in a minimal picture first |
| Hit List does not update | Evaluation interval too long or Hit List not activated | Set evaluation time to a short interval (e.g. 60 s) and verify alarm events |
| VBS script error "Object doesn't support this property" | Property name varies between SP3 builds | Reference the type library WinCCAlarmControlClassLib.AlarmControl in the script editor |
| Performance drop with 9000 messages | Hit List calculation CPU overhead | Increase Hit List evaluation interval; archive completed alarms hourly |
| OCX fails to register after Windows update | WinCC V7.0 SP3 OCX registry entries overwritten | Re-run WinCC setup in repair mode; restart WinCC Service Mode |
| Hit List count resets after Runtime restart | Archive persistence not configured for hit list table | Enable archive backup for Hit List in Alarm Logging > Archive Configuration |
Performance and Sizing Notes
Hit List evaluation is performed by Alarm Logging on a worker thread. With 9000 configured messages, the per-cycle cost scales with the number of active (Came In, not Went Out) messages, not the configured total. For typical industrial loads (50 to 500 simultaneously active messages), the default 60 s evaluation interval is acceptable. For higher loads (more than 2000 simultaneously active messages), increase the evaluation interval to 300 s and consider running Alarm Logging on a dedicated WinCC Server with a multi-core CPU and 8 GB or more RAM.
Archive segmentation should be enabled for Hit List tables in long-running systems. Configure archive backup in Alarm Logging > Archive Configuration > Hit List > Backup Settings with a daily cycle to prevent the Hit List table from growing unbounded.
Differences Between WinCC V7.0 SP3 and Later Versions
The behavior described above is consistent across WinCC V7.0 SP3 through V7.5. V7.4 and later ship a non-Classic Alarm Control with the following additions:
- Native TopN property on the alarm control's filter expression language (no Hit List required for simple frequency ranking).
- Inline aggregation functions
COUNT(), RANK(), TOP()in the Selection string. - Configurable row auto-resize on the control's geometry.
If a project is planned to be migrated to V7.4 or later, the selection-string approach documented here remains compatible.
Field-Commissioning Checklist
- Document the configured message classes and types in a project-side reference table.
- Validate the Selection string in a test picture before deploying to operator stations.
- Configure the Hit List evaluation interval per the plant's alarm rate.
- Size the Alarm Control Classic geometry based on the target row count and the operator station's resolution.
- Add the Alarm Control Classic to the WinCC Service Mode startup sequence so it is available immediately on Runtime restart.
- Capture a baseline screenshot of the twenty most frequent alarms before site acceptance, and store it in the project documentation.
FAQ
Does WinCC Alarm Control Classic have a built-in "Top 20" property?
No. The OCX exposes only the Selection, SortOrder, HitList, TimeBase, and geometry properties. To render twenty rows you must combine a Selection string (to bound the source set) with control geometry (to draw exactly twenty rows) or switch to Hit List mode (to rank by frequency).
How do I configure the Hit List in WinCC 7.0 SP3?
Open Alarm Logging, select the target message class, enable Hit List in the class properties, and set Hit List - Number of Entries to 20. Then set the Alarm Control Classic's HitList property to TRUE and include the Hit Count block in the message blocks configuration.
What is the selection string syntax in WinCC?
The selection string uses a constrained SQL-WHERE dialect over WinCC message fields. Example: CLASS IN (1,2) AND TYPE = 1 AND STATE = 1 AND MSGTIME >= '2024-01-15 00:00:00'. Supported fields include MSGNR, CLASS, TYPE, STATE, PRIORITY, MSGTIME, TEXT1..TEXT9, AGNR, and CPUNR.
Can I dynamically change the visible alarm count at runtime?
Yes. Use VBS scripts bound to button-click events to modify the Selection string, the control Height, the SortOrder, and the HitList property. Call objAlarm.Refresh after each change to apply the new configuration immediately.
How does WinCC handle 9000+ configured alarms at runtime?
Alarm Logging can register 9000 messages with the AS messages >= 8K license powerpack. Runtime performance scales with the number of simultaneously active messages, not the configured total. Use archive segmentation, configure the Hit List evaluation interval appropriately, and split very high-volume alarm sources across multiple Alarm Control Classic instances.