> 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/control/control2p.md).

# Control2P

## `Control2P` (FB)

FUNCTION\_BLOCK Control2P

### Short description

> 2-point controller with actual value / setpoint / enable and adjustable switching hysteresis\
> The action (inverted / direct) is also adjustable.

### Representation

<figure><img src="/files/66fc490d44f61ea50b40e154da027f63ac7e9e8b" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name  | Data type | Value range | Initial value | Function                                                                                                  |
| ----- | --------- | ----------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| *rX*  | REAL      |             |               | Analog measured value                                                                                     |
| *rW*  | REAL      |             |               | Analog setpoint                                                                                           |
| *xEn* | BOOL      |             |               | <p>\* <strong>FALSE:</strong><br>Controller locked<br>\* <strong>TRUE:</strong><br>Controller enabled</p> |

#### Outputs

| Name     | Data type | Value range | Initial value | Function                                               |
| -------- | --------- | ----------- | ------------- | ------------------------------------------------------ |
| *xY*     | BOOL      |             |               | Digital output signal                                  |
| *rDiff*  | REAL      |             |               | Control deviation (*rX* - *rW*)                        |
| *rOnAt*  | REAL      |             |               | Absolute switch-on point (*rW* + **rSwitchOnPoint**)   |
| *rOffAt* | REAL      |             |               | Absolute switch-off point (*rW* + **rSwitchOffPoint**) |

#### Setpoints / parameters

| Name                | Data type    | Value range | Initial value         | Function                                                        |
| ------------------- | ------------ | ----------- | --------------------- | --------------------------------------------------------------- |
| **rSwitchOffPoint** | REAL         |             | 0.5                   | Switch-off point relative to the setpoint *rW*                  |
| **rSwitchOnPoint**  | REAL         |             | -0.5                  | Switch-on point relative to the setpoint *rW*                   |
| **xOffCondition**   | BOOL         |             | FALSE                 | State of the output *xY* at *xEn* = 0                           |
| **xInitValue**      | BOOL         |             | FALSE                 | State of the output *xY* after a restart                        |
| **eAction**         | eControlMode |             | eControlMode.Inverted | Action of the controller (Inverted = Heating, Direct = Cooling) |
| **eManModeB**       | eManBin      |             | eManBin.Auto          | Operating mode for the digital output signal *xY*               |

### Function description

#### Enable input *xEn*

| *xEn* | Control process | *xY*                                                | *rDiff* | *rOnAt* | *rOffAt* | Notes                  |
| ----- | --------------- | --------------------------------------------------- | ------- | ------- | -------- | ---------------------- |
| TRUE  | TRUE            | X                                                   | X       | x       | x        | Enable of the control  |
| FALSE | FALSE           | **xOffCondition** (if **eManModeB** = eManBin.Auto) | X       | x       | x        | Locking of the control |

Legend: X = any

#### Digital output *xY*

The digital output *xY* is influenced by the enable input *xEn*, the control process and the manual override module.

| Control process | *xEn* | **eManModeB**  | *xY*              | Notes                                         |
| --------------- | ----- | -------------- | ----------------- | --------------------------------------------- |
| FALSE           | TRUE  | eManBin.Auto   | FALSE             | Automatic operation - control process = FALSE |
| TRUE            | TRUE  | eManBin.Auto   | TRUE              | Automatic operation - control process = TRUE  |
| X               | FALSE | eManBin.Auto   | **xOffCondition** | Automatic operation without enable            |
| X               | X     | eManBin.ManOff | FALSE             | Manual mode - Off                             |
| X               | X     | eManBin.ManOn  | TRUE              | Manual mode - On                              |

Legend: X = any

#### Control process

The controller can be operated in two different operating modes (**eAction** = eControlMode.Inverted or **eAction** = eControlMode.Direct).\
The following rules apply:

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

If in operating mode eControlMode.Inverted the **rSwitchOffPoint** the **rSwitchOnPoint**, then the **rSwitchOffPoint** is increased by 0.1 relative to the **rSwitchOnPoint** is decreased by 0.1.\
\
The output variables **rSwitchOnPoint** the **rSwitchOffPoint**, then the **rSwitchOffPoint** is increased by 0.1 relative to the **rSwitchOnPoint** ), absolute switch-on point *rDiff* (*rX* - *rW*) and absolute switch-off point *rOnAt* (*rW* + **rSwitchOnPoint**) are available regardless of the enable input *rOffAt* (*rW* + **rSwitchOffPoint**always available. *xEn* Automatic operation - Inverted On

| *xEn* | **eAction**           | *rDiff*               | *xY*  | Notes                                                                                                      |
| ----- | --------------------- | --------------------- | ----- | ---------------------------------------------------------------------------------------------------------- |
| TRUE  | eControlMode.Inverted | < **rSwitchOnPoint**  | TRUE  | Automatic operation - Inverted Off                                                                         |
| TRUE  | eControlMode.Inverted | > **rSwitchOffPoint** | FALSE | Automatic operation - Direct On                                                                            |
| TRUE  | eControlMode.Direct   | > **rSwitchOnPoint**  | TRUE  | Automatic operation - Direct Off                                                                           |
| TRUE  | eControlMode.Direct   | < **rSwitchOffPoint** | FALSE | <p>Legend: X = arbitrary<br>In summary, the control process can alternatively be described as follows:</p> |

Legend: X = arbitrary\
In summary, the control process can alternatively be described as follows:

| *xEn* | **eAction**           | *rX*         | *xY*  | Notes                                                                                                      |
| ----- | --------------------- | ------------ | ----- | ---------------------------------------------------------------------------------------------------------- |
| TRUE  | eControlMode.Inverted | < **rOnAt**  | TRUE  | Automatic operation - Inverted Off                                                                         |
| TRUE  | eControlMode.Inverted | > **rOffAt** | FALSE | Automatic operation - Direct On                                                                            |
| TRUE  | eControlMode.Direct   | > **rOnAt**  | TRUE  | Automatic operation - Direct Off                                                                           |
| TRUE  | eControlMode.Direct   | < **rOffAt** | FALSE | <p>Legend: X = arbitrary<br>In summary, the control process can alternatively be described as follows:</p> |

Legend: X = any

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

```
GET https://support.powerio.com/hub/codesys-hvac/en/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.
