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

# ForecastOutsideTemp

## `ForecastOutsideTemp` (FB)

FUNCTION\_BLOCK ForecastOutsideTemp

### Short description

> > Prediction of outside temperature (forecast period and function adjustable)\
> > Prerequisite: FB ‘WeatherForecast’ from the Weather Forecast Library\
> > Boundary condition: The weather forecast data must be updated at least every 12 hours\
> > Index \_FC: weather forecast data external
>
> Index \_Int: weather forecast data internal | Typical application: calculation of the outside temperature of a heating/cooling curve

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2FGLPjlqeiy58HtalvDv4W%2FForecastOutsideTemp.png?alt=media&amp;token=aa0dbdd8-07eb-408b-a54f-7decdb85b8ab" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

<table><thead><tr><th width="160">Name</th><th>Data type</th><th>Value range</th><th>Initial value</th><th>Function</th></tr></thead><tbody><tr><td><em>xEn</em></td><td>BOOL</td><td></td><td>FALSE</td><td>Enable - weather forecast (FALSE = Off, TRUE = On)</td></tr><tr><td>*rOutsideTemp_In’</td><td>REAL</td><td></td><td>-10.0</td><td>Substitute value for the outside temperature</td></tr><tr><td><em>xOutsideTempError_In</em></td><td>BOOL</td><td></td><td>FALSE</td><td>Error state - substitute value for the outside temperature (FALSE = no error, TRUE = error)</td></tr><tr><td><em>rFixedValue</em></td><td>REAL</td><td></td><td>0.0</td><td>Fixed value for the outside temperature</td></tr><tr><td><em>xError_FC</em></td><td>BOOL</td><td></td><td>FALSE</td><td>Error state - weather forecast data (FALSE = no error, TRUE = error)</td></tr><tr><td><em>xDone_FC</em></td><td>BOOL</td><td></td><td>FALSE</td><td>Signal after successful completion of the transfer of the weather forecast data (rising edge)</td></tr><tr><td><em>arData_FC</em></td><td>ARRAY[*] OF WEATHER_FORECAST.WeatherData</td><td></td><td></td><td>Array with the weather forecast data (output ‘aForecast’ from FB ‘WeatherForecast’)</td></tr></tbody></table>

#### Outputs

<table><thead><tr><th width="177">Name</th><th>Data type</th><th>Value range</th><th>Initial value</th><th>Function</th></tr></thead><tbody><tr><td>*eMode’</td><td>eForecastOutsideTempMode</td><td></td><td>eForecastOutsideTempMode.Invalid_Mode</td><td>Operating mode (0 = none, 1 = forecast, 2 = outside temperature, 3 = fixed value)</td></tr><tr><td>*eFBPeriod_Int’</td><td>eForecastOutsideTempPeriod</td><td></td><td>eForecastOutsideTempPeriod.Invaild_Period</td><td>Feedback - forecast range - internal weather forecast data (0 = none, 1 = 3 hours, 2 = 6 hours, 3 = 9 hours, 4 = 12 hours, 5 = 24 hours, 6 = 36 hours, 7 = 48 hours, 8 = 72 hours, 9 = 96 hours)</td></tr><tr><td>*eFBFunction_Int’</td><td>eForecastOutsideTempFunction</td><td></td><td>eForecastOutsideTempFunction.Ivalid_Function</td><td>Feedback - function - internal weather forecast data (0 = none, 1 = minimum value, 2 = maximum value, 3 = average value)</td></tr><tr><td>*rOutsideTemp_Out’</td><td>REAL</td><td></td><td></td><td>Calculated outside temperature</td></tr><tr><td><em>xError</em></td><td>BOOL</td><td></td><td>FALSE</td><td>Error state (FALSE = no error, TRUE = error)</td></tr></tbody></table>

#### Setpoints / Parameters

<table><thead><tr><th width="175">Name</th><th>Data type</th><th>Value range</th><th>Initial value</th><th>Function</th></tr></thead><tbody><tr><td>**eFBPeriod_Int’*</td><td>eForecastOutsideTempPeriod</td><td></td><td>eForecastOutsideTempPeriod.Time_24_Hours</td><td>Forecast range - internal weather forecast data (0 = none, 1 = 3 hours, 2 = 6 hours, 3 = 9 hours, 4 = 12 hours, 5 = 24 hours, 6 = 36 hours, 7 = 48 hours, 8 = 72 hours, 9 = 96 hours)</td></tr><tr><td>**eFBFunction_Int’*</td><td>eForecastOutsideTempFunction</td><td></td><td>eForecastOutsideTempFunction.Average</td><td>Function - internal weather forecast data (0 = none, 1 = minimum value, 2 = maximum value, 3 = average value)</td></tr></tbody></table>

### Functional description

The output rOutsideTemp\_Out is calculated / set depending on the state at input ‘xEn’:\
\
xEn = FALSE:\
\
The output rOutsideTemp\_Out assumes the state of the substitute value (rOutsideTemp\_Out = rOutsideTemp\_In) if the substitute value\
is error-free (xOutsideTempError\_In = FALSE).\
The output rOutsideTemp\_Out assumes the state of the fixed value (rOutsideTemp\_Out = rFixedValue) if the substitute value is faulty (xOutsideTempError\_In = TRUE).

