> 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/numeric/averagech.md).

# AverageCh

## `AverageCh` (FB)

FUNCTION\_BLOCK AverageCh

### Kurzbeschreibung

> Bildung eines Mittelwerts aus bis zu sechs gewichteten numerischen Eingangsgrößen\
> Typische Anwendung: Bildung eines Raumtemperaturmittelwerts aus verschiedenen Fühlern

### Darstellung

<figure><img src="/files/XNEP4vQMbhPWAxx2pTtw" alt=""><figcaption></figcaption></figure>

### Schnittstellen

#### Eingänge

| Name   | Datentyp | Wertebereich | Initialwert | Funktion                     |
| ------ | -------- | ------------ | ----------- | ---------------------------- |
| *rIn1* | REAL     |              |             | Analogwerteingang 1          |
| *rIn2* | REAL     |              |             | Analogwerteingang 2          |
| *rIn3* | REAL     |              |             | Analogwerteingang 3          |
| *rIn4* | REAL     |              |             | Analogwerteingang 4          |
| *rIn5* | REAL     |              |             | Analogwerteingang 5          |
| *rIn6* | REAL     |              |             | Analogwerteingang 6          |
| *xEn1* | BOOL     |              |             | Freigabe Analogwerteingang 1 |
| *xEn2* | BOOL     |              |             | Freigabe Analogwerteingang 2 |
| *xEn3* | BOOL     |              |             | Freigabe Analogwerteingang 3 |
| *xEn4* | BOOL     |              |             | Freigabe Analogwerteingang 4 |
| *xEn5* | BOOL     |              |             | Freigabe Analogwerteingang 5 |
| *xEn6* | BOOL     |              |             | Freigabe Analogwerteingang 6 |

#### Ausgänge

| Name   | Datentyp | Wertebereich | Initialwert | Funktion      |
| ------ | -------- | ------------ | ----------- | ------------- |
| *rOut* | REAL     |              |             | Mittelwert    |
| *xErr* | BOOL     |              |             | Sammelstörung |

#### Sollwerte / Parameter

| Name          | Datentyp | Wertebereich | Initialwert | Funktion                         |
| ------------- | -------- | ------------ | ----------- | -------------------------------- |
| **iLoading6** | INT      |              | 10          | Gewichtung - Analogwerteingang 6 |
| **iLoading5** | INT      |              | 10          | Gewichtung - Analogwerteingang 5 |
| **iLoading4** | INT      |              | 10          | Gewichtung - Analogwerteingang 4 |
| **iLoading3** | INT      |              | 10          | Gewichtung - Analogwerteingang 3 |
| **iLoading2** | INT      |              | 10          | Gewichtung - Analogwerteingang 2 |
| **iLoading1** | INT      |              | 10          | Gewichtung - Analogwerteingang 1 |

### Funktionsbeschreibung

#### Mittelwert *rOut*

Der Mittelwert wird gebildet, in dem die Analogwerteingänge ***rInX*** mit ihrer individuellen Gewichtung **iLoadingX** multipliziert und anschließend alle Produkte aufaddiert werden (Divident).\
Die Summe der Gewichtungen wird durch die Addition der individuellen Gewichtungen gebildet (= Divisor).\
Der sich so ergebende Quotient steht abschließend als Mittelwert ***rOut*** zur Verfügung.\
\
Die individuelle Gewichtung eines Analogwerteingangs X hat stets den Wert 0.0, solange die Freigabe des Analogwerteingangs X *xEnX* gesperrt ist (= FALSE).\
Ist die Summe der Gewichtungen (Divisor) = Null, so wird am Ausgang ***rOut*** konstant der Wert 0.0 ausgegeben.\
\
Legende: X = 1 bis 6

#### Sammelstörung *xErr*

Die Sammelstörung ist aktiv (= TRUE), falls mindestens einer der Analogwerteingänge *rInX* gesperrt ist (*xEnX* = FALSE).\
In allen übrigen Fällen ist die Sammelstörung nicht aktiv (= FALSE).

### CODESYS

InOut:

| Scope       | Name        | Type   | Initial |
| ----------- | ----------- | ------ | ------- |
| Input       | `rIn1`      | `REAL` |         |
| Input       | `rIn2`      | `REAL` |         |
| Input       | `rIn3`      | `REAL` |         |
| Input       | `rIn4`      | `REAL` |         |
| Input       | `rIn5`      | `REAL` |         |
| Input       | `rIn6`      | `REAL` |         |
| Input       | `xEn1`      | `BOOL` |         |
| Input       | `xEn2`      | `BOOL` |         |
| Input       | `xEn3`      | `BOOL` |         |
| Input       | `xEn4`      | `BOOL` |         |
| Input       | `xEn5`      | `BOOL` |         |
| Input       | `xEn6`      | `BOOL` |         |
| Input Const | `iLoading6` | `INT`  | 10      |
| Input Const | `iLoading5` | `INT`  | 10      |
| Input Const | `iLoading4` | `INT`  | 10      |
| Input Const | `iLoading3` | `INT`  | 10      |
| Input Const | `iLoading2` | `INT`  | 10      |
| Input Const | `iLoading1` | `INT`  | 10      |
| Output      | `rOut`      | `REAL` |         |
| Output      | `xErr`      | `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 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/numeric/averagech.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.
