Resolving Duplicate ALARM_SQ Tags in STEP 7 V5.4 WinCC

David Krause13 min read
SiemensTroubleshootingWinCC
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Resolving Duplicate ALARM_SQ Tags in STEP 7 V5.4 with WinCC V7.0

Overview

The ALARM_SQ (and ALARM_DQ) standard block family in SIMATIC STEP 7 V5.4 SP4 generates message-capable alarms on S7-300/S7-400 CPUs and, when combined with the AS-OS Engineering tool, automatically publishes them to a paired WinCC V7.0 SP1 station. A common field complaint is that the OS compile step creates three ancillary tags for every alarm:

  • <MSG_ID>.EventState
  • <MSG_ID>.EventRaw#1
  • <MSG_ID>.EventTrans#1

These tags are visible in WinCC Tag Management and inflate the runtime tag count by a factor of three per active message. On large plants with thousands of alarms this is a serious licensing and memory problem because WinCC tags are sold in 128/256/512/... licensed increments. This reference documents the root cause, the field-proven workaround, the verification procedure, and the migration path to the TIA Portal Program_Alarm instruction that does not exhibit the same behavior.

Scope: Symptom applies to STEP 7 V5.4 SP4 + WinCC V7.0 SP1 with the AS-OS Engineering wizard (formerly AS-OS Transfer). The fix is also valid for STEP 7 V5.5 and WinCC V7.0/V7.2/V7.3 projects that still use the classic PCS 7 message configuration. TIA Portal projects (V13 onward) use a fundamentally different alarm model and are addressed in the Modernization Path section.

Background: The ALARM_SQ Block Architecture

ALARM_SQ is one of the four standard message-procedure blocks delivered with the STEP 7 Standard Library under Standard Library > Miscellaneous Blocks:

Block Acknowledgement Lock / Unlock Typical Use
ALARM_S Single, no acknowledgement No Simple binary events
ALARM_SQ Single, with acknowledgement Yes (CANCEL, ACK) Operator-relevant status
ALARM_D Double, no acknowledgement No Edge-triggered events
ALARM_DQ Double, with acknowledgement Yes Edge events requiring acknowledgment

Each call to ALARM_SQ opens a message slot in the CPU's local message buffer. The block returns a 24-byte Message Instance data record containing the slot number (MSG_ID), the event state, the raw event ID, and the transition ID. When the OS is compiled by the AS-OS wizard, STEP 7 reads these records from the S7 program and creates a mirror of three WinCC tags per slot:

WinCC Tag Direction Data Type Purpose
<MSG_ID>.EventState PLC → HMI BOOL 1 = alarm active / not acknowledged
<MSG_ID>.EventRaw#1 PLC → HMI BOOL Raised edge flag (status bit)
<MSG_ID>.EventTrans#1 PLC → HMI BOOL Transition flag (acknowledgement transition)

