ForecastOutsideTemp
ForecastOutsideTemp (FB)
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

Interfaces
Inputs
xEn
BOOL
FALSE
Enable - Weather forecast (FALSE = Off, TRUE = On)
*rOutsideTemp_In’
REAL
-10.0
Fallback value for the outside temperature
xOutsideTempError_In
BOOL
FALSE
Error state - fallback value for the outside temperature (FALSE = no error, TRUE = error)
rFixedValue
REAL
0.0
Fixed value for the outside temperature
xError_FC
BOOL
FALSE
Error state - weather forecast data (FALSE = no error, TRUE = error)
xDone_FC
BOOL
FALSE
Signal after successful completion of the transfer of the weather forecast data (rising edge)
arData_FC
ARRAY[*] OF WEATHER_FORECAST.WeatherData
Array with the weather forecast data (output 'aForecast' of FB 'WeatherForecast')
Outputs
*eMode’
eForecastOutsideTempMode
eForecastOutsideTempMode.Invalid_Mode
Operating mode (0 = none, 1 = forecast, 2 = outside temperature, 3 = fixed value)
*eFBPeriod_Int’
eForecastOutsideTempPeriod
eForecastOutsideTempPeriod.Invaild_Period
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)
*eFBFunction_Int’
eForecastOutsideTempFunction
eForecastOutsideTempFunction.Ivalid_Function
Feedback - function - internal weather forecast data (0 = none, 1 = minimum value, 2 = maximum value, 3 = average value)
*rOutsideTemp_Out’
REAL
Calculated outside temperature
xError
BOOL
FALSE
Error state (FALSE = no error, TRUE = error)
Setpoints / parameters
**eFBPeriod_Int’*
eForecastOutsideTempPeriod
eForecastOutsideTempPeriod.Time_24_Hours
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)
**eFBFunction_Int’*
eForecastOutsideTempFunction
eForecastOutsideTempFunction.Average
Function - internal weather forecast data (0 = none, 1 = minimum value, 2 = maximum value, 3 = average value)
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:

CODESYS
InOut:
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
POINTER TO WEATHER_FORECAST.WeatherData
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)
Last updated

