Section: alg.Alarm
The section SEC alg.Alarm describes a module alarm. A module alarm essentially corresponds to an alarm of the CODESYS alarm management that has been configured in an alarm group. However, a module alarm still contains module-specific additions.
For more information, see the Module Declaration chapter and Object: Alarm Group
Specification
SEC alg.Alarm                                       //optional: yes, modifier: [UPDATE]
    SEC SetAlarm <alarm identifier>                 //optional: yes, modifier [UPDATE]
            Class := <class name>;                    //optional: no, type: ID
            Message := <TextlistEntry>;                 //optional: no, type: TextListEntry
            LatchVar1 := <LatchVariable1>;              //optional: yes, type: InstancePath
            LatchVar2 := <LatchVariable2>;              //optional: yes, type: InstancePath
            Deactivation := <DeactivationVariable>;     //optional: yes, type: InstancePath
            PendingTime := <PendingTime>;               //optional: yes, type: LiteralOrConstant
            PendingTimeParameter := <string>            //optional: no, type: literal/string
            HigherPrioAlarm := <HigherPrioAlarm_ID>;    //optional: yes, type: ID
            ModuleCalls := <ModuleCallFlags>;           //optional: yes, type:  ModuleCallFlag
            SEC Messages : <alarm identifier>           //optional: yes, modifier: [UPDATE]
                    Message := <TextlistEntry>;             //optional: no, type: TextListEntry
                    Number := <ColumnNumber>;               //optional: no, type: Literal
            END_SEC
            SEC LatchVar <latch var identifier>         //optional: yes, modifier [UPDATE]
                    LatchVar := <LatchVariable>;            //optional: no, type: InstancePath
                    Number := <LatchVarNumber>              //optional: no, type: LiteralOrConstant
            END_SEC
            SEC UpperLimit                              //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
                    IncludeBorder := TRUE/FALSE;            //optional: no, type: FlagBool
                    UpperExpression := <UpperExpression>;   //optional: no, type: Literal/String
                    Hyteresis := <HysteresisValue>;         //optional: yes, type: LiteralOrConstant
            END_SEC
            SEC LowerLimit                              //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
                    IncludeBorder := TRUE/FALSE;            //optional: no, type: FlagBool
                    LowerExpression := <LowerExpression>;   //optional: no, type: Literal/String
                    Hyteresis := <HysteresisValue>;         //optional: yes, type: LiteralOrConstant
            END_SEC
            SEC InsideRange                             //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
                    AreaLow := <AreaLowValue>;              //optional: no, type: Literal/String
                    LowIncludeBorder := TRUE/FALSE;         //optional: no, type: FlagBool
                    HighIncludeBorder := TRUE/FALSE;        //optional: no, type: FlagBool
                    AreaHigh := <AreaHighValue>;            //optional: no, type: Literal/String
                    Hyteresis := <HysteresisValue>;         //optional: yes, type: LiteralOrConstant
            END_SEC
            SEC OutsideRange                            //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
                    AreaLow := <AreaLowValue>;              //optional: no, type: Literal/String
                    LowIncludeBorder := TRUE/FALSE;         //optional: no, type: FlagBool
                    HighIncludeBorder := TRUE/FALSE;        //optional: no, type: FlagBool
                    AreaHigh := <AreaHighValue>;            //optional: no, type: Literal/String
                    Hyteresis := <HysteresisValue>;         //optional: yes, type: LiteralOrConstant
            END_SEC
            SEC Digital                                 //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
                    Equal := TRUE/FALSE;                    //optional: no, type: FlagBool
                    EqualsExpression := <Expression>;       //optional: no, type: Literal/String
            END_SEC
            SEC Change                                  //optional: yes, modifier: [UPDATE]
                    Expression := <Expression>;             //optional: no, type: Literal/String
            END_SEC
            SEC Event                                  //optional: yes, modifier: [UPDATE]
            END_SEC
    END_SEC
END_SEC| 
 | The subsections of  | 
| 
 | Alarm class name, under which the alarm will be created. If this alarm class already exists in the application, the alarm will be created under this class. If this class does not exist, an alarm class template object is searched for, which must be present in the POUs view. If no appropriate alarm class template object is found, an error is issued when the module is scanned. | 
