Implementing Multiple Alarm_8P Instances in Custom SCL Blocks and WinCC EventState Handling
When creating a custom S7-400 Function Block (FB) in SCL containing two instances of ALARM_8P (FB43 / SFB35), each instance must declare its own dedicated message ID input parameter with system attributes (MSG_EVID1 and MSG_EVID2) and distinct status outputs (MsgErr, MsgStat, MsgAckn). During OS Compilation, SIMATIC PCS 7 automatically merges the alarm states of all internal ALARM_8P instances into a single 32-bit .EventState tag in WinCC Tag Management. This enables standard APL block icons and faceplates to represent the combined alarm status (active, acknowledged, or suppressed) across all 16 alarm signals seamlessly.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
Process engineers developing custom equipment control blocks in Structured Control Language (SCL) for SIMATIC PCS 7 often require more than eight discrete alarm signals per block. Because a single instance of ALARM_8P (SFB35) supports exactly eight binary alarm signals (SIG_1 through SIG_8), blocks requiring 12, 16, or 24 alarms must instantiate multiple ALARM_8P blocks within their static variable area. Engineers frequently question whether WinCC OS compilation can handle multiple alarm instances within a single block, and how supervisory visualization handles alarm state aggregation. SIMATIC PCS 7 natively accommodates multiple ALARM_8P instances, automatically synthesizing all child alarm states into a unified .EventState DWORD in WinCC.
Architecture and Fundamental Mechanics
The architecture of multi-instance alarm handling bridges S7-400 controller firmware and WinCC Alarm Logging:
1. SCL Multi-Instance Alarming Structure
Inside the custom Function Block:
- Message ID Inputs: Each ALARM_8P requires a distinct message identification DWORD tagged with specific S7 attributes:
scl
MSG_EVID1 {S7_a_type := 'alarm_8p'; S7_server := 'alarm_archiv'; S7_link := 'false'; S7_param := 'false'; S7_visible := 'false'} : DWORD := 0;
MSG_EVID2 {S7_a_type := 'alarm_8p'; S7_server := 'alarm_archiv'; S7_link := 'false'; S7_param := 'false'; S7_visible := 'false'} : DWORD := 0;
- Static Instance Allocation: In the VAR (static) declaration section, declare two distinct instances: ALARM1 : ALARM_8P; and ALARM2 : ALARM_8P;.
- Interface Outputs: Provide individual diagnostic outputs for each instance: MsgErr1, MsgStat1, MsgAckn1 for instance 1, and MsgErr2, MsgStat2, MsgAckn2 for instance 2.
2. WinCC .EventState Synthesis Mechanics
During OS Compilation, the WinCC compiler inspects the block's compiled SDBs (System Data Blocks):
- The compiler detects both MSG_EVID1 and MSG_EVID2, registering 16 discrete alarm rows in the WinCC Alarm Logging database.
- In WinCC Tag Management, the compiler creates one single structure tag for the block containing a single .EventState tag (DWORD).
- The WinCC alarm server continuously monitors active alarms associated with both message IDs. If any of the 16 signals enters an unacknowledged alarm state, the corresponding bit in .EventState is set.
- This bit-mask structure drives the standard PCS 7 block icon alarm banner (blinking red, steady red, yellow, etc.) without requiring custom graphics scripts.
Step-by-Step Implementation Procedure
To build and configure a custom SCL block with two ALARM_8P instances:
Step 1: Code the Multi-Alarm SCL Block
- Open the SCL Editor in SIMATIC Manager.
- Define the block header, inputs, and static variables:
scl FUNCTION_BLOCK FB1500 TITLE = 'Custom Dual Alarm Block' {S7_m_c := 'true'; S7_blockview := 'big'} VAR_INPUT // Alarm Message IDs MSG_EVID1 {S7_a_type:='alarm_8p'; S7_server:='alarm_archiv'; S7_link:='false'; S7_param:='false'; S7_visible:='false'} : DWORD := 0; MSG_EVID2 {S7_a_type:='alarm_8p'; S7_server:='alarm_archiv'; S7_link:='false'; S7_param:='false'; S7_visible:='false'} : DWORD := 0; MsgLock {S7_m_c := 'true'} : BOOL := FALSE; END_VAR VAR_OUTPUT MsgErr1, MsgErr2 : BOOL; MsgStat1, MsgStat2 : WORD; MsgAckn1, MsgAckn2 : WORD; END_VAR VAR ALARM1 : ALARM_8P; ALARM2 : ALARM_8P; END_VAR - In the program execution section, call both instances:
scl ALARM1(EN_R := TRUE, ID := 16#EEEE, EV_ID := MSG_EVID1, DISR := MsgLock, SIG_1 := Fault1, SIG_2 := Fault2, SIG_3 := Fault3, SIG_4 := Fault4, SIG_5 := Fault5, SIG_6 := Fault6, SIG_7 := Fault7, SIG_8 := Fault8, ERROR => MsgErr1, STATUS => MsgStat1, ACK_STATE => MsgAckn1); ALARM2(EN_R := TRUE, ID := 16#EEEE, EV_ID := MSG_EVID2, DISR := MsgLock, SIG_1 := Fault9, SIG_2 := Fault10, SIG_3 := Fault11, SIG_4 := Fault12, SIG_5 := Fault13, SIG_6 := Fault14, SIG_7 := Fault15, SIG_8 := Fault16, ERROR => MsgErr2, STATUS => MsgStat2, ACK_STATE => MsgAckn2); - Compile the SCL block to generate FB1500.
Step 2: Configure Message Texts in SIMATIC Manager
- Instantiate FB1500 inside a CFC chart.
- Right-click the block in CFC and select Special Properties -> Message....
- The dialog displays two message groups corresponding to
MSG_EVID1andMSG_EVID2(16 total message rows). - Configure message classes (Alarm High, Warning, Tolerance) and event texts for all 16 signals.
Step 3: Compile and Test OS
- Compile the CFC chart and execute an OS Compilation.
- Open WinCC Explorer and verify that the block instance contains 16 alarms in Alarm Logging and one
.EventStatetag in Tag Management.
Verification
To confirm alarm generation and .EventState aggregation:
-
Primary Instance Alarm Test:
- In CFC online mode, triggerFault1(Signal 1 ofALARM1).
- Verify in WinCC Runtime that an alarm appears in the alarm list.
- Verify that the block icon displays a flashing red alarm badge. -
Secondary Instance Alarm Test:
- ClearFault1and triggerFault9(Signal 1 ofALARM2).
- Verify that the second alarm appears in the alarm list with its distinct text.
- Verify that the same block icon displays the alarm badge, confirming that.EventStatesuccessfully aggregated both instances. -
Simultaneous Acknowledgment Test:
- Acknowledge the alarm on the WinCC faceplate or alarm banner; verify that the acknowledgment propagates back to the AS.
Limitations and Operational Precautions
Operational limitations and precautions:
- CPU Communication Resource Limits: Each
ALARM_8Pinstance consumes an internal S7 communication job resource. S7-400 CPUs have hard limits on maximum concurrent alarm jobs (typically 300 to 1200 depending on CPU model). Avoid overusing multi-alarm blocks excessively. - Unique EV_ID Assignment: Never hardcode literal integers for
MSG_EVID1orMSG_EVID2. The attributeS7_server := 'alarm_archiv'instructs the ES to assign globally unique message IDs during compilation. - Execution OB Scheduling: Call
ALARM_8Pwithin cyclic interrupt OBs (e.g., OB35); calling alarms inside OB1 can cause burst communication overloads. - Commercial Disclaimer: Verify all software libraries, engineering licenses, and system packages with an authorized Siemens distributor or the Siemens Industry Mall.
Engineer FAQ
Can I use more than one ALARM_8P instance inside a single custom FB?
Yes. You can instantiate two, three, or more ALARM_8P instances within a custom Function Block to support 16, 24, or more alarm signals.
How does WinCC represent alarms from multiple ALARM_8P instances?
WinCC automatically aggregates all alarms into a single .EventState DWORD tag for that block instance, allowing a single block icon to display combined alarm states.
Why must each ALARM_8P have its own MSG_EVID parameter?
Each ALARM_8P requires a distinct message identification number (EV_ID). The ES assigns unique IDs to each MSG_EVID variable during CFC compilation.
What is the maximum number of signals one ALARM_8P block can handle?
A single ALARM_8P instance handles exactly eight binary alarm signals (SIG_1 to SIG_8).
What does the EventState tag contain in WinCC?
The .EventState tag is a 32-bit bitmask encoding whether alarms, warnings, or tolerances are active, unacknowledged, or suppressed.
Technical References
- [SIMATIC System Software for S7-300/400 System and Standard Functions Manual: SFB35 ALARM_8P
- SIMATIC PCS 7 Programming Instructions for Blocks (Style Guide)
- SIMATIC Process Control System PCS 7 Released Modules and Licenses
Related Articles
- Activating Disabled APL_ANALOG_OP_DISPLAY Faceplate Elements in SIMATIC PCS 7
- Implementing Multi-State Operating Modes Using APL Faceplate Buttons in SIMATIC PCS 7
- Avoiding Infinite WHILE Loops and Implementing Periodic Cycle Timers in PCS 7 SCL Blocks
Related Tags
- Alarm_8P
- SCL Programming
- EventState
- WinCC Alarm Logging
- Custom Blocks