1. Overview
SIMOTION controllers configured in SCOUT (or the TIA Portal engineering environment for newer firmware) define alarms in the project tree under Alarms. These alarms are stored in the controller's runtime data structure and can be raised at runtime by the application program. The companion HMI engineering tool WinCC flexible 2008 SP5 / WinCC (TIA Portal) is responsible for displaying those alarms on panels such as the MP 277, TP 177B, Comfort Panel, or the runtime simulator.
The most common reason a configured alarm does not appear in the HMI Alarm View is a missing HMI-side subscription: WinCC flexible must be told which alarm number range or alarm class to poll, and the project must be compiled, downloaded, and connected to the SIMOTION controller over PROFINET, PROFIBUS, or MPI/Industrial Ethernet. This article explains the SCOUT-side configuration, the Structured Text (ST) function-block code required to raise and clear alarms using the _alarmscid and _alarmsid system functions, the WinCC flexible Alarm View wiring, and the diagnostics path when the alarm still does not show up.
structAlarmId, _alarmscid, _alarmsid) is identical in both, but TIA Portal exposes it through the SIMOTION alarm configuration editor.2. Architecture and Alarm Flow
Alarms flow from the controller to the HMI through the following layers:
-
SCOUT project tree → Alarms configuration with alarm numbers, classes, message texts, and
structAlarmIdhandles. -
ST application → calls
_alarmscid(id)to query state and_alarmsid(sig, ev_id)to raise/clear the alarm. - Controller runtime → writes the alarm status into the SIMOTION alarm buffer and broadcasts it on the configured HMI connection.
- WinCC flexible / WinCC TIA → subscribes to the alarm class, updates the Alarm View, and shows the text plus state color.
A functional end-to-end chain requires all four layers. If any link is missing, the HMI will show no entry, even when the alarm is correctly raised in SCOUT.
3. Prerequisites
| Item | Required | Notes |
|---|---|---|
| SIMOTION controller | D4x5, CX32, T-CPU, C240, P320, or newer | Firmware V4.2 or higher recommended for the system functions used |
| SCOUT engineering | V4.4 SP1 minimum, V5.4 typical | Add-on installed on STEP 7 V5.5+ or TIA Portal V16+ |
| HMI panel or Runtime | WinCC flexible 2008 SP5 or WinCC TIA V16/17/18 | Comfort Panels, MP 277, or PC Runtime (RT) |
| Connection | PROFINET IRT, PROFIBUS DP, or Industrial Ethernet | PG/PC interface and HMI station configured in same subnet |
| ST compiler | Default in SCOUT | No additional license required for the system functions used |
4. Configuring Alarms in SCOUT
- Open the SIMOTION project in SCOUT, right-click Alarms in the project tree under the controller, and choose Insert new alarm.
- Define the alarm number (1…65 535). The number is the handle the application code will use.
- Select the alarm class (e.g., FAULT, WARNING, INFO) and the associated display class on the HMI side.
- Enter the message text and any acknowledgement model (none, coming, going, coming & going, status, status & ack).
- Compile the SCOUT project (Project → Compile and check objects). The compiler generates the
structAlarmIdsymbol used by ST.
The alarm configuration is the static side. Dynamic raising/clearing is handled in the application program.
5. ST Application Code: Raising and Clearing Alarms
The system functions _alarmscid and _alarmsid are the canonical way to drive SIMOTION alarms from ST. The functions are declared in the SIMOTION system library and operate on a structAlarmId argument that the compiler generates from the alarm configuration. The _alarmscid call returns the current state of the alarm as a DWORD; the constant MESSAGE_STATE_INACTIVE = 16#0010 means the alarm is not currently active.
5.1 Complete INTERFACE and IMPLEMENTATION Block
INTERFACE
TYPE
actuator_status_enum : (STATUS_OFF, STATUS_ON, STATUS_DISABLED, STATUS_FAULT);
END_TYPE
FUNCTION event_handler;
FUNCTION alarm_handler;
FUNCTION get_actuator_status;
END_INTERFACE
IMPLEMENTATION
VAR_GLOBAL CONSTANT
MESSAGE_STATE_INACTIVE : DWORD := 16#0010;
END_VAR
FUNCTION event_handler : VOID
VAR_INPUT
raise : BOOL;
event_id : structAlarmId;
END_VAR
VAR
event_state : DWORD;
return_dword : DWORD;
END_VAR
event_state := _alarmscid(event_id);
IF raise AND event_state = MESSAGE_STATE_INACTIVE THEN
return_dword := _alarmsid(sig := TRUE, ev_id := event_id);
END_IF;
IF NOT raise AND event_state <> MESSAGE_STATE_INACTIVE THEN
return_dword := _alarmsid(sig := FALSE, ev_id := event_id);
END_IF;
END_FUNCTION
FUNCTION alarm_handler : VOID
VAR_INPUT
raise : BOOL;
alarm_id : structAlarmId;
END_VAR
VAR
alarm_state : DWORD;
return_dword : DWORD;
END_VAR
alarm_state := _alarmscid(alarm_id);
IF raise AND alarm_state = MESSAGE_STATE_INACTIVE THEN
return_dword := _alarmsid(sig := TRUE, ev_id := alarm_id);
END_IF;
IF NOT raise AND alarm_state <> MESSAGE_STATE_INACTIVE THEN
return_dword := _alarmsid(sig := FALSE, ev_id := alarm_id);
END_IF;
END_FUNCTION
FUNCTION get_actuator_status : actuator_status_enum
VAR_INPUT
enabled : BOOL;
on : BOOL;
fault : BOOL;
END_VAR
IF fault THEN
get_actuator_status := STATUS_FAULT;
ELSIF NOT enabled THEN
get_actuator_status := STATUS_DISABLED;
ELSIF on THEN
get_actuator_status := STATUS_ON;
ELSE
get_actuator_status := STATUS_OFF;
END_IF;
END_FUNCTION
END_IMPLEMENTATION
5.2 Calling Pattern
- Insert a new ST source file in the SCOUT project under the SIMOTION controller → Programs → ST sources.
- Paste the interface and implementation above. The order in the file (INTERFACE before IMPLEMENTATION) is required by the ST compiler.
- In the call site, use Symbol input help… on the
alarm_idinput. The symbol browser will list the configured alarms; selecting one auto-fills thestructAlarmId. - Compile the ST source. Any mismatch between the configured alarm numbers and the call site will produce a Type mismatch or Undefined symbol error.
structAlarmId handle is generated per alarm by the SCOUT compiler. If you rename or renumber an alarm in the project tree, you must re-compile every ST source that references the old handle, otherwise the call will fail at runtime with a System error 0xFFxx in the alarm state word.5.3 State Word Reference
| Bit | Mask (hex) | Meaning |
|---|---|---|
| 4 | 0x0010 | MESSAGE_STATE_INACTIVE — alarm is not currently active |
| 0 | 0x0001 | Alarm present (coming) |
| 1 | 0x0002 | Alarm gone (going) |
| 2 | 0x0004 | Alarm acknowledged |
| 3 | 0x0008 | Acknowledgement required |
6. WinCC Flexible HMI Configuration
Once SCOUT can raise the alarm, the HMI project must be configured to receive and render it.
6.1 Add a Connection to the SIMOTION Controller
- In the WinCC flexible project tree, right-click Connections and choose Add Connection.
- Set the Communication driver to SIMOTION (or PROFINET in TIA Portal). The driver is part of the SIMOTION HMI option.
- Enter the IP address of the SIMOTION interface (X150, X160, or PN/IE) and the rack/slot (for PROFIBUS) or station number (for PROFINET).
- Confirm the connection is online using Tools → Status of Connections — the icon must turn green.
6.2 Configure the Alarm Classes
Alarm classes determine color and acknowledgement behavior on the HMI. In WinCC flexible:
- Open Project → Alarm Logging (or in TIA Portal, HMI alarms → Alarm classes).
- Verify the default classes Errors, Warnings, System, Diagnostic Events, and Motion exist.
- Under Settings → Controller alarms, enable SIMOTION alarms. Without this flag the HMI will not poll the controller alarm buffer.
6.3 Place an Alarm View on a Screen
- Open the desired screen in the HMI screen editor.
- From the Tools palette, expand Enhanced Objects and drag Alarm View onto the screen.
- In the Alarm View properties, set the Alarm class filter to All (or to the specific class such as Errors).
- Enable the columns: Number, Time, Date, State, and Text. These map to the alarm record fields in the SIMOTION buffer.
- Resize the view to display at least 8–10 rows so a triggering alarm is visible without scrolling.
6.4 Compile and Download
- Compile the HMI project (Project → Compiler → All). The compile must finish without errors. Common issues: missing PLC tag, broken connection, or a tag assigned to a controller that is not in the project.
- Download the project to the HMI (Target system → Download). The transfer requires a working PG/PC interface, typically Ethernet for Comfort Panels and USB/PROFINET for older panels.
- Restart the HMI Runtime if the alarm class configuration was changed while online.
7. Parameter Mapping Reference
| SCOUT Configuration | WinCC flexible Field | Notes |
|---|---|---|
| Alarm number | Alarm View → Number | Unique controller-wide identifier |
| Alarm class (FAULT/WARNING/INFO) | Alarm class filter | Maps to HMI display class and color |
| Message text | Alarm View → Text | Supports placeholder fields such as %1 for runtime values |
| Acknowledgement model | Alarm View → Acknowledge button | Drives the ACK column visibility |
| Severity / priority | Sort order | Lower number typically means higher priority |
| Trigger tag (optional) | Bound PLC tag | Enables text composition with {Tag} in the text editor |
8. Verification
After completing the SCOUT and WinCC flexible configuration, validate the chain end-to-end:
-
Online in SCOUT: open the Alarm buffer on the controller. Trigger the alarm from the ST program (e.g., force
raise := TRUEon a test call). The buffer must show the alarm with state Present. - Online in WinCC flexible: switch to Runtime on the HMI. The Alarm View must show a new row within one polling cycle (typically 250–1000 ms depending on the connection type).
- Acknowledge path: if the alarm requires acknowledgement, the Ack button must clear the corresponding bit in the controller alarm state.
-
Clear path: setting
raise := FALSEin the application code must transition the alarm to Going and then remove it from the active list, leaving an entry in the history log.
9. Troubleshooting Matrix
| Symptom | Probable Cause | Corrective Action |
|---|---|---|
| Alarm visible in SCOUT buffer, not in HMI | HMI connection is offline or the SIMOTION HMI driver option is not licensed | Check Connections status in WinCC flexible; verify the SIMOTION option is installed |
| No alarm view object on the active screen | Alarm View was never placed or the screen is not the current one | Insert Enhanced Object → Alarm View on the process screen and switch to that screen in Runtime |
| Alarm View is empty even though HMI is online | Alarm class filter excludes the active class | Set the Alarm View filter to All; re-check the class assignment in SCOUT |
| Application call returns 0xFFFE or invalid state | Wrong structAlarmId assigned to the call |
Re-compile the SCOUT project, re-paste the symbol from the browser, recompile the ST source |
| Alarm raises but never clears | Application never calls _alarmsid(sig := FALSE, …)
|
Verify the raise boolean transitions back to FALSE and the call is reached each cycle |
Alarm appears with placeholder %1 in text |
Associated tag value is not bound or connection broken | Bind a tag in the alarm text and verify the tag connection is online |
| HMI shows old alarm list after project change | Project was compiled but not downloaded, or Runtime cache not flushed | Stop HMI Runtime, re-download the project, restart Runtime |
10. Field-Commissioning Checklist
- SCOUT alarm list contains the expected numbers and classes.
- ST source compiled without warnings;
structAlarmIdsymbols resolved. - Controller is in RUN with the program active and the alarm task scheduled.
- WinCC flexible connection is online (green icon in the status bar).
- Alarm class filter on the HMI includes the active class.
- Alarm View object is placed on a screen that is the active screen in Runtime.
- Manual trigger from SCOUT (right-click → Acknowledge/Trigger alarm) produces a row in the HMI Alarm View within 2 seconds.
- Acknowledge button removes the active state on the controller.
11. Frequently Asked Questions
Why does the alarm appear in the SCOUT alarm buffer but not in the WinCC flexible Alarm View?
The HMI side has not subscribed to the SIMOTION alarm buffer. Open Alarm Logging → Settings → Controller alarms in WinCC flexible and enable the SIMOTION alarms option, recompile, and re-download the HMI project. Also verify the connection to the controller is online (green icon) and that the Alarm View object is placed on the currently active screen.
How do I raise a SIMOTION alarm from Structured Text code?
Use the system function _alarmsid(sig := TRUE, ev_id := alarm_id) with the structAlarmId handle generated by SCOUT for the configured alarm. Query the state with _alarmscid(alarm_id) first to avoid raising an already-active alarm twice per cycle. The provided alarm_handler function in this article implements the standard raise/clear pattern.
What is the difference between the _alarmscid and _alarmsid system functions?
_alarmscid returns the current state of the alarm as a DWORD (inactive = 0x0010). _alarmsid writes the desired state to the alarm, raising it with sig := TRUE and clearing it with sig := FALSE. They are used together: read state, then act, in the same ST cycle.
Can I reuse the same ST alarm-handling code on multiple controllers?
The structAlarmId type is generated per project. Copy the ST source into the new SCOUT project, recompile, and use the symbol input help to re-bind the alarm_id to the alarms configured in the new project. The function bodies are generic; only the symbol bindings change.
Where can I find the official documentation for SIMOTION alarms and WinCC flexible alarm logging?
Refer to the SIMOTION Programming and Operating Manual (entry ID 109751074) and the WinCC flexible 2008 SP5 Communication manual (entry ID 18796952) in the Siemens Industry Online Support portal at support.industry.siemens.com. For TIA Portal projects, the equivalent references are the SIMOTION in TIA Portal manual and the WinCC (TIA Portal) Alarm Logging manual.