> 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="/files/hmTpLiFzbBc3xGaytHbB" 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:

* &#x20;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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
