Deleting the Alarm History

You can insert an input element in the visualization which the operator can use to delete the previously recorded alarm history at runtime. The history displayed until then is removed and the display starts over.

  1. In the application (example: in the program PLC_PRG), implement the following code:

    itfAlarmConfiguration : AlarmManager.IAlarmConfiguration;
    itfAlarmConfiguration7 : AlarmManager.IAlarmConfiguration7;
    xKeepActiveAlarms : BOOL := TRUE;
    xClearHistory: BOOL;
    
    IF xClearHistory THEN
      FOR i := 0 TO AlarmGlobals.g_AlarmHandler.AlarmConfigurationCount - 1 DO
      itfAlarmConfiguration := AlarmGlobals.g_AlarmHandler.GetAlarmConfiguration(i);
        IF __QUERYINTERFACE(itfAlarmConfiguration, itfAlarmConfiguration7) THEN
        itfAlarmConfiguration7.ClearHistory(xKeepActiveAlarms := xKeepActiveAlarms);
        END_IF
      END_FOR
    END_IF
    

    ⇒ When xClearHistory gets the value TRUE, the current history will be deleted. Recommendation: xKeepActiveAlarms should be TRUE so that active alarms are excluded from the delete operation. If this does not happen, then it does not interrupt the continued recording, but log outputs can be changed for the additional state transitions.

  2. In the alarm visualization, add a button for deleting the history. Configure its Toggle property with the variable PLC_PRG.xClearHistory.

See also