# Control2P

## `Control2P` (FB)

FUNCTION\_BLOCK Control2P

### Kurzbeschreibung

> 2-Punkt-Regler mit Istwert / Sollwert / Freigabe und einstellbarer Schalthysterese\
> Der Wirksinn (invertiert / direkt) ist ebenfalls einstellbar.

### Darstellung

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

### Schnittstellen

#### Eingänge

| Name  | Datentyp | Wertebereich | Initialwert | Funktion                                                                                                |
| ----- | -------- | ------------ | ----------- | ------------------------------------------------------------------------------------------------------- |
| *rX*  | REAL     |              |             | Analoger Istwert                                                                                        |
| *rW*  | REAL     |              |             | Analoger Sollwert                                                                                       |
| *xEn* | BOOL     |              |             | <p>\* <strong>FALSE:</strong><br>Regler gesperrt<br>\* <strong>TRUE:</strong><br>Regler freigegeben</p> |

#### Ausgänge

| Name     | Datentyp | Wertebereich | Initialwert | Funktion                                              |
| -------- | -------- | ------------ | ----------- | ----------------------------------------------------- |
| *xY*     | BOOL     |              |             | Digitales Ausgangssignal                              |
| *rDiff*  | REAL     |              |             | Regelabweichung (*rX* - *rW*)                         |
| *rOnAt*  | REAL     |              |             | Absoluter Einschaltpunkt (*rW* + **rSwitchOnPoint**)  |
| *rOffAt* | REAL     |              |             | Absoluter Ausschaltpunkt (*rW* + **rSwitchOffPoint**) |

#### Sollwerte / Parameter

| Name                | Datentyp     | Wertebereich | Initialwert           | Funktion                                                     |
| ------------------- | ------------ | ------------ | --------------------- | ------------------------------------------------------------ |
| **rSwitchOffPoint** | REAL         |              | 0.5                   | Ausschaltpunkt relativ zum Sollwert *rW*                     |
| **rSwitchOnPoint**  | REAL         |              | -0.5                  | Einschaltpunkt relativ zum Sollwert *rW*                     |
| **xOffCondition**   | BOOL         |              | FALSE                 | Zustand vom Ausgang *xY* bei *xEn* = 0                       |
| **xInitValue**      | BOOL         |              | FALSE                 | Zustand vom Ausgang *xY* nach einem Neustart                 |
| **eAction**         | eControlMode |              | eControlMode.Inverted | Wirksinnn des Reglers (Invertiert = Heizen, Direkt = Kühlen) |
| **eManModeB**       | eManBin      |              | eManBin.Auto          | Betriebsart für das digitale Ausgangssignal *xY*             |

### Funktionsbeschreibung

#### Freigabe-Eingang *xEn*

| *xEn* | Regelprozess | *xY*                                                   | *rDiff* | *rOnAt* | *rOffAt* | Hinweise              |
| ----- | ------------ | ------------------------------------------------------ | ------- | ------- | -------- | --------------------- |
| TRUE  | TRUE         | X                                                      | X       | x       | x        | Freigabe der Regelung |
| FALSE | FALSE        | **xOffCondition** (falls **eManModeB** = eManBin.Auto) | X       | x       | x        | Sperrung der Regelung |

Legende: X = beliebig

#### Digital-Ausgang *xY*

Der digitale Ausgang *xY* wird durch den Freigabe-Eingang *xEn*, den Regelprozess und das Handübersteuermodul beeinflusst.

| Regelprozess | *xEn* | **eManModeB**  | *xY*              | Hinweise                                |
| ------------ | ----- | -------------- | ----------------- | --------------------------------------- |
| FALSE        | TRUE  | eManBin.Auto   | FALSE             | Automatikbetrieb - Regelprozess = FALSE |
| TRUE         | TRUE  | eManBin.Auto   | TRUE              | Automatikbetrieb - Regelprozess = TRUE  |
| X            | FALSE | eManBin.Auto   | **xOffCondition** | Automatikbetrieb ohne Freigabe          |
| X            | X     | eManBin.ManOff | FALSE             | Handbetrieb - Aus                       |
| X            | X     | eManBin.ManOn  | TRUE              | Handbetrieb - Ein                       |

