Configuring ALARM_8P Message Texts and EventState Group Displays for Custom SCL Blocks in SIMATIC PCS 7

Configuring ALARM_8P Message Texts and EventState Group Displays for Custom SCL Blocks in SIMATIC PCS 7

In SIMATIC PCS 7, alarm message texts and message classes for custom SCL function blocks utilizing ALARM_8P (SFB35) are not configured inside the SCL source code; they are defined in the S7 block template metadata within the Blocks folder. To configure them, compile the SCL source in the Master Data Library, right-click the compiled FB in the Blocks folder, select 'Special Object Properties > Message...', and enter the message texts, message classes, and associated value tokens for SIG_1 through SIG_8. To enable WinCC block icons and group displays to reflect these alarms, ensure the block has the attribute 's7_m_c := true', compile the OS to generate the '.EventState' DWORD tag, and connect '.EventState' to the block icon's CollectValue property.

Table of Contents

Architecture of ALARM_8P and OS Message Metadata

When developing custom function blocks in Structured Control Language (SCL) for SIMATIC PCS 7, engineers frequently integrate the native system function block ALARM_8P (SFB35) to report process alarms, warnings, and operational events directly to the WinCC Operator Station.

ALARM_8P accepts up to eight discrete binary alarm signals (SIG_1 to SIG_8) and up to ten associated process values (SD_1 to SD_10). Unlike traditional PLC programming where alarm strings are entered into HMI tag databases, PCS 7 utilizes a compiled metadata model:

flowchart LR
    A["SCL Source Code: ALARM_8P Call (SIG_1..8, MSG_EVID)"] --> B["Compiled FB in S7 Program Blocks Folder"]
    B --> C["Block Metadata: Special Object Properties > Message"]
    C --> D["CFC Instance in Plant Hierarchy"]
    D --> E["WinCC OS Compilation"]
    E --> F["WinCC Alarm Logging Server + .EventState Tag"]

The executable SCL code only declares the message ID variable (MSG1_EVID : DWORD) with system attributes:

VAR_INPUT
    MSG1_EVID { S7_server := 'alarm_archiv'; S7_a_type := 'alarm_8p'; S7_visible := 'false'; S7_link := 'false'; S7_param := 'false' } : DWORD := 0;
END_VAR

The actual text description (e.g., 'Pump Bearing Temperature High'), the alarm class (e.g., 'Alarm - High'), and the acknowledgment requirements reside within the S7 block header metadata.

Configuring Message Texts and Message Classes

If an engineer writes custom SCL code and compiles the OS without configuring block metadata, WinCC receives the alarm triggers but displays blank text fields in the alarm banner.

To configure permanent message texts that propagate to all block instances:

Step 1: Open Block Message Configuration in the Master Library

  1. Compile the SCL source file in the Master Data Library (or AS S7 Program).
  2. In SIMATIC Manager, navigate to the Blocks folder.
  3. Locate the compiled Function Block (e.g., FB501).
  4. Right-click the block and select Special Object Properties > Message....

Step 2: Configure Signals, Message Classes, and Texts

In the Message Configuration dialog:
1. A table displays rows corresponding to the block's ALARM_8P signals (SIG_1 through SIG_8).
2. For each active signal, select the Message Class from the dropdown menu (e.g., Alarm - High, Warning - High, Tolerance, or Operating Message).
3. In the Event Text column, enter the descriptive alarm message (e.g., Overload Trip).
4. In the Info Text column, enter operational guidance for the operator (e.g., Check motor circuit breaker CB-101).
5. Click OK to save the metadata into the block header.

Step 3: Distribute to AS Stations and Update Instances

  1. Copy the updated FB from the Master Data Library into the target AS S7 Program's Blocks folder.
  2. In SIMATIC Manager, select Options > Update Block Types... to refresh all chart instances across the project.
  3. When inspecting the block in CFC (double-click block > click Messages...), the message texts will appear in green text, signifying that they inherit directly from the block template. (If an engineer manually edits a message on an individual CFC block instance, the text turns black, indicating an instance-specific override).

Mechanics of the .EventState Tag and Group Displays

To integrate custom block alarms into the PCS 7 visual hierarchy (block icons, group displays, and picture tree buttons), the block must generate and update the .EventState tag.

When a function block contains the attribute { S7_m_c := 'true' } and calls ALARM_8P, the OS Compiler automatically generates a 32-bit DWORD structure tag named:
$$\text{ChartName/BlockName.EventState}$$

The .EventState tag is a bit-encoded representation of the block's active alarms and warnings:
- Bit 31: Alarm - High active
- Bit 30: Alarm - Low active
- Bit 29: Warning - High active
- Bit 28: Warning - Low active
- Bit 27: Tolerance - High active
- Bit 26: Tolerance - Low active
- Bit 16: Unacknowledged alarm present

