When you read the AlarmStorage, you can get Static Informed about the alarms through this method call:
Declaration
METHOD AlarmRead VAR_INPUT /// A 0-based index of the row read from TblAlarm diWhichRow : DINT; /// An AlarmStorageStaticData variable, containing data of the alarm staticData : AlarmStorageStaticData; END_VAR
The staticData here contains:
- udiAlarmGroupId
- udiAlarmClassId
Use the following code to get the group name or class name:
Declaration
_itfAlarmClass : IAlarmClass; _itfAlarmGroup : IAlarmGroup; _sClass : STRING; _sGroup : STRING;
Implementation
_itfAlarmClass := g_AlarmHandler.g_inst.FindAlarmClass(staticData.udiAlarmClassId); IF (_itfAlarmClass <> 0) THEN _sClass := _itfAlarmClass.GetName(); END_IF _itfAlarmGroup := g_AlarmHandler.g_inst.FindAlarmGroup(staticData.udiAlarmGroupId); IF (_itfAlarmGroup <> 0) THEN _sGroup := _itfAlarmGroup.GetName(); END_IF
See also....
- Our Codesys Online Help (OLH) Website
- Basic information to the Codesys Development System (Codesys Homepage)
- OLH: The Online-help introduction for the Codesys Development System (IDE)
- OLH: Alarm Configuration, 'Alarm class' Objects and ‘Alarm group’ Objects