> 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/components/heatpumpgasboilerselection.md).

# HeatpumpGasboilerSelection

## `HeatpumpGasboilerSelection` (FB)

FUNCTION\_BLOCK HeatpumpGasboilerSelection

### Short description

Release of the gas boiler or the heat pump depending on various influencing factors.\
Influencing factors:

1. Current COP value of the heat pump
2. Costs for electrical energy (heat pump) in euros per kWh
3. Costs for natural gas purchase (gas boiler) in euros per kWh
4. Efficiency of the heat pump (0.0 - 1.0)
5. Efficiency of the gas boiler (0.0 - 1.0)

The preset values of the internal characteristic curve correspond to the COP characteristic curve W35 heating case of the WP Remeha E-HP AW 84.\
\
Typical application: Decision on releasing the gas boiler or the heat pump depending on the operating situation

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2FBjUH8aDicq1X0Xtv83pH%2FHeatpumpGasboilerSelection.png?alt=media&amp;token=3d11049c-bb1a-47d7-b356-a4eb14defe1b" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name             | Data type                              | Value range | Initial value                                          | Function                                                                                               |
| ---------------- | -------------------------------------- | ----------- | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| *xEn*            | BOOL                                   |             | TRUE                                                   | Release / locking of the function block (TRUE = release)                                               |
| *eCOPSource*     | eHeatpumpGasboilerSelection\_COPSource |             | eHeatpumpGasboilerSelection\_COPSource.Internal\_Curve | Selection of the COP source (Internal\_Curve, External\_Input)                                         |
| *rSourceTempCOP* | REAL                                   |             | 2.0                                                    | Current temperature of the heat source for the heat pump (air-to-water heat pump: outdoor temperature) |
| *rExtCOP*        | REAL                                   |             | 4.0                                                    | External value of the 'Coefficient of Performance' (COP) of the heat pump (typical: 2.0 - 7.0)         |
| *xExtError*      | BOOL                                   |             | FALSE                                                  | External error state (FALSE = no error, TRUE = error)                                                  |
| *xExtValidData*  | BOOL                                   |             | FALSE                                                  | External input for the validity of the characteristic curve data (n) (FALSE = invalid)                 |

#### Outputs

| Name                          | Data type | Value range | Initial value | Function                                                                                         |
| ----------------------------- | --------- | ----------- | ------------- | ------------------------------------------------------------------------------------------------ |
| *tRemainingTimeTestIntervall* | TIME      |             | T#0s          | Remaining time until the next test time                                                          |
| *rCOPLimit*                   | REAL      |             | 0.0           | Limit value of the COP for releasing the heat pump (rCOP >= rCOPLimit: release of the heat pump) |
| *rCOP*                        | REAL      |             | 0.0           | Current value of the 'Coefficient of Performance' (COP) of the heat pump (typical: 2.0 - 7.0)    |
| *xCmdGasboiler*               | BOOL      |             | FALSE         | Release / locking of the gas boiler (TRUE = release)                                             |
| *xCmdHeatpump*                | BOOL      |             | FALSE         | Release / locking of the heat pump (TRUE = release)                                              |
| *xError*                      | BOOL      |             | FALSE         | Error state (FALSE = no error, TRUE = error)                                                     |

#### Setpoints / Parameters

