# SetPointCorrection

## `SetPointCorrection` (FB)

FUNCTION\_BLOCK SetPointCorrection

### Short description

> Generation of a setpoint temperature depending on the room deviation\
> Principle: Linear offset\
> Typical application: Adjustment of a supply setpoint temperature

### Representation

<figure><img src="/files/4be169f379bc39887456f4dac8709126c8299660" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name            | Data type | Value range | Initial value | Function                                       |
| --------------- | --------- | ----------- | ------------- | ---------------------------------------------- |
| *rSupplyTempIn* | REAL      |             | 0             | Supply setpoint temperature from heating curve |
| *rSetPointRoom* | REAL      |             | 0             | Room setpoint temperature                      |
| *rRoomTemp*     | REAL      |             | 0             | Current room temperature                       |

#### Outputs

| Name             | Data type | Value range | Initial value | Function                                                                                      |
| ---------------- | --------- | ----------- | ------------- | --------------------------------------------------------------------------------------------- |
| *rSupplyTempOut* | REAL      |             |               | corrected supply setpoint temperature                                                         |
| *xMax*           | BOOL      |             |               | Exceeding the maximum difference of the room temperature. (FALSE = not active, TRUE = active) |
| *rCorrection*    | REAL      |             |               | Display of the current correction                                                             |
| *xAuto*          | BOOL      |             |               | Manual-Auto override indicator: (FALSE = Manual, TRUE = Auto)                                 |
| *tDelay*         | TIME      |             |               | Display of switch-back delay after exceedance                                                 |

#### Setpoints / parameters

| Name          | Data type | Value range               | Initial value | Function                                                                                      |
| ------------- | --------- | ------------------------- | ------------- | --------------------------------------------------------------------------------------------- |
| **tAlaTime**  | TIME      |                           | 120           | Restart time of the correction after the alarm begins.                                        |
| **rAlaLevel** | REAL      |                           | 5.0           | Temperature deviation for alarm condition. In this state the correction is no longer applied. |
| **rCorNeg**   | REAL      | <= 0                      | -2.0          | Maximum negative correction.                                                                  |
| **rCorPos**   | REAL      | >= 0                      | 2.0           | Maximum positive correction.                                                                  |
| **rFactor**   | REAL      |                           | 1.0           | Correction of the setpoint per degree deviation of the room temperature.                      |
| **rManValue** | REAL      |                           | 0.0           | Manual override: manual value                                                                 |
| **eManModeN** | eMANNUM   | eMANNUM.Auto, eMANNUM.Man |               | Manual override: operating mode                                                               |

### Function description

#### General

The correction is applied proportionally between the room setpoint rSetPointRoom and the room temperature measurement rRoomTemp.\
The deviation is multiplied by the adjustable correction factor.\
This correction is applied to the supply setpoint rSetPointIn. The corrected setpoint is available at the output rSetpointOut.\
Maximum and minimum values can be freely parameterized for the correction.\
If the correction reaches the configured alarm level, it is considered a significant disturbance of the heated room\
and the setpoint is no longer corrected (e.g. window open). In this case the correction is disabled (rCorrection=0, rSetpointOut=W)\
and the binary output xMax is set to 1. After the configured restart time, the function attempts to reactivate the correction.\
If the correction is reactivated, the binary signal xMax resets to 0.\
The applied correction can be continuously observed at the output rCorrection.

#### Diagram

W = rSupplyTempIn (supply setpoint temperature from heating curve)\
Wi = rSetPointRoom (room setpoint temperature)\
Ti = rRoomTemp (current room temperature)\
Wc = rSupplyTempOut (corrected supply setpoint temperature)\
Max = xMax (Exceeding the maximum difference of the room temperature. (FALSE = not active, TRUE = active))

<figure><img src="/files/112db7f2039f532c3f5c0c68d9f0881acdd8375e" alt=""><figcaption></figcaption></figure>

### CODESYS

InOut:

| Scope       | Name             | Type    | Initial      |
| ----------- | ---------------- | ------- | ------------ |
| Input       | `rSupplyTempIn`  | `REAL`  | 0            |
| Input       | `rSetPointRoom`  | `REAL`  | 0            |
| Input       | `rRoomTemp`      | `REAL`  | 0            |
| Input Const | `tMaxTime`       | `TIME`  | TIME#2m0s0ms |
| Input Const | `rMaxLevel`      | `REAL`  | 5            |
| Input Const | `rCorNeg`        | `REAL`  | -2           |
| Input Const | `rCorPos`        | `REAL`  | 2            |
| Input Const | `rFactor`        | `REAL`  | 1            |
| Input Const | `rManValue`      | `REAL`  | 0            |
| Input Const | `eManModeN`      | eManNum | eManNum.Auto |
| Output      | `rSupplyTempOut` | `REAL`  |              |
| Output      | `xMax`           | `BOOL`  |              |
| Output      | `rCorrection`    | `REAL`  |              |
| Output      | `xAuto`          | `BOOL`  |              |
| Output      | `tDelay`         | `TIME`  |              |


---

# 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/en/hvac-library/functionblocks/setpoint/setpointcorrection.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.
