Implementing EventState and Group Display Relevance on Custom PCS 7 Blocks with ALARM_8P

Implementing EventState and Group Display Relevance on Custom PCS 7 Blocks with ALARM_8P

In SIMATIC PCS 7, standard system block SFB35 (ALARM_8P) transmits alarm messages to the WinCC server but does not generate the local bitmask required for WinCC Group Displays (Sammelanzeige). To make a custom block relevant for group displays and picture hierarchy alarm bubbling, the SCL block must declare an output parameter named 'EventState' of data type DWORD with system attribute 'S7_m_c := 'true''. The block's internal logic must calculate active alarm bits (Bit 0 for Alarm High, Bit 1 for Warning High, Bit 5 for Alarm Low, Bit 6 for CSF) and pack them into 'EventState', which WinCC automatically binds to the Group Display object.

Table of Contents

Executive Summary

When developing proprietary technological function blocks in SCL for SIMATIC PCS 7 (such as custom analyzers, packaging skids, or third-party device drivers), engineers integrate system function block SFB35 (ALARM_8P) to generate process alarms. While alarms successfully appear in the WinCC Alarm Logging sequence list, engineers frequently find that the block icon's group display (Sammelanzeige) and the top-level WinCC picture hierarchy buttons remain completely dark when an alarm occurs.

This disconnection occurs because WinCC Group Displays do not poll the Alarm Logging SQL database; instead, they monitor a live PLC-level process tag named EventState. SFB35 has no EventState output pin and does not calculate visual group states. To achieve full integration with PCS 7 Basic Process Control, the custom block must construct the standard 32-bit EventState mask internally. This guide details the bit allocation standards for EventState and provides the exact SCL code implementation.

Architecture and Fundamental Mechanics