| Name                      | Data type | Value range | Initial value | Function                                                        |
| ------------------------- | --------- | ----------- | ------------- | --------------------------------------------------------------- |
| **rEfficiencyGasboiler**  | REAL      |             | 0.9           | Overall efficiency of heat generation with the gas boiler       |
| **rEfficiencyHeatpump**   | REAL      |             | 0.9           | Overall efficiency of heat generation with the heat pump        |
| **rEnergyPriceGasboiler** | REAL      |             | 0.20          | Energy costs - gas (in euros / kWh of generated thermal energy) |
| **rEnergyPriceHeatpump**  | REAL      |             | 0.45          | Energy costs - electricity (in euros / kWh)                     |
| **tTimeTestIntervall**    | TIME      |             | T#30M         | Duration of the test interval                                   |
| **rCOP\_Subst**           | REAL      |             | 3.5           | Substitute value for the COP in case of error                   |
| **rCOP\_Min**             | REAL      |             | 1.0           | Absolute minimum value of the COP                               |
| **rCOP\_Max**             | REAL      |             | 10.0          | Absolute maximum value of the COP                               |
| **rSP1\_X**               | REAL      |             | 1.0           | Support point 1 - X value                                       |
| **rSP1\_Y**               | REAL      |             | 2.0           | Support point 1 - Y value                                       |
| **rSP2\_X**               | REAL      |             | 2.0           | Support point 2 - X value                                       |
| **rSP2\_Y**               | REAL      |             | 4.0           | Support point 2 - Y value                                       |
| **rSP3\_X**               | REAL      |             | 3.0           | Support point 3 - X value                                       |
| **rSP3\_Y**               | REAL      |             | 6.0           | Support point 3 - Y value                                       |
| **rSP4\_X**               | REAL      |             | 4.0           | Support point 4 - X value                                       |
| **rSP4\_Y**               | REAL      |             | 8.0           | Support point 4 - Y value                                       |
| **rSP5\_X**               | REAL      |             | 5.0           | Support point 5 - X value                                       |
| **rSP5\_Y**               | REAL      |             | 10.0          | Support point 5 - Y value                                       |
| **rSP6\_X**               | REAL      |             | 6.0           | Support point 6 - X value                                       |
| **rSP6\_Y**               | REAL      |             | 12.0          | Support point 6 - Y value                                       |
| **rSP7\_X**               | REAL      |             | 7.0           | Support point 7 - X value                                       |
| **rSP7\_Y**               | REAL      |             | 14.0          | Support point 7 - Y value                                       |
| **rSP8\_X**               | REAL      |             | 8.0           | Support point 8 - X value                                       |
| **rSP8\_Y**               | REAL      |             | 16.0          | Support point 8 - Y value                                       |
| **rSP9\_X**               | REAL      |             | 9.0           | Support point 9 - X value                                       |
| **rSP9\_Y**               | REAL      |             | 18.0          | Support point 9 - Y value                                       |
| **rSP10\_X**              | REAL      |             | 10.0          | Support point 10 - X value                                      |
| **rSP10\_Y**              | REAL      |             | 20.0          | Support point 10 - Y value                                      |

### Functional description

\
The release of the heat generators gas boiler or heat pump is based on a calculation taking into account the following influencing factors:\
\
1\) Current COP value of the heat pump\
2\) Costs for electrical energy (heat pump) in euros per kWh\
3\) Costs for natural gas purchase (gas boiler) in euros per kWh\
4\) Efficiency of the heat pump (0.0 - 1.0)\
5\) Efficiency of the gas boiler (0.0 - 1.0)\
\
Only one heat generator is ever enabled; the other is automatically locked.\
\
This calculation is performed (condition: xEn = TRUE) if at least one of the following situations applies:\
\
1\) Cyclically in the interval tTimeTestIntervall\
2\) Once on a rising edge at input xEn\
3\) Once after each restart\
4\) Once whenever the selection of the COP source eCOPSource changes\
\
The COP value of the heat pump can be determined by an internally stored characteristic curve with 10 pairs of values (eCOPSource = Internal\_Curve, temperature of the heat source rSourceTempCOP) or\
the external input rExtCOP (eCOPSource = External\_Input, xExtError = FALSE, xExtValidData = TRUE). It is limited by the absolute limits **rCOP\_Min** or\
**rCOP\_Max** and, when error-free, output at rCOP and used for the calculation.\
In case of an error (eCOPSource = Internal\_Curve: error in entering the pairs of values) or (eCOPSource = External\_Input: xExtError = TRUE or xExtValidData = FALSE), the substitute value **rCOP\_Subst** is used.\
\
The X values of the 10 support points of the internal COP characteristic curve must satisfy the following conditions:\
\
1\) The X values must be continuously either strictly ascending or strictly descending\
2\) Each X value may occur only once\
3\) Two adjacent support points are connected by a straight line each\
\
At the output tRemainingTimeTestIntervall, the remaining time until the next cyclic calculation is available.\
At the output rCOPLimit, the limit value for switching to the gas boiler is available (rCOP < rCOPLimit: release of the gas boiler)\
\
When locked (xEn = FALSE), the outputs assume sensible, constant values; no further calculation takes place.\
\
At the output \*xError\* the current error state is available (xError = TRUE: error active). It is active if either the internal COP characteristic curve is faulty or the external error input xExtError is active (= TRUE).