In WinCC Graphics Designer, the Group Display object (GroupDisplay) and APL block icons have an input property called CollectValue.
1. In the block icon, link CollectValue via Dynamic Tag Connection directly to <TagName>.EventState.
2. WinCC evaluates the bitmask in real time. If Bit 31 is set, the group display illuminates with the standard Alarm High color (flashing red for unacknowledged, solid red for acknowledged).
3. The WinCC Picture Tree Navigator automatically aggregates all .EventState tags across the picture hierarchy, rolling up alarm indicators to top-level plant navigation buttons.

Utilizing Associated Process Values (SD_1 to SD_10)

The ALARM_8P block provides ten parameters (SD_1 through SD_10) designated as Associated Values (Begleitwerte). These parameters pass dynamic runtime process values (temperatures, pressures, error codes) into the message text string.

Signal and Associated Value Parameter Matrix

ParameterInterface TypeSupported Data TypesEngineering FunctionSIG_1 - SIG_8VAR_INPUTBOOLBinary trigger signals (rising edge triggers alarm entry)IDVAR_INPUTWORDMessage source identifier (standard value W#16#EEEE)EV_IDVAR_INPUTDWORDUnique message identifier linked to MSG1_EVIDSD_1 - SD_10VAR_INPUTINT, DINT, REAL, WORD, BYTEDynamic process variables embedded into event text

Embedding Process Values into Message Texts

To display a dynamic value inside an alarm text, use format conversion tokens inside the Event Text field in the Message Configuration dialog:
- @1%f@: Formats parameter SD_1 as a floating-point number.
- @2%d@: Formats parameter SD_2 as a decimal integer.
- @1%3.1f@: Formats parameter SD_1 as a 3-digit float with 1 decimal place.

Example Configuration:
In SCL code:

A8P(
    EN_R  := TRUE,
    SIG_1 := Temp_High_Fault,
    ID    := W#16#EEEE,
    EV_ID := MSG1_EVID,
    SD_1  := Actual_Temp
);

In Block Message Properties for SIG_1:
- Event Text: Bearing Temperature High: @1%3.1f@ deg C
In WinCC Alarm Banner when tripped at $84.6 degrees ext{C}$:
- Displayed Message: Bearing Temperature High: 84.6 deg C

Verification

To verify that ALARM_8P message texts and EventState indicators function correctly:
1. Compile the SCL block and ensure zero errors.
2. Verify that message texts appear in green in the CFC block's Messages dialog.
3. Run an OS Compile with 'Changes only'.
4. Open WinCC Explorer > Alarm Logging. Verify that the custom block's messages appear under the message table with correct Event Texts, Message Classes, and Tag connections.
5. In WinCC Explorer > Tag Management, locate the tag group corresponding to the CFC chart and verify that <BlockName>.EventState exists.
6. Trigger an alarm condition in the AS. Verify that the WinCC Alarm banner displays the formatted event text with embedded process values, and the block icon's group display flashes in the correct alarm color.

Limitations and Operational Precautions

Observe the following engineering constraints when configuring ALARM_8P blocks:
- String Limitations in SD_x: ALARM_8P does NOT natively support passing standard STRING data types through SD_1..10. Passing textual strings requires breaking the string into an array of BYTE or WORD variables.
- EV_ID Allocation: Never manually assign constant values to MSG1_EVID in SCL code. PCS 7 automatically allocates globally unique message numbers (EV_ID) during CFC block compilation. Overwriting EV_ID with a constant causes message ID collisions.
- Compile After Message Changes: Modifying message texts in the AS block container requires an OS Compilation to transfer updated text strings to WinCC Alarm Logging.

Engineer FAQ

Why are my message texts green in CFC but turn black when I edit them?

Green text indicates that the message text is inheriting directly from the block template in the Master Data Library. If you edit the text on an individual CFC block instance, it turns black to indicate an instance-specific override that will not be overwritten by future library updates.

Can one SCL block call multiple ALARM_8P instances?

Yes. A custom block can call multiple ALARM_8P instances (e.g., A8P_1 and A8P_2) to handle more than 8 alarm conditions. Each instance requires its own unique EV_ID input (e.g., MSG1_EVID, MSG2_EVID).

Why does the block icon group display stay gray when an alarm is active?

The group display remains gray if the block icon's 'CollectValue' property is not linked to the '.EventState' tag, if the WinCC OS compile was skipped, or if 'Use of global message classes' is disabled in WinCC Project Properties.

Technical References

Related Articles

Related Tags

  • ALARM_8P
  • SCL
  • WinCC
  • EventState
  • Alarm Logging
  • SIMATIC PCS 7
  • Group Display
6 respuestas