Legende: X = beliebig

#### Regelprozess

Der Regler kann in zwei unterschiedlichen Betriebsarten (**eAction** = eControlMode.Inverted oder **eAction** = eControlMode.Direct) betrieben werden.\
Dabei gelten folgende Regeln:

| **eAction**           | Regel                                    |
| --------------------- | ---------------------------------------- |
| eControlMode.Inverted | **rSwitchOnPoint** < **rSwitchOffPoint** |
| eControlMode.Direct   | **rSwitchOnPoint** > **rSwitchOffPoint** |

Unterschreitet in der Betriebsart eControlMode.Inverted der **rSwitchOffPoint** den **rSwitchOnPoint**, so wird der **rSwitchOffPoint** gegenüber dem **rSwitchOnPoint** um 0.1 überhöht.\
Unterschreitet in der Betriebsart eControlMode.Inverted der **rSwitchOnPoint** den **rSwitchOffPoint**, so wird der **rSwitchOffPoint** gegenüber dem **rSwitchOnPoint** um 0.1 verringert.\
\
Die Ausgangsgrößen *rDiff* (*rX* - *rW*), absoluter Einschaltpunkt *rOnAt* (*rW* + **rSwitchOnPoint**) und absoluter Ausschaltpunkt *rOffAt* (*rW* + **rSwitchOffPoint**) stehen unabhängig vom Freigabe-Eingang *xEn* immer zu Verfügung.

| *xEn* | **eAction**           | *rDiff*               | *xY*  | Hinweise                          |
| ----- | --------------------- | --------------------- | ----- | --------------------------------- |
| TRUE  | eControlMode.Inverted | < **rSwitchOnPoint**  | TRUE  | Automatikbetrieb - Invertiert Ein |
| TRUE  | eControlMode.Inverted | > **rSwitchOffPoint** | FALSE | Automatikbetrieb - Invertiert Aus |
| TRUE  | eControlMode.Direct   | > **rSwitchOnPoint**  | TRUE  | Automatikbetrieb - Direkt Ein     |
| TRUE  | eControlMode.Direct   | < **rSwitchOffPoint** | FALSE | Automatikbetrieb - Direkt Aus     |

Legende: X = beliebig\
Zusammengefasst läßt sich der Regelprozess alternativ wie folgt beschreiben:

| *xEn* | **eAction**           | *rX*         | *xY*  | Hinweise                          |
| ----- | --------------------- | ------------ | ----- | --------------------------------- |
| TRUE  | eControlMode.Inverted | < **rOnAt**  | TRUE  | Automatikbetrieb - Invertiert Ein |
| TRUE  | eControlMode.Inverted | > **rOffAt** | FALSE | Automatikbetrieb - Invertiert Aus |
| TRUE  | eControlMode.Direct   | > **rOnAt**  | TRUE  | Automatikbetrieb - Direkt Ein     |
| TRUE  | eControlMode.Direct   | < **rOffAt** | FALSE | Automatikbetrieb - Direkt Aus     |

Legende: X = beliebig

### CODESYS

InOut:

| Scope       | Name              | Type         | Initial               |
| ----------- | ----------------- | ------------ | --------------------- |
| Input       | `rX`              | `REAL`       |                       |
| Input       | `rW`              | `REAL`       |                       |
| Input       | `xEn`             | `BOOL`       |                       |
| Input Const | `rSwitchOffPoint` | `REAL`       | 0.5                   |
| Input Const | `rSwitchOnPoint`  | `REAL`       | -0.5                  |
| Input Const | `xOffCondition`   | `BOOL`       | FALSE                 |
| Input Const | `xInitValue`      | `BOOL`       | FALSE                 |
| Input Const | `eAction`         | eControlMode | eControlMode.Inverted |
| Input Const | `eManModeB`       | eManBin      | eManBin.Auto          |
| Output      | `xY`              | `BOOL`       |                       |
| Output      | `rDiff`           | `REAL`       |                       |
| Output      | `rOnAt`           | `REAL`       |                       |
| Output      | `rOffAt`          | `REAL`       |                       |


---

# Agent Instructions: 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:

```
GET https://support.powerio.com/hub/codesys-hvac/hvac-library/functionblocks/control/control2p.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