### CODESYS

InOut:

| Scope       | Name                          | Type                                   | Initial                                                |
| ----------- | ----------------------------- | -------------------------------------- | ------------------------------------------------------ |
| Input       | `xEn`                         | `BOOL`                                 | TRUE                                                   |
| Input       | `eCOPSource`                  | eHeatpumpGasboilerSelection\_COPSource | eHeatpumpGasboilerSelection\_COPSource.Internal\_Curve |
| Input       | `rSourceTempCOP`              | `REAL`                                 | 2.0                                                    |
| Input       | `rExtCOP`                     | `REAL`                                 | 4.0                                                    |
| Input       | `xExtError`                   | `BOOL`                                 | FALSE                                                  |
| Input       | `xExtValidData`               | `BOOL`                                 | FALSE                                                  |
| Output      | `tRemainingTimeTestIntervall` | `TIME`                                 | TIME#0ms                                               |
| Output      | `rCOPLimit`                   | `REAL`                                 | 0.0                                                    |
| Output      | `rCOP`                        | `REAL`                                 | 0.0                                                    |
| Output      | `xCmdGasboiler`               | `BOOL`                                 | FALSE                                                  |
| Output      | `xCmdHeatpump`                | `BOOL`                                 | FALSE                                                  |
| Output      | `xError`                      | `BOOL`                                 | FALSE                                                  |
| Input Const | `rSP10_Y`                     | `REAL`                                 | 6.8                                                    |
| Input Const | `rSP10_X`                     | `REAL`                                 | 20.0                                                   |
| Input Const | `rSP9_Y`                      | `REAL`                                 | 5.85                                                   |
| Input Const | `rSP9_X`                      | `REAL`                                 | 16.1                                                   |
| Input Const | `rSP8_Y`                      | `REAL`                                 | 5.25                                                   |
| Input Const | `rSP8_X`                      | `REAL`                                 | 12.2                                                   |
| Input Const | `rSP7_Y`                      | `REAL`                                 | 4.65                                                   |
| Input Const | `rSP7_X`                      | `REAL`                                 | 8.3                                                    |
| Input Const | `rSP6_Y`                      | `REAL`                                 | 4.2                                                    |
| Input Const | `rSP6_X`                      | `REAL`                                 | 4.4                                                    |
| Input Const | `rSP5_Y`                      | `REAL`                                 | 3.7                                                    |
| Input Const | `rSP5_X`                      | `REAL`                                 | 0.5                                                    |
| Input Const | `rSP4_Y`                      | `REAL`                                 | 3.35                                                   |
| Input Const | `rSP4_X`                      | `REAL`                                 | -3.3                                                   |
| Input Const | `rSP3_Y`                      | `REAL`                                 | 3.1                                                    |
| Input Const | `rSP3_X`                      | `REAL`                                 | -7.2                                                   |
| Input Const | `rSP2_Y`                      | `REAL`                                 | 2.95                                                   |
| Input Const | `rSP2_X`                      | `REAL`                                 | -11.1                                                  |
| Input Const | `rSP1_Y`                      | `REAL`                                 | 2.8                                                    |
| Input Const | `rSP1_X`                      | `REAL`                                 | -15.0                                                  |
| Input Const | `rCOP_Max`                    | `REAL`                                 | 10.0                                                   |
| Input Const | `rCOP_Min`                    | `REAL`                                 | 1.0                                                    |
| Input Const | `rCOP_Subst`                  | `REAL`                                 | 3.5                                                    |
| Input Const | `tTimeTestIntervall`          | `TIME`                                 | TIME#30m0s0ms                                          |
| Input Const | `rEnergyPriceHeatpump`        | `REAL`                                 | 0.45                                                   |
| Input Const | `rEnergyPriceGasboiler`       | `REAL`                                 | 0.2                                                    |
| Input Const | `rEfficiencyHeatpump`         | `REAL`                                 | 0.9                                                    |
| Input Const | `rEfficiencyGasboiler`        | `REAL`                                 | 0.9                                                    |

Methods:

> mCalculateCurveSectionValue\_Real\_Real

> mCalculateCurveValue\_Real\_Real

Structure:

* mCalculateCurveSectionValue\_Real\_Real (Method)
* mCalculateCurveValue\_Real\_Real (Method)


---

# 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/components/heatpumpgasboilerselection.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.
