Skip to main content

Example: AlarmManager

Product: CODESYS Visualization

This example shows how to use the functionality of the AlarmManager library to access alarms programmatically. When you do this, you will get help from the AlarmManager library.

The objects in AlarmManager allow for accessing active and saved alarms. Furthermore, it is possible to register a client to receive alarm events.

Description

Figure 1. AlarmManager
AlarmManager


The sample project contains a visualization with two alarm tables. The first one (Alarm table element type) shows the active and saved events. New alarms can be created using the buttons below the table. The second table (AlarmTableSimulation) simulates the alarms and displays the stored alarms as a table.

Additional information

In the AlarmManager.project project, a client implements the IAlarmManagerClient interface. This allows for programmatic access to the alarm objects.

The IAlarmManagerClient interface provides the following methods:

  • GetFilterCriteria: Filter criterion for active and stored alarms

  • ActiveAlarmChanged: Notification when an active alarm has changed. For example, when a new alarm is active or a status has changed. The list of active alarms can be read by using the IAlarmHandler2.GetActiveAlarms method.

  • AlarmStorageModified: Notification when a stored alarm has changed. The list of stored alarms can be read by using the IAlarmHandler2.GetAlarmsFromStorage method.

A filter can be set using the IAlarmFilterCriteria interface. The AlarmFilterCriteria function block implements the IAlarmFilterCriteria interface. In the example, the IAlarmManagerClient interface is implemented by the AlarmManagerClient function block.

The client is registered for AlarmManager in the PLC_PRG program.

The ProcessAlarms function writes the alarms to the console of the PLC.

System requirements and restrictions

Programming system

CODESYS Development System Version 3.5.18.0 or higher

Runtime system

CODESYS Control Win Versjon 3.5.18.0

Add-on components

CODESYS Visualization version 4.8.0.0 or higher

Note

_example_icon.png DOWNLOAD Project