> 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/en/hvac-library/functionblocks/alarming/alarmingbase.md). Agents can also search and read this documentation through its [MCP server](https://support.powerio.com/hub/~gitbook/mcp).

# AlarmingBase

## `AlarmingBase` (FB)

FUNCTION\_BLOCK AlarmingBase IMPLEMENTS IMacroInfoData

### Brief description

> Base function block (inheritance base) for all alarm function blocks in the HVAC Library: license check, language-dependent reading of alarm text and DeviceTag text from text lists, connection to macro information, and calculation of the effective alarm enable.

{% hint style="info" %}
`AlarmingBase` is hidden (`{attribute 'hide'}`) and is not instantiated directly, but is used through the derived function blocks `AlarmingAlarm`, `AlarmingError`, `AlarmingHandB`, `AlarmingHandN`, `AlarmingHint` and `AlarmingService` These call the base function block at the beginning of their body using `SUPER^()` .
{% endhint %}

### Interfaces

#### Inputs

| Name           | Data type    | Value range | Initial value | Function                                                                                                                                                                          |
| -------------- | ------------ | ----------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *itfMacroInfo* | `IMacroInfo` |             |               | Optional macro information source: provides the system designation (`sTitle_Line1_Line2`) as Prefix1 and the collective alarm disable *xAlarmOff*. 0 = alarm text without Prefix1 |

#### Inputs (CONSTANT)

| Name                  | Data type    | Value range | Initial value | Function                                                                                      |
| --------------------- | ------------ | ----------- | ------------- | --------------------------------------------------------------------------------------------- |
| *sTextIndexDeviceTag* | `STRING(16)` |             | `''`          | Text index (ID) of the DeviceTag text (Prefix2) in the text list; empty = no DeviceTag prefix |
| *sTextListDeviceTag*  | `STRING(64)` |             | `''`          | Name of the text list for the DeviceTag text; empty = `GV_Alarming.sTextList`                 |
| *sTextIndex*          | `STRING(16)` |             | `'0'`         | Text index (ID) of the alarm text in the text list                                            |
| *sTextList*           | `STRING(64)` |             | `''`          | Name of the text list for the alarm text; empty = `GV_Alarming.sTextList`                     |
| *xTextUpdate*         | `BOOL`       |             | FALSE         | Trigger an update of the alarm text; resets automatically                                     |
| *xAlarmEn*            | `BOOL`       |             | TRUE          | Enable alarm                                                                                  |

#### Outputs

| Name            | Data type | Function                                                                          |
| --------------- | --------- | --------------------------------------------------------------------------------- |
| *xDefaultText1* | `BOOL`    | TRUE if the default text was returned for the alarm text (language not found)     |
| *xDefaultText2* | `BOOL`    | TRUE if the default text was returned for the DeviceTag text (language not found) |

#### Properties (IMacroInfoData)

| Property  | Data type | Access | Function                                                                    |
| --------- | --------- | ------ | --------------------------------------------------------------------------- |
| *Alarm*   | `BOOL`    | GET    | Alarm state; base: FALSE, overridden in `AlarmingAlarm`                     |
| *Err*     | `BOOL`    | GET    | Fault state; base: FALSE, overridden in `AlarmingError`                     |
| *Manual*  | `BOOL`    | GET    | Manual control active; base: FALSE, overridden in `AlarmingHandB` / `HandN` |
| *Hint*    | `BOOL`    | GET    | Hint state; base: FALSE, overridden in `AlarmingHint`                       |
| *Service* | `BOOL`    | GET    | Service state; base: FALSE, overridden in `AlarmingService`                 |

#### Methods

| Method                                                 | Return value          | Description                                                                                        |
| ------------------------------------------------------ | --------------------- | -------------------------------------------------------------------------------------------------- |
| `mPrefix2Ex`                                           | `BOOL`                | Sets an extension text that is appended to the DeviceTag text (Prefix2), preceded by a space       |
| `UpdateAlarmText`                                      | `BOOL`                | Called by the macro info when text changes; rebuilds Prefix1 and the alarm texts                   |
| `mListAnmeldung`                                       | `BOOL`                | Hidden. Registers/unregisters as a slave with the macro info when *itfMacroInfo*                   |
| `ElementCompareTo`, `ElementEquals`, `ElementHashCode` | `INT`, `BOOL`, `LINT` | Interface `COL.IElement` (via `IMacroInfoData` inherited); no implementation in the base class     |
| `FB_Init`                                              | `BOOL`                | Hidden. Resets the initialization flags so that texts and prefixes are reread after initialization |

### Function description

#### License check

Without a valid license (`checkLicenseState()`), the function block exits immediately; the derived function blocks then do not register.

#### Macro info connection

Whenever *itfMacroInfo* changes, `mListAnmeldung` unregisters the function block from the previous macro info (`UnregisterSlave`) and registers it with the new one (`RegisterSlave`). The macro info collects the states of all registered function blocks through the properties *Alarm*, *Hint*, *Hand* and *Service* and calls their method when the text changes `UpdateAlarmText` .

If a macro info is connected:

* the system designation `MacroData^.sTitle_Line1_Line2` is adopted once (or after `UpdateAlarmText`) as Prefix1,
* the effective alarm enable is formed from `xAlarmEn AND NOT MacroData^.xAlarmOff`.

Without macro info, Prefix1 is omitted and the release corresponds to *xAlarmEn*.

#### Reading the texts

The texts are read on the first call and after each text update using `TLU.GetLanguageTextW` with the language from `GV_Alarming.sLanguage` as follows:

| Text       | Text list                                             | Index                 | Target       |
| ---------- | ----------------------------------------------------- | --------------------- | ------------ |
| alarm text | *sTextList*, empty → `GV_Alarming.sTextList`          | *sTextIndex*          | `_wsText`    |
| DeviceTag  | *sTextListDeviceTag*, empty → `GV_Alarming.sTextList` | *sTextIndexDeviceTag* | `_wsPrefix2` |

If *sTextIndexDeviceTag* is empty, Prefix2 remains empty. If an extension text was set via `mPrefix2Ex` it is appended to the DeviceTag text, preceded by a space.

*xDefaultText1* / *xDefaultText2* indicate that the text list has no entry for the configured language and that the default text was supplied.

#### Text update

A recalculation of the texts is triggered by:

* *xTextUpdate* (instance) or `GV_Alarming.xTextUpdate` (global) – *xTextUpdate* is reset automatically,
* `UpdateAlarmText` (called by the macro info),
* `mPrefix2Ex`,
* `FB_Init` (initialization, online change).

After rereading, the marker bit `_xAlarmTextUpdate` is set, which the derived function block passes as *xTextUpdate* to its internal `HVACAlarming`function block and then resets. This allows the alarm manager to apply the changed text.

{% hint style="info" %}
`GV_Alarming.xTextUpdate` is set by the instances **not** reset. The application must keep it set until all instances have been called once, and then reset it.
{% endhint %}

#### Error behavior

If a text cannot be read, an error message is substituted and the read operation is repeated in the next cycle:

| Text       | Error message                                                 |
| ---------- | ------------------------------------------------------------- |
| alarm text | `!!!!!! Alarm List Error (List?, Id?, Language? ) !!!!!!`     |
| DeviceTag  | `!!!!!! DeviceTag List Error (List?, Id?, Language? ) !!!!!!` |

### CODESYS

InOut:

| Scope          | Name                  | Type         | Initial |
| -------------- | --------------------- | ------------ | ------- |
| Input          | `itfMacroInfo`        | `IMacroInfo` |         |
| Input CONSTANT | `sTextIndexDeviceTag` | `STRING(16)` | `''`    |
| Input CONSTANT | `sTextListDeviceTag`  | `STRING(64)` | `''`    |
| Input CONSTANT | `sTextIndex`          | `STRING(16)` | `'0'`   |
| Input CONSTANT | `sTextList`           | `STRING(64)` | `''`    |
| Input CONSTANT | `xTextUpdate`         | `BOOL`       | FALSE   |
| Input CONSTANT | `xAlarmEn`            | `BOOL`       | TRUE    |
| Output         | `xDefaultText1`       | `BOOL`       |         |
| Output         | `xDefaultText2`       | `BOOL`       |         |
| Property       | `Alarm`               | `BOOL`       |         |
| Property       | `Err`                 | `BOOL`       |         |
| Property       | `Hand`                | `BOOL`       |         |
| Property       | `Hint`                | `BOOL`       |         |
| Property       | `Service`             | `BOOL`       |         |


---

# 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/en/hvac-library/functionblocks/alarming/alarmingbase.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.
