Skip to main content

Deleting the Alarm History

You can insert an input element in the visualization which the visualization user 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 set to TRUE so that active alarms are excluded from the delete operation. Otherwise, further recording will not be interrupted, but the log outputs may change with other state transitions.

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