Configuring ALARM_8P Attributes and Message Event IDs for Custom Blocks in PCS 7

Configuring ALARM_8P Attributes and Message Event IDs for Custom Blocks in PCS 7

In SIMATIC PCS 7, when implementing system function block SFB35 (ALARM_8P) in custom function blocks, the 'Messages' configuration button in block properties remains grayed out if essential system attributes are missing from the block interface. To activate the PCS 7 message configuration dialog, assign the block attribute S7_alarm_ui := 'true' to the block header, and declare an input parameter MsgEvId of type DWORD with attributes S7_server := 'alarm_archiv' and S7_a_type := 'alarm_8p'. This instructs the compiler to assign unique message numbers and open message dialogs in SIMATIC Manager.

Table of Contents

Architecture of ALARM_8P Integration in Custom PCS 7 Blocks

In SIMATIC PCS 7, process alarm generation is standardized on the system function block SFB35 (ALARM_8P). Technological function blocks (such as MotL, VlvL, or custom user FBs) encapsulate instances of ALARM_8P to transmit up to 8 discrete process signals (SIG_1 through SIG_8) and up to 10 dynamic associated values (SD_1 through SD_10) directly to WinCC Alarm Logging with millisecond controller timestamps.

When an engineer creates a custom FB, simply calling SFB35 inside the code is insufficient for the PCS 7 engineering environment to recognize it as a message-capable block. The STEP 7 / PCS 7 message compiler relies on metadata attributes (pragmas) declared in the block header and parameter interface to assign message ID ranges and enable the graphical message editor.

Mandatory S7 Attributes for Message Number Assignment

The following table details the mandatory attributes required to enable the PCS 7 message configuration dialog:

Attribute NameAssignment TargetAssigned ValueCompiler Function and SignificanceS7_alarm_uiBlock Header (FUNCTION_BLOCK)'true'Instructs SIMATIC Manager to display the PCS 7 message dialog instead of the classic WinCC dialog.S7_serverInput Parameter (MsgEvId / MsgEvId1)'alarm_archiv'Directs the message compiler to allocate a unique message ID from the project archive during OS compilation.S7_a_typeInput Parameter (MsgEvId / MsgEvId1)'alarm_8p'Identifies the messaging protocol type as ALARM_8P (SFB35).S7_visibleInput Parameter (MsgEvId / MsgEvId1)'false'Hides the message ID parameter in CFC to prevent accidental manual alteration.S7_linkInput Parameter (MsgEvId / MsgEvId1)'false'Prevents accidental signal interconnection to the message ID parameter in CFC.

Table 1: System attributes required for ALARM_8P messaging in PCS 7.

Declaring MsgEvId and S7 Attributes in SCL and CFC

When authoring custom blocks in Structured Control Language (SCL), declare the parameters and attributes as follows:

FUNCTION_BLOCK FB1500
TITLE = 'Custom Motor Controller'
{ S7_m_c := 'true';
  S7_alarm_ui := 'true';
  S7_tasklist := 'OB100' }
AUTHOR : 'Author'
FAMILY : 'USER'
VERSION : '1.0'

VAR_INPUT
    // Message Event ID parameter for ALARM_8P
    MsgEvId1 { S7_server := 'alarm_archiv';
               S7_a_type := 'alarm_8p';
               S7_visible := 'false';
               S7_link := 'false' } : DWORD := 16#00000000;
END_VAR

VAR
    // Static instance of ALARM_8P
    Inst_Alarm8P : SFB35;
END_VAR

BEGIN
    // Call ALARM_8P with assigned MsgEvId1
    Inst_Alarm8P(EN_R := TRUE,
                 ID := 16#EEEE,
                 EV_ID := MsgEvId1,
                 SIG_1 := FaultTrip,
                 SIG_2 := WarningTrip);
END_FUNCTION_BLOCK

Listing 1: SCL interface declaration for ALARM_8P message enablement.

Compiling and Configuring Alarm Messages in SIMATIC Manager

Once the SCL source is compiled into a block in the offline block folder:
1. In SIMATIC Manager, locate FB1500 in the Blocks folder.
2. Right-click FB1500 and select Object Properties.
3. Under the Attributes tab, verify that S7_alarm_ui is set to true.
4. Switch to the General - Part 2 or Special Object Properties tab: the Messages button is now active.
5. Click Messages: the PCS 7 message configuration dialog opens, allowing you to define message classes (e.g., Alarm, Warning, Tolerance), message texts, and format associated values (@1%s@).
6. In CFC, insert the block: every instance receives a unique message number automatically upon placement.

Verification

To confirm proper message block operation:

  1. Insert an instance of the custom block into a CFC chart in SIMATIC Manager.
  2. Double-click the block: click the Messages button and verify that message texts are configured.
  3. Execute Options > Compile OS (Changes Only): verify that the compiler assigns message IDs without warnings.
  4. Open WinCC Alarm Logging: verify that the 8 message events corresponding to the block instance appear in the message list with correct message classes.
  5. In runtime, trigger SIG_1: verify that the alarm appears instantly in the WinCC alarm banner with accurate timestamping.

Limitations and Operational Precautions

  • Never manually enter or edit hex values in the MsgEvId parameter in CFC; let the PCS 7 message generator manage message ID allocation to avoid duplicate message numbers.
  • Standard S7-300 CPUs do not support SFB35 ALARM_8P; custom blocks utilizing ALARM_8P must execute on S7-400 or CPU 410-5H controllers (6ES7410-5HX08-0AB0).
  • If multiple ALARM_8P instances are called within a single FB, define distinct event parameters (MsgEvId1, MsgEvId2) with identical attributes for each instance.

Engineer FAQ

Can I add ALARM_8P attributes to a block created entirely in CFC?

No. In CFC, you cannot declare low-level system attributes on block headers or inputs. Custom message-capable blocks must be authored in SCL or compiled as user blocks in STEP 7 before placement in CFC.

What happens if S7_server := 'alarm_archiv' is omitted?

Without this attribute, the message compiler cannot assign a message number from the central project pool, leaving the Messages button permanently disabled.

What is the function of the ID parameter on ALARM_8P?

The ID parameter defines the communication connection identifier. In PCS 7, setting ID := 16#EEEE directs the operating system to route the alarm through the standard internal message buffer to WinCC.

Technical References

Related Articles

Related Tags

  • ALARM_8P
  • SFB35
  • SCL
  • MsgEvId
  • S7_server
  • S7_alarm_ui
  • PCS 7
6 respuestas