Resolving EventState Bitmask Corruption and Group Display Inconsistencies in SIMATIC PCS 7
In SIMATIC PCS 7 engineering environments, custom technological blocks exhibiting corrupted, massive EventState tag values (such as 132130342), failing to display alarms on block icons, or disabling message lock/unlock functions stem from declared but unused message event ID parameters (MsgEvId) in SCL. When an engineer declares MsgEvId variables as 'spares for future use' without instantiating an active ALARM_8P call in the AS code, the OS compiler reserves uninitialized message memory addresses. Removing unused MsgEvId declarations and recompiling both AS and OS clears the memory corruption and restores clean Group Display operation.
Table of Contents
- The Structure and Function of the .EventState Tag
- The 'Spare Variable Trap': Why Unused MsgEvId Declarations Corrupt Memory
- Step-by-Step Remediation Workflow in SCL and SIMATIC Manager
- EventState Bitmask Allocation and Diagnostic Table
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
The Structure and Function of the .EventState Tag
In SIMATIC PCS 7, the .EventState tag is a read-only 32-bit DWORD generated in WinCC Tag Management for every AS block declared with { S7_alarm_ui := '1' }. The .EventState tag encodes the real-time collective alarm status of the block:
- Bits 0–15: Active alarm counts categorized by message class (Alarm High, Warning High, Fault).
- Bits 16–23: Unacknowledged message states (flashing triggers).
- Bits 24–31: Maintenance and message suppression states (e.g. Message Lock active).
WinCC Group Display objects on block icons and area buttons evaluate this bitmask dynamically to render alarm letters and colors.
The 'Spare Variable Trap': Why Unused MsgEvId Declarations Corrupt Memory
When an engineer develops a custom SCL block, they frequently declare multiple message event variables:
VAR_INPUT
MsgEvId1 : DWORD := 16#FFFFFFFF; { S7_a_type := 'alarm_8p'; ... }
MsgEvId2 : DWORD := 16#FFFFFFFF; { S7_a_type := 'alarm_8p'; ... } // Declared as spare!
END_VAR
If the block only executes ALARM_8P for MsgEvId1 while leaving MsgEvId2 uncalled in the executable logic:
1. Uninitialized Message Memory Allocation: During AS-OS compilation, the compiler detects MsgEvId2 and allocates message space in the WinCC Alarm Logging database.
2. Missing Initialization Handshake: Because the controller never executes ALARM_8P for MsgEvId2, the controller communication driver never sends an initial state telegram for this message slot.
3. Random Garbage Data in .EventState: The uninitialized memory space retains indeterminate memory bytes, resulting in nonsensical numerical values (e.g. 132130342).
4. Functional Lockout: WinCC interprets these invalid bits as an unrecoverable alarm fault, disabling alarm rendering and locking faceplate operator buttons ('Lock Messages' button grayed out).
Step-by-Step Remediation Workflow in SCL and SIMATIC Manager
To eliminate the corruption and restore clean Group Display functionality:
- Purge Unused Message Variables in SCL:
- Open the custom SCL block source code in the Master Data Library.
- Delete all unusedMsgEvIdvariables (e.g. deleteMsgEvId2).
- Ensure every remainingMsgEvIdis strictly wired to an activeALARM_8Pblock call. - Recompile SCL Source: Compile the SCL code to generate the updated block in the library block folder.
- Update Block Types in CFC:
- In SIMATIC Manager, open the AS chart folder.
- Select Options > Block Types....
- Select the modified FB and click New Version. The system updates all instances across all charts and cleans the instance DB headers. - Compile AS and OS:
- Perform a complete compilation of the AS program (PLC > Compile > Entire Program).
- Execute Compile OS > Entire OS. - Download to AS and OS: Download changes to the controller and OS server.
EventState Bitmask Allocation and Diagnostic Table
The following table details the internal bit structure of the .EventState tag:
MsgLock = 1)132130342Note: In healthy operation, when no alarms or locks are present, .EventState evaluates to exactly 0.
Verification
Verify clean EventState evaluation in WinCC:
1. In WinCC Explorer, open Tag Management and locate the technological instance tag.
2. Select the .EventState tag in runtime; verify that its value reads 0 when no alarms are active (instead of 132130342).
3. In CFC test mode, trigger an alarm; confirm .EventState transitions to a valid decimal value (e.g. 65537 for unacknowledged alarm).
4. Verify that the Group Display on the block icon flashes red with letter 'A'.
5. Open the faceplate; confirm that the 'Lock Messages' button is active and functional.
Limitations and Operational Precautions
Essential rules for custom alarm block development:
- Never declare spare MsgEvId variables; only declare message parameters that have an active, instantiated ALARM_8P call.
- Updating block types in CFC that alter the number of MsgEvId parameters changes the instance data block structure, which may require a CPU STOP download if not engineered with offline staging.
- Ensure that the block attribute S7_alarm_ui := '1' is retained; removing it disables the Group Display entirely.
Engineer FAQ
Why did the compiler let me declare MsgEvId2 if it wasn't used?
The SCL compiler treats MsgEvId variables as standard input parameters and does not verify whether they are called in executable logic; the error manifests only at runtime during WinCC state processing.
What should I do if I need spare message capacity for future expansion?
Add the additional MsgEvId and its corresponding ALARM_8P call simultaneously when the new messages are actually engineered, rather than pre-allocating unused spares.
Why does .EventState affect the 'Lock Messages' button?
If .EventState contains corrupted high-order bits, WinCC interprets the state as an invalid lock transaction and disables the faceplate button to prevent database corruption.
Technical References
- SIMATIC Process Control System PCS 7 Programming Instructions for Blocks (A5E39222384)
- WinCC V7.4: Working with WinCC - Group Display (A5E37536063)
- SIMATIC Process Control System PCS 7 Advanced Process Library (A5E39177307)
Related Articles
- Integrating Group Displays and ALARM_8P EventState Tags in Custom PCS 7 Blocks
- Creating Custom APL-Compliant Block Icons and Faceplates for SCL Function Blocks in SIMATIC PCS 7
- Resolving Strikethrough Timestamps on Outgoing Alarms in SIMATIC PCS 7 WinCC
Related Tags
- EventState
- Group Display
- MsgEvId
- ALARM_8P
- Memory Corruption