\
The output eMode is updated accordingly.\
The output xError assumes the state FALSE.\
The output eFBPeriod\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function\
\
xEn = TRUE:\
\
The output *rOutsideTemp\_Out* is set based on the parameters ‘ePeriod\_Int’ (ePriodInt <> eForecastOutsideTempPeriod.Invalid\_Period) and\
‘eFunction\_Int’ (eFunctionInt <> eForecastOutsideTempFunction.Invalid\_Function) if input ‘xError\_FC’ takes the value FALSE and the internal error variable also takes the value FALSE. The outputs eFBPeriod\_Int and eFBFunction\_Int adopt the current\
setting values of parameters ePeriod\_Int and eFBFunction\_Int.\
\
The output *rOutsideTemp\_Out* takes on the state of the substitute value (*rOutsideTemp\_Out* = ‘rOutsideTemp\_In) if the substitute value is error-free (xOutsideTempError\_In = FALSE) is.\
The output eFBPeriod\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function\
\
The output *rOutsideTemp\_Out* takes on the state of the fixed value\
(*rOutsideTemp\_Out* = ‘rFixedValue) if the substitute value is faulty (xOutsideTempError\_In = TRUE) is.\
The output eFBPeriod\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int assumes the state eForecastOutsideTempFunction.Ivalid\_Function\
\
The output eMode is updated accordingly.\
The output xError is updated accordingly.

#### Update of the output *rOutsideTemp\_Out*

The output *rOutsideTemp\_Out* is updated (requirement: xEn = TRUE) if at least one of the following criteria applies:\
\
Criterion 1: Update of the weather forecast data (rising edge at input xDone\_FC)\
Criterion 2: Change of the start index\
Criterion 3: Change of the forecast range (parameter ePeriod\_Int)\
Criterion 4: Change of the function (parameter eFunction\_Int)\
Criterion 5: Rising edge at input xEn\
\
The start index changes if the current timestamp (= system time) reaches the timestamp of the next element of the weather forecast data.\
The output *rOutsideTemp\_Out* is therefore updated at least every 3 hours.\
The output *rOutsideTemp\_Out* is always calculated in time, i.e. all elements of the weather forecast data are used for the calculation,\
which lie between the time of the update and the time of the update + forecast range.\
\
In the event of an internal data error (missing data, faulty data), the output *rOutsideTemp\_Out* is assigned an internally defined constant\
(currently: -1000.0) and the state of the internal error variable is set to TRUE.

#### Typical application

This function block can be used as follows:

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-637dbec56846c15dd95e218297d93619e63fb8e7%2FForecastOutsideTemp_Bild_1.png?alt=media" alt=""><figcaption></figcaption></figure>

### CODESYS

InOut:

| Scope       | Name                   | Type                                               | Initial                                       |
| ----------- | ---------------------- | -------------------------------------------------- | --------------------------------------------- |
| Input       | `xEn`                  | `BOOL`                                             | TRUE                                          |
| Input       | `rOutsideTemp_In`      | `REAL`                                             |                                               |
| Input       | `xOutsideTempError_In` | `BOOL`                                             | FALSE                                         |
| Input       | `rFixedValue`          | `REAL`                                             | 0.0                                           |
| Input       | `xError_FC`            | `BOOL`                                             | FALSE                                         |
| Input       | `xDone_FC`             | `BOOL`                                             | FALSE                                         |
| Input       | `arData_FC`            | <p>POINTER TO<br>WEATHER\_FORECAST.WeatherData</p> |                                               |
| Output      | `eMode`                | eForecastOutsideTempMode                           | eForecastOutsideTempMode.Invalid\_Mode        |
| Output      | `eFBPeriod_Int`        | eForecastOutsideTempPeriod                         | eForecastOutsideTempPeriod.Invaild\_Period    |
| Output      | `eFBFunction_Int`      | eForecastOutsideTempFunction                       | eForecastOutsideTempFunction.Ivalid\_Function |
| Output      | `rOutsideTemp_Out`     | `REAL`                                             |                                               |
| Output      | `xError`               | `BOOL`                                             | FALSE                                         |
| Input Const | `eFunction_Int`        | eForecastOutsideTempFunction                       | eForecastOutsideTempFunction.Average          |
| Input Const | `ePeriod_Int`          | eForecastOutsideTempPeriod                         | eForecastOutsideTempPeriod.Time\_24\_Hours    |

Methods:

> mApplyFunction\_Int

> mCalculateOutsideTempOut\_Int

> mCalculateStartIndex\_Int

> mResetData\_Int

> mUpdateData\_Int

Structure:

* mApplyFunction\_Int (Method)
* mCalculateOutsideTempOut\_Int (Method)
* mCalculateStartIndex\_Int (Method)
* mResetData\_Int (Method)
  * Reset of all internal weather forecast data to invalid values \*\*\*
* mUpdateData\_Int (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/forecastoutsidetemp.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.