The first tag (EventState) is mandatory because the WinCC Alarm Control reads it to color the message line. The remaining two (EventRaw#1 and EventTrans#1) are conditional: they are emitted only when the corresponding Instance DB has the attribute Operator Control and Monitoring = S7_m_c / true set on its Special Object Properties.

Problem: Duplicate Tag Generation in WinCC

A user running STEP 7 V5.4 SP4 with WinCC V7.0 SP1 reports the following after running AS-OS Engineering → Compile OS:

"When I compile the OS, tags are created by the STEP 7 but for each alarm it is created 2 tags named xx.EventRaw#1 and xx.EventTrans#1... this is increasing the tags. How can I prevent this case?"

The same symptom is reproduced in a second independent project that uses ALARM_DQ in combination with the S7_server = alarm_archiv attribute. The user explicitly needs the Operator Control and Monitoring attribute for unrelated reasons (locking inputs, password handling, operator authorization), and therefore cannot disable it globally on the block.

Symptom Summary

  • Every ALARM_SQ / ALARM_DQ call yields exactly three tags in WinCC Tag Management instead of one.
  • Tags are read-only and cannot be deleted manually from the WinCC project tree because they are regenerated on the next OS compile.
  • Tag licensing charges increase 3×; on a 4 000-message plant this means 8 000 power-tags instead of 4 000.
  • OS compile time grows roughly linearly with the number of message instances because the AS-OS wizard re-reads every Instance DB.

Root Cause: Operator Control and Monitoring Attribute

The two extra tags are produced by the Operator Control and Monitoring (German: Bedien- und Beobachtbarkeit, abbreviated B&B) interface. When this attribute is enabled on a block's Special Object Properties, STEP 7 instruments the following capabilities into the Instance DB:

  1. Input disabling (operator lock per signal) — the EventTrans#1 tag carries the transition between locked and unlocked states.
  2. Output acknowledgment — the EventRaw#1 tag carries the raw raised edge so WinCC can display the message even after the CPU restart.
  3. Authentication / authorization — the slot can be tied to a user-class check on the HMI side.

Each of these capabilities requires its own tag because WinCC's Channel "SIMATIC S7 Protocol Suite" maps them to discrete DB bits. The PLC firmware writes the raw state into EventRaw#1, the user-side transition into EventTrans#1, and the consolidated state into EventState. When the B&B attribute is off, only EventState is published because the operator-level semantics do not exist.

Important: The Operator Control and Monitoring attribute is a STEP 7 block property, not a WinCC property. It is stored in the Instance DB header and is read by the AS-OS wizard during the next compile. Changing it in WinCC has no effect.

Solution: Disable Operator Control and Monitoring on the Instance DB

The field-proven workaround, confirmed on STEP 7 V5.4 SP4 / V5.5 with WinCC V7.0 SP1 / V7.2, is to clear the Operator Control and Monitoring flag for the Instance DB of the user FB that contains the ALARM_SQ call.

Prerequisites

  • STEP 7 V5.4 SP4 (or V5.5) installed and licensed, including the Standard Library.
  • WinCC V7.0 SP1 (or V7.2) installed with the SIMATIC S7 Protocol Suite channel.
  • The S7 program and the WinCC project must reside in a STEP 7 multi-project and be linked through the AS-OS Engineering wizard.
  • The user FB containing the ALARM_SQ / ALARM_DQ call must have been compiled at least once so that the Instance DB exists.

Step-by-Step Procedure

  1. Open the S7 program in SIMATIC Manager.
  2. In the project tree, navigate to S7 Program → Blocks and locate the multi-instance DB of the user FB that wraps ALARM_SQ (for example DB120 "Alarm_FB_IDB").
  3. Double-click the Instance DB to open the LAD/FBD/ST editor.
  4. Right-click the block title bar and choose Object Properties (or use menu Edit → Object Properties).
  5. Switch to the Special Object Properties tab.
  6. Locate the checkbox Operator Control and Monitoring (German: Bedien- und Beobachtbarkeit).
  7. Uncheck the box. Click OK.
  8. Save and close the Instance DB.
  9. Recompile the S7 program: PLC → Compile and Download Objects or simply Save and Compile.
  10. Open the WinCC project (it can stay in the same multi-project) and run the AS-OS Engineering → Compile OS wizard again.
  11. After the OS compile completes, open WinCC Explorer → Tag Management → SIMATIC S7 PROTOCOL SUITE → [connection] → [tags] and verify that EventRaw#1 and EventTrans#1 are no longer present.

Code Snippet: Typical ALARM_SQ Call

The following ST snippet shows a representative instance that triggers the duplicate-tag behavior when the IDB has B&B enabled. The block call itself does not need to change.

// FB120 "Alarm_Handler" - representative call
FUNCTION_BLOCK FB120
VAR
    iAlarmID : INT;        // Message slot from ALARM_SQ
    bSignal  : BOOL;       // Process condition to monitor
    bAck     : BOOL;       // Operator acknowledgement
    bLock    : BOOL;       // Operator lock request
END_VAR
BEGIN
    // Standard library call
    iAlarmID := ALARM_SQ(
        EN     := TRUE,
        SIG    := bSignal,           // Event signal
        ID     := DW#16#EEEE0001,    // Message number (any free number)
        EV_ID  := DW#16#EEEE0001,    // Event ID (must match)
        SE     := bLock,             // 1 = lock / unlock
        ACK    := bAck,              // Acknowledgement
        LADDR  := W#16#0FFE          // Diagnostic address (or 0)
    );
END_FUNCTION_BLOCK

The SE and ACK inputs are the underlying mechanism for the B&B attribute. When B&B is unchecked, WinCC still receives the alarm but cannot display lock-state transitions.

Verification

  1. Open the WinCC project and select Tools → Cross References for the alarm tag prefix.
  2. Confirm that EventRaw#1 and EventTrans#1 no longer appear in the tag list.
  3. Trigger a test alarm in PLCSIM (or on the real CPU) and confirm that the WinCC Alarm Control still receives the message and shows the correct state color (red = active, green = acknowledged).
  4. Check the WinCC license usage: Project → Properties → Licenses. The "Power Tags" count should drop by 2 per message.
  5. Open the OS Project Editor → Message Configuration and confirm that the alarm is still listed with correct text and associated values.
Verification caveat: If your operator workflow requires lock/unlock transitions on individual messages, you cannot simply uncheck B&B. In that case apply the fix selectively — leave B&B enabled on the Instance DBs whose messages need operator locking, and disable it on the rest. A more sustainable solution is to migrate to TIA Portal (see below), where the message configuration is decoupled from the B&B tag model.

Alternative Approaches

Option Effect on Tags Trade-off
Uncheck B&B on the Instance DB Drops from 3 tags to 1 per message No lock / unlock transitions on the alarm
Replace ALARM_SQ with ALARM_S No acknowledgement, but still 3 tags if B&B is on Loses acknowledgement, only valid for non-critical events
Move alarms to a separate FB per priority and disable B&B on the bulk DB Same as option 1, but isolated by function Slightly more block management overhead
Migrate to TIA Portal V16+ and use Program_Alarm One <AlarmName> tag and PLC-datapoint tag per alarm, no EventRaw/EventTrans split Conversion effort; WinCC V7 must be replaced with WinCC Professional (TIA)
Use a custom message block that writes a single BOOL to a process image DB and use WinCC raw tags One tag per alarm No native alarm text; you must build the alarm view manually

Parameter Reference: ALARM_SQ Inputs

Parameter Type Meaning
EN BOOL Enable; the block executes only while EN = TRUE
SIG BOOL Event signal — a rising edge raises the alarm
ID WORD Channel identifier (constant, all alarms in a CPU usually share the same ID)
EV_ID DWORD Unique event ID; any 24-bit value not used elsewhere
SE BOOL Lock/Unlock command from the operator (drives EventTrans#1)
ACK BOOL Acknowledgement from the operator (drives EventRaw#1)
LADDR WORD Logical base address of the diagnostic buffer; use 0 if not needed
Return INT Message slot number (negative = error)

Memory and Licensing Impact

The economic impact of the duplicate tags is best understood with the WinCC V7 power-tag licensing model. A 4 000-alarm plant experiences the following delta:

Configuration Tags Generated Power-Tag License
All B&B enabled (default PCS 7 behavior) 12 000 12 800-tag license bracket
B&B disabled on all Instance DBs 4 000 4 096-tag license bracket
Hybrid: B&B on 500 critical alarms, disabled on 3 500 5 500 5 632-tag license bracket

The 3× multiplier also has a WinCC runtime effect: each tag is updated cyclically by the S7 channel driver. Disabling B&B halves the cyclic S7 communication load per message, which can be a relief on slow MPI/Profibus links.

Migration Path: TIA Portal Program_Alarm

For new projects or for plants undergoing a STEP 7 V5.4 → TIA Portal V16/V17/V20 migration, the equivalent of ALARM_SQ is the Program_Alarm instruction. According to the official TIA Portal help for V20, the workflow is:

  1. Create a global data block (for example DB_Alarms) and declare a tag of type BOOL for every signal to be monitored.
  2. Inside a function block, call the Program_Alarm instruction and wire the signal tag, the alarm text, and the associated values.
  3. The instruction returns an alarm instance and a single alarm-state tag; no EventRaw / EventTrans companion tags are produced.
  4. When the OS (WinCC Professional / Unified) is compiled, only the configured alarm and its datapoint tag are published, halving or thirding the tag count per alarm.

The full procedure is documented in the TIA Portal V20 help portal under Extended Instructions (S7-1200/S7-1500) → Alarms → Program_Alarm. The new instruction also supports message classes, priorities, and free-form associated values without the "Operator Control and Monitoring" flag of the legacy model.

Edge Cases and Field Notes

1. PCS 7 vs. Stand-alone STEP 7

The B&B flag is a STEP 7 feature, not a PCS 7 feature. In PCS 7 V8/V9 the master data library (APL — Advanced Process Library) configures B&B on every channel block by default to support operator lock. Disabling it on a PCS 7 APL block breaks the standard operator faceplate. Apply the fix only on custom FBs in PCS 7, never on APL channel blocks.

2. AS-OS Re-Compile Resets the Flag

When the OS is re-compiled after a STEP 7 program change, the AS-OS wizard does not overwrite the Instance DB attribute. The flag persists. However, deleting and re-creating the Instance DB (for example by recompiling the FB with a new interface) restores the default value (checked). Always re-apply the unchecked state after any FB re-compile.

3. Read-Only Behavior in WinCC

The duplicate tags are flagged as system-managed in WinCC and cannot be removed manually from Tag Management. Attempting to delete them generates the warning "Tag is generated by STEP 7 and cannot be edited". The only legal way to remove them is the STEP 7-side fix described above followed by an OS re-compile.

4. Interaction with Alarm_Archiv

When the project uses the S7_server = alarm_archiv attribute (typically on a server pair), the alarm archive is unaffected by the B&B flag. Disabling B&B only removes the auxiliary WinCC tags; the archive continues to log the alarm with the configured state, priority, and associated values.

5. PLCSIM and WinCC Runtime

When the fix is verified in PLCSIM, the duplicate tags disappear from the WinCC project on the next compile. They do not need a WinCC runtime restart, but a new Activate of the WinCC project is required to drop the cached tag list at runtime.

Troubleshooting Matrix

Symptom Likely Cause Action
Tags still 3× after unchecking B&B OS not re-compiled Re-run AS-OS Engineering &rgt Compile OS
Tags reappear after FB re-compile IDB recreated with default B&B Re-uncheck B&B on the new IDB
Alarm text shown but state color is wrong WinCC Alarm Control still references EventRaw Rebuild the Alarm Control from the message configuration
"Tag is generated by STEP 7 and cannot be edited" warning Trying to delete tags from WinCC Fix the root cause in STEP 7; do not delete tags in WinCC
ALARM_SQ returns negative slot number CPU message buffer exhausted Reduce number of simultaneous ALARM_SQ calls or upgrade to a CPU with more message resources

Best Practices

  1. Decide up-front which alarms require operator lock / unlock. Mark them explicitly in the project standards document.
  2. Disable B&B on all non-critical alarms to keep the tag count and licensing predictable.
  3. Use a single multi-instance DB per process unit so the B&B flag can be managed at one place.
  4. Add a comment in the IDB header that documents the B&B state ("B&B disabled 2024-03-15 j.doe to limit WinCC tags") to prevent accidental re-enabling.
  5. For new projects, prefer TIA Portal V16+ and the Program_Alarm instruction; the legacy B&B model is deprecated.
  6. Re-validate the tag count after every OS compile using a small WinCC script or the project's Cross Reference report.

FAQ

Why does STEP 7 create two extra tags (EventRaw#1 and EventTrans#1) for every ALARM_SQ alarm?

These tags are emitted only when the Instance DB of the calling FB has the "Operator Control and Monitoring" flag set. The flag enables operator-level lock and acknowledgement handling, which requires the raw event bit and the transition bit in addition to the consolidated state bit.

How do I disable the duplicate-tag generation without losing the alarms?

Open the Instance DB of the FB that calls ALARM_SQ, switch to Special Object Properties, and uncheck Operator Control and Monitoring. Save the DB, re-compile the S7 program, and re-run AS-OS Engineering > Compile OS. The alarm continues to work; only the lock/unlock transition is no longer operator-controllable.

Can I delete the EventRaw#1 and EventTrans#1 tags manually in WinCC?

No. WinCC flags the tags as system-managed and reports "Tag is generated by STEP 7 and cannot be edited". They are regenerated on the next OS compile. The only correct fix is to change the B&B flag in STEP 7.

Does the fix also apply to ALARM_DQ with the S7_server = alarm_archiv attribute?

Yes. ALARM_DQ shares the same B&B interface as ALARM_SQ. Unchecking the flag on the Instance DB reduces the tag count from three to one per alarm, and the alarm archive continues to log the message normally.

Is the duplicate-tag problem also present in TIA Portal with Program_Alarm?

No. The TIA Portal Program_Alarm instruction (documented in the TIA Portal V20 help under "Program_Alarm - Generate program alarm with associated values (S7-1500)") publishes a single alarm-state tag per alarm. The legacy B&B / EventRaw / EventTrans split does not exist in the TIA Portal message model, which is one of the main drivers for migrating older STEP 7 V5.4 projects to TIA Portal.

Back to blog