| 
 | ID (of the form  The message referenced by the ID can contain the same placeholders as the text in an alarm configuration. For example placeholders such as  If a specified text list entry cannot be found, a warning is issued during the scan. Corresponds to the Message setting in the Alarm Group object. | 
| 
 
 | Placeholder variables In the present case of module-specific alarms, variables can only be specified directly from the module function block (just like variables are specified in the module declaration for e.g. parameters) Corresponds to the settings Latch variable 1 / Latch variable 2 for placeholders  | 
| 
 | Deactivation variable ( 
 If the type of the variable that is entered is not  Corresponds to the Deactivation setting in the Alarm Group object. | 
| 
 | Minimal pending time. Defines the amount of time before the alarm actually goes off after reaching its limits. Example:  Corresponds to the setting Min. pending time in the Alarm Group object. | 
| 
 | Parameter to set the minimum pending time The value which is assigned to the parameter is a string that can be interpreted as time. Or also as an expression which consists of module parameters and time literals. . Example: 
 | 
| 
 | ID of the higher priority alarms To identify the alarm under which the present alarm should be classified, a target ID of a  Corresponds to the setting Higher prio. alarm in the Alarm Group object. | 
| 
 | For module-specific alarm management, module FBs can offer specific interfaces that can be called if an module alarm occurs. The flags define in which cases this will happen. . Available  ModuleCallFlags:
 Module FBs that will be called by this flag must implement the  If the  | 
| 
 | The subsection manage the same task as the  
 
 | 
| 
 | Latch variables. Up to 10 latch variables can be defined in this section. If, in addition to this section,  
 
 | 
| 
 
 | Alarm conditions for alarms that trigger if upper or lower boundaries are crossed. The section is allowed to occur only once below the  
 
 
 
 Corresponds to the settings Upper limit / Lower limit for the observation types in the Alarm group object. | 
| 
 
 | Alarm conditions for alarms that trigger if an expression is in- or outside of a certain range of values. The section is allowed to occur only once below the  
 
 Corresponds to the settings Inside range / Outside range for the observation types in the Alarm group object. | 
| 
 | Alarm which is raised if two expressions are compared with one another. The section is allowed to occur only once below the  
 Corresponds to the observation type Digital in the Alarm Group object. | 
| 
 | Alarm which is raised if an expression changes its value. The section is allowed to occur only once below the  
 Corresponds to the observation type Change in the Alarm Group object. | 
| 
 | Determines that the current alarm section creates an event alarm. This alarm can be triggered by the function  | 
Example
SEC SetAlarm : ValueRange
        Class := Error;
        Message := TL.Alarm_Temperature;
        LatchVar1 := rAlarmValueLow;
        LatchVar2 := rAlarmValueHigh;
        ModuleCalls := THIS | PARENTS;
        SEC Messages : msg2
                Message := TL.msg5_Message;
                Number := 5;
        END_SEC
        SEC OutsideRange
                Expression := 'rValue';
                AreaLow := 'rAlarmValueLow';
                LowIncludeBorder := TRUE;
                HighIncludeBorder := TRUE;
                AreaHigh := 'rAlarmValueHigh';
        END_SEC
END_SECPendingTimeSEC alg.Alarm SEC SetAlarm : NoVar Class := AlarmClassTemplate; Message := TL.NoVar_Message; PendingTimeParameter := 'NoVar'; SEC Digital Expression := 'xAlarm'; Equal := TRUE; EqualsExpression :='TRUE'; END_SEC END_SEC SEC SetAlarm : WithVar Class := AlarmClassTemplate; Message := TL.NoVar_Message; PendingTimeParameter := 'WithVar'; SEC Digital Expression := 'xAlarm'; Equal := TRUE; EqualsExpression :='TRUE'; END_SEC END_SEC SEC SetAlarm : SimpleMath Class := AlarmClassTemplate; Message := TL.NoVar_Message; PendingTimeParameter := 'WithVar - NoVar + TIME#5S'; SEC Digital Expression := 'xAlarm'; Equal := TRUE; EqualsExpression :='TRUE'; END_SEC END_SEC SEC SetAlarm : NoParam Class := AlarmClassTemplate; Message := TL.NoVar_Message; PendingTime := TIME#5S; SEC Digital Expression := 'xAlarm'; Equal := TRUE; EqualsExpression :='TRUE'; END_SEC END_SEC END_SEC