FB_MTP_AlarmMgmt

The function block FB_MTP_AlarmMgmt is an object used to describe, manage, and represent an alarm. It is described by the variables Message, Severity, and Acknowledge required, and has a state machine. In addition, an event is created for the TwinCAT Eventlogger during instantiation.
Initialization
Use the variable Message to specify the alarm message that should be displayed when an alarm is active.
You can specify the severity using the variable Severity. The value range is between 1 and 1000, with 1 representing the lowest severity.
Acknowledge required = TRUE states that the alarm must be acknowledged.
Use the variable OnDelay to specify the delay time (s) between the occurrence of an invalid state and the triggering of the alarm.
State machine
The function block has a state machine that corresponds to the IEC 62682 and has 4 main states: Normal, Unacknowledged alarm, Acknowledged alarm, and Return to normal unacknowledged.
In addition, there are 3 other states – Shelved, Suppressed, and Out of service– to temporarily disable the alarm. If this option is disabled, AlarmActive = FALSE and Acknowledge will be ignored.
If the input is ProcessAbnormal = TRUE, the Bit 1 of the output variable State is set to True after a start-up delay has elapsed. The start-up delay is set using the variable OnDelay.
If the alarm does not need to be acknowledged, the Alarm Acknowledged transition is set automatically.

Synchronization of TwinCAT 3 event logger
Each function block FB_MTP_AlarmMgmt initializes an alarm in the TwinCAT 3 event logger. The event logger's alarm is synchronized with the main states of the alarm state machine.
By specifying a severity using the variable Severity, the alarm is assigned to an event class:
Severity | TwinCAT 3 event logger Event Class |
001-200 | Verbose |
201-400 | Info |
401-600 | Warning |
601-800 | Error |
801-1000 | Critical |
Syntax
The variable SourceName is used to store the name of the object associated with the alarm. The variable SourceID describes the alarm ID within the object to which the alarm belongs: for example, a pump (TagName = Pump) with 2 alarms, AlarmMgmt_Pump_Trip and AlarmMgmtSafePosAct:
<Pump> : FB_MTP_AnaDrv := (
TagName := <Pump>,
<initial values>);
<AlarmMgmt_Pump_Trip> : AlarmMgmt := (
SourceName := <Pump>,
SourceID := <0>,
<initial values>);
<AlarmMgmt_Pump_SafePosAct> : AlarmMgmt := (
SourceName := <Pump>,
SourceID := <1>,
<initial values>);
Further properties
Implemented interfaces
Inputs
Name | Type | Description | OPC UA access |
|---|---|---|---|
TagName | STRING | Name of the interface | - |
TagDescription | STRING | Description of the interface | - |
WQC | BYTE | Worst Quality Code | Read |
OSLevel | BYTE | Level must be defined for system. Value 0 is reserved for local operation. | Read/write |
ProcessAbnormal | BOOL | 1: Process in invalid state | - |
Message | STRING | Message to be displayed when the alarm is active. | - |
Severity | INT | Alarm severity | - |
Ackrequired | BOOL | 1: The alarm must be acknowledged. 0: The alarm does not need to be acknowledged. | - |
Suppress | BOOL |
| - |
Unsuppress | BOOL |
| - |
SourceName | STRING |
| - |
SourceID | UDINT | Alarm ID | - |
Outputs
Name | Type | Description | OPC UA access |
|---|---|---|---|
State | BYTE | Bit-coded alarm status: 0: - 1: Alarm active 2: Acknowledged 3: 4: 5: 6: - 7: - | Read |
Internal variables
Name | Type | Description | OPC UA access |
|---|---|---|---|
OnDelay | REAL | Time delay (s) between the occurrence of abnormal behavior and the setting of | Read/write |
Command | BYTE | Bit-encoded control words: 0: - 1: Acknowledge alarm 2: 3: 4: 5: 6: - 7: - | Read/write |
Methods
Name | Type | Description |
|---|---|---|
GetAlarmState | Returns the current state of the finite-state machine. | |
IsAcknowledged | BOOL | Returns the value of the bit |
IsAlarmActive | BOOL | Returns the value of the bit |
IsOutOfService | BOOL | Returns the value of the bit |
IsShelved | BOOL | Returns the value of the bit |
IsSuppressed | BOOL | Returns the value of the bit |