# ForecastOutsideTemp

## `ForecastOutsideTemp` (FB)

FUNCTION\_BLOCK ForecastOutsideTemp

### Short description

> > Forecast of the outside temperature (forecast period and function configurable)\
> > Prerequisite: FB 'WeatherForecast' from the Weather Forecast Library\
> > Constraint: The weather forecast data must be updated at least every 12 hours\
> > Index \_FC: External weather forecast data
>
> Index \_Int: Internal weather forecast data | Typical application: Calculation of the outside temperature for a heating/cooling curve

### Representation

<figure><img src="/files/49db51a70e79d9f41a896a86af321e4fa4211ef8" 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>Fallback 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 - fallback 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' of 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>

### Function description

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

\
The output eMode is updated accordingly.\
The output xError is set to FALSE.\
The output eFBPeriod\_Int is set to eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int is set to 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), provided the input 'xError\_FC' is FALSE and the internal error variable is also FALSE. The outputs eFBPeriod\_Int and eFBFunction\_Int adopt the current\
settings of the parameters ePeriod\_Int and eFBFunction\_Int.\
\
The output *rOutsideTemp\_Out* takes the state of the fallback value (*rOutsideTemp\_Out* = 'rOutsideTemp\_In) if the fallback value is error-free (xOutsideTempError\_In = FALSE).\
The output eFBPeriod\_Int is set to eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int is set to eForecastOutsideTempFunction.Ivalid\_Function\
\
The output *rOutsideTemp\_Out* takes the state of the fixed value\
(*rOutsideTemp\_Out* = 'rFixedValue) if the fallback value\
is faulty (xOutsideTempError\_In = TRUE).\
The output eFBPeriod\_Int is set to eForecastOutsideTempFunction.Ivalid\_Function.\
The output eFBFunction\_Int is set to eForecastOutsideTempFunction.Ivalid\_Function\
\
The output eMode is updated accordingly.\
The output xError is updated accordingly.

#### Updating the output *rOutsideTemp\_Out*

The output *rOutsideTemp\_Out* is updated (prerequisite: xEn = TRUE) if at least one of the following criteria is met:\
\
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 when 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 a time-accurate manner, i.e. all elements of the weather forecast data that lie between the time of update and the time of update + forecast range are used for the calculation.\
\
In the event of an internal data error (missing data, faulty data) the output *rOutsideTemp\_Out* is described with an internally defined constant\
(currently: -1000.0) and the state of the internal error variable is set to TRUE.

#### This function block can be applied as follows:

This function block can be applied as follows:

<figure><img src="/files/ef58d1401716a09590d15959e138ba1a57fdb222" 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)
  * Resetting all internal weather forecast data to invalid values \*\*\*
* mUpdateData\_Int (Method)


---

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