> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/hvac-library/functionblocks/alarming/alarmcounter.md).

# AlarmCounter

## `AlarmCounter` (FB)

FUNCTION\_BLOCK AlarmCounter

### Kurzbeschreibung

> Auslesen der aktiven Alarme aus einer vorgegebenen Alarmgruppe oder einer Alarmklasse.\
> Typische Anwendung: Anzeige der Anzahl von aktiven Alarme.

### Darstellung

<figure><img src="https://879424349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-ab29ce90fb7504c18aac1777cfd8f16f02205283%2FAlarmCounter_FB.png?alt=media" alt=""><figcaption></figcaption></figure>

### Schnittstellen

#### Eingänge

| Name                  | Datentyp | Wertebereich | Initialwert | Funktion                                                                               |
| --------------------- | -------- | ------------ | ----------- | -------------------------------------------------------------------------------------- |
| *sFilterByAlarmGroup* | STRING   |              |             | Anzahl aktiver Alarme nur nach angegebener Alarm-Gruppe filtern. (Leer = Alle Gruppen) |
| *sFilterByAlarmClass* | STRING   |              |             | Anzahl aktiver Alarme nur nach angegebener Alarm-Klasse filtern. (Leer = Alle Klassen) |
| *xRetryRegistration*  | BOOL     |              |             | Registrierung des Alarm-Manager-Clients erneut versuchen                               |

#### Ausgänge

| Name                       | Datentyp               | Wertebereich | Initialwert | Funktion                                                   |
| -------------------------- | ---------------------- | ------------ | ----------- | ---------------------------------------------------------- |
| *uiTotalActiveAlarms*      | UINT                   |              |             | Anzahl aller aktiven Alarme ohne Filterkriterien           |
| *uiActiveAlarms*           | UINT                   |              |             | Anzahl aktiver Alarme im Zustand “Alarmbedingung ist wahr” |
| *uiActiveACK*              | UINT                   |              |             | Anzahl aktiver Alarme im Zustand “Warten auf quittieren”   |
| *uiWaitingForConfirmation* | UINT                   |              |             | Aktueller Status                                           |
| *eAlarmCounterState*       | eAlmAlarmCounterStates |              |             | Anzahl aktiver Alarme im Zustand “Warten auf Bestätigung”  |

#### Sollwerte / Parameter

| Name                          | Datentyp | Wertebereich | Initialwert | Funktion                                                                      |
| ----------------------------- | -------- | ------------ | ----------- | ----------------------------------------------------------------------------- |
| **usiMaxFailedRegistrations** | USINT    |              | 5           | Maximale Anzahl der Fehlversuche der Client-Registrierung für den Alarmzähler |

### Funktionsbeschreibung

#### Allgemeines

Dieser Funktionsbaustein dient zum Auslesen der Anzahl aktiver Alarme in unterschiedlichen Zuständen.\
Der Alarmzähler kann gefiltert werden nach einer Alarmgruppe oder einer Alarmklasse, so wie in gemeinsamer Kombination dieser beiden Optionen.\
Wird kein Filter der verfügbaren Filteroptionen angegeben, werden alle Alarme der jeweiligen Option beim Zähler beachtet.

Beispielkonfiguration 1:

* Die beiden Eingänge *sFilterByAlarmGroup* und *sFilterByAlarmClass* werden nicht angegeben.

Auswirkung der Beispielkonfiguration 1:

* Alle Alarme werden unabhängig von der Alarmklasse und Alarmgruppe beachtet.

Beispielkonfiguration 2:

* Der Eingang \*sFilterAlarmClass\* wird mit dem STRING “Alarm” belegt und der Eingang \*sFilterByAlarmGroup\* bleibt unbelegt.

Auswirkung der Beispielkonfiguration 2:

* Alle Alarme mit der Alarmklasse “Alarm” werden von allen Alarmgruppen angezeigt.

### CODESYS

InOut:

| Scope       | Name                        | Type                   | Initial |
| ----------- | --------------------------- | ---------------------- | ------- |
| Input       | `sFilterByAlarmGroup`       | `STRING`               |         |
| Input       | `sFilterByAlarmClass`       | `STRING`               |         |
| Input       | `xRetryRegistration`        | `BOOL`                 |         |
| Input Const | `usiMaxFailedRegistrations` | `USINT`                | 5       |
| Output      | `uiTotalActiveAlarms`       | `UINT`                 |         |
| Output      | `uiActiveAlarms`            | `UINT`                 |         |
| Output      | `uiActiveACK`               | `UINT`                 |         |
| Output      | `uiWaitingForConfirmation`  | `UINT`                 |         |
| Output      | `eAlarmCounterState`        | eAlmAlarmCounterStates |         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://support.powerio.com/hub/codesys-hvac/hvac-library/functionblocks/alarming/alarmcounter.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