The PCS 7 Basic Process Control alarm visualization architecture relies on two independent communication channels:

  1. Event-Driven Messaging Channel (SFB35 ALARM_8P):
    - When an alarm condition occurs (SIG_1 to SIG_8), SFB35 issues an asynchronous S7 communication event to WinCC Alarm Logging.
    - WinCC writes the event to the SQL message database and updates the alarm banner text. This channel is purely event-driven and does not drive real-time graphic animations.

  2. Real-Time Cyclic Status Channel (EventState):
    - WinCC block icons feature a 'Group Display' (Sammelanzeige) smart object displaying 5 standard visual states: Alarm (red), Warning (yellow), Tolerance (blue), Fault/CSF (black/yellow), and Operator Prompt/Maintenance (white).
    - The Group Display binds directly to <BlockTag>.EventState via WinCC cyclic tag polling.
    - Picture Hierarchy Bubbling: The PCS 7 Picture Tree Manager monitors EventState across all block icons in a graphic picture. If any block has active alarm bits in EventState, the picture tree coordinates alarm bubbling, turning the plant area navigation button red.

  3. Standard EventState Bit Structure (PCS 7 APL / Basis Standard):
    - Bit 0: Alarm High (AH - 16#00000001)
    - Bit 1: Warning High (WH - 16#00000002)
    - Bit 2: Tolerance High (TH - 16#00000004)
    - Bit 3: Tolerance Low (TL - 16#00000008)
    - Bit 4: Warning Low (WL - 16#00000010)
    - Bit 5: Alarm Low (AL - 16#00000020)
    - Bit 6: Control System Fault (CSF - 16#00000040)
    - Bit 7: Maintenance / Process Prompt (16#00000080)
    - Bits 16 to 23: Acknowledgment status bits (mirrored from WinCC back to the AS to track whether alarms are acknowledged).

Step-by-Step Implementation Procedure

Follow these steps to implement EventState and group display relevance in a custom SCL block for PCS 7:

  1. Declare the EventState Output Parameter in SCL:
    - Open your custom block source in the SCL Editor.
    - In the VAR_OUTPUT section, declare the EventState variable with mandatory PCS 7 system attributes:
    scl VAR_OUTPUT EventState { S7_m_c := 'true'; S7_xm_c := 'Value,true;'; S7_visible := 'false' } : DWORD := 16#00000000; // Other block outputs END_VAR
    - Note: The attribute { S7_m_c := 'true' } is mandatory; it informs the AS-OS compiler to create the tag in WinCC Tag Management.

  2. Declare Alarm Calculation Variables in SCL:
    - In VAR_TEMP or internal VAR, declare boolean flags for your active conditions:
    scl VAR_TEMP b_Alarm_High : BOOL; b_Warning_High : BOOL; b_Alarm_Low : BOOL; b_CSF : BOOL; dw_TempState : DWORD; END_VAR

  3. Calculate Active Alarm Conditions in Logic:
    - In the code body, evaluate process values and faults against limit parameters:
    scl b_Alarm_High := (PV >= HighHigh_Limit) AND NOT MsgLock; b_Warning_High := (PV >= High_Limit) AND NOT MsgLock AND NOT b_Alarm_High; b_Alarm_Low := (PV <= LowLow_Limit) AND NOT MsgLock; b_CSF := ExtFault OR ModErr;

  4. Map Bits into the EventState Double Word:
    - Construct the bitmask by packing the booleans into the lower byte of EventState:
    ```scl
    dw_TempState := 16#00000000;
    IF b_Alarm_High THEN dw_TempState := dw_TempState OR 16#00000001; END_IF;
    IF b_Warning_High THEN dw_TempState := dw_TempState OR 16#00000002; END_IF;
    IF b_Alarm_Low THEN dw_TempState := dw_TempState OR 16#00000020; END_IF;
    IF b_CSF THEN dw_TempState := dw_TempState OR 16#00000040; END_IF;

    // Preserve upper acknowledgment bytes written by WinCC
    EventState := (EventState AND 16#FFFF0000) OR (dw_TempState AND 16#0000FFFF);
    ```

  5. Connect Signals to SFB35 (ALARM_8P):
    - Ensure your SFB35 instance call evaluates the identical booleans:
    scl inst_Alarm8P( EN_R := TRUE, ID := 16#EEEE, EV_ID:= MsgEvId, SIG_1:= b_Alarm_High, SIG_2:= b_Warning_High, SIG_3:= b_Alarm_Low, SIG_4:= b_CSF );

  6. Compile SCL, Update Block Types, and Compile OS:
    - Compile the SCL source into the target FB.
    - In SIMATIC Manager, execute 'Options > Charts > Update Block Types...'.
    - Run an AS-OS compile ('Entire OS' with 'Tags and messages'). WinCC automatically instantiates the .EventState tag.
    - On the WinCC block icon, ensure the Group Display property CollectValue is interconnected to <Tag>.EventState.

Verification

  1. In CFC Test Mode, force an alarm condition (e.g., set PV > HighHigh_Limit): confirm that b_Alarm_High goes TRUE and EventState displays 16#00000001.
  2. In WinCC OS Runtime, observe the custom block icon: confirm that the Group Display immediately displays a flashing red 'A' (Alarm).
  3. Check the WinCC picture hierarchy navigation bar: verify that the plant area button hosting this graphic turns red with the active alarm indicator.
  4. Acknowledge the alarm on the WinCC faceplate: confirm that the Group Display transitions from flashing red to steady red.
  5. Clear the alarm in CFC: confirm that EventState clears to 16#00000000 and the Group Display indicator goes dark.

Limitations and Operational Precautions

Ensure that the upper word (16#FFFF0000) of EventState is not overwritten with zeros in SCL; WinCC uses the upper word to communicate acknowledgment status. The SCL code must preserve the upper word using bitwise masking (EventState := (EventState AND 16#FFFF0000) OR dw_TempState). Always verify SCL compiler options and PCS 7 engineering licenses through an authorized Siemens distributor or the Siemens Industry Mall.

Engineer FAQ

Why does SFB35 ALARM_8P not update the Group Display automatically?

SFB35 is an asynchronous messaging protocol block that sends telegrams to Alarm Logging. WinCC Group Displays require a separate, cyclically polled process tag (EventState) to animate graphical symbols in real time.

What attribute must be placed on EventState in SCL?

The system attribute { S7_m_c := 'true' } must be declared on the EventState output so the AS-OS compiler exports the tag to WinCC.

What bit in EventState corresponds to Control System Fault (CSF)?

Bit 6 (16#00000040) represents Control System Fault / external hardware error.

Why do WinCC navigation buttons turn red when an alarm occurs?

The WinCC Picture Tree Manager evaluates the EventState of all block icons placed in a picture and rolls up (bubbles) the highest priority alarm state to the overview buttons.

Do custom blocks with EventState consume extra WinCC licenses?

No. The block consumes standard AS RT Process Objects and OS RT Process Objects based on its technological instance, not by having an EventState tag.

Technical References

Related Articles

Related Tags

  • EventState
  • Sammelanzeige
  • Group Display
  • ALARM_8P
  • Custom Block
  • PCS 7 V9.1
20 respuestas