Using Latch Variables to Filter Alarm Events

Filtering by the contents of a latch variable can be useful when there are a lot of alarm events displayed. If the latch variable assigned to an alarm in its definition contains, for example, the error number or the name of a device instance, then the operator can filter the alarms in the visualization by it. The operator specifies a value, and this value is compared with the values of the latch variables of the alarms. Which type of value can be specified is controlled by a filter type variable.

In the , you will find the sample project "Alarm Filter Latch Example".

  1. In the application, define a variable which gets the value by which alarms can be filtered later.

    Example: The variable PLC_PRG.sFilter : STRING; for the entry of an error ID.

  2. In the configuration of the individual alarms, assign one or more latch variables which contain additional information about the alarm. Example: rEngineTemperature for the current machine temperature; rEngineSpeed for the current velocity; possibly also strError which returns the error ID. You can also use more than the two default latch variables for additional information about the alarm. To do this, use the context menu to insert additional columns in the table of the alarm group editor.

  3. Define an additional integer variable which specifies which type of value the operator can enter for filtering the alarms in the visualization, and how this is interpreted. Example: eFiltType : VisuElemsAlarm.EFilterLatchContent;. EfilterLatchContent is an enumeration defined in the library AlarmManager with the following filter types:

    • 0: No filtering

    • 1: Filter by alarms whose latch variable 1 contains the string specified in the filter variable.

      Example: The filter variable contains 'Error 1' which is the latch variable 1 of different alarms of type STRING and has the value 'Error 1' ->. Only these alarms are displayed.

    • 2: Filter by alarms whose latch variable 1 contains the typed literal specified in filter variable according to IEC 61131-3.

      Examples: T#1h2s, DINT#15, REAL#1.5, FALSE

    • 3: Filter by alarms whose latch variable 1 contains the LINT literal value specified in filter variable. Therefore, the value of the latch variables has to be in the range of 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

    • All other values: The behavior is not defined and can change in the future.

  4. Configure an input option in the alarm visualization for the contents of the latch variable to be filtered by. For example, add an input field where the user can enter the value to be filtered by. To do this, use an input configuration with the Write Variable action and enter the filter variable PLC_PRG.sFilter defined in Step 1 above. Example: PLC_PRG.sFilter. Then the alarm visualization reads this as a filter variable.

    In the properties of the alarm visualization element, in the Alarm configuration – Filter by latch 1 – FilterVariable property, enter this variable accordingly (example: enter PLC_PRG.sFilter again).

  5. In the same procedure, in the visualization, configure an input capability for the type of filtering (eFiltType). For example, insert another input element. By means of this element, the variable is written which exists in the Filter type property of the configuration of the alarm table or alarm banner.

[Tip] Tip

In the alarm group editor, you can edit the definition of the alarm message texts to include the entry of the latch variable value.