ForecastOutsideTemp
ForecastOutsideTemp (FB)
ForecastOutsideTemp (FB)FUNCTION_BLOCK ForecastOutsideTemp
Short description
Forecast of the 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

Interfaces
Inputs
xEn
BOOL
FALSE
Enable - Weather forecast (FALSE = Off, TRUE = On)
*rOutsideTemp_In’
REAL
-10.0
Substitute value for the outside temperature
xOutsideTempError_In
BOOL
FALSE
Error state - substitute 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 at the 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 the input 'xError_FC' is FALSE and the internal error variable is also FALSE. The outputs *eFBPeriod_Int' and *eFBFunction_Int' take the current settings of the parameters *ePeriod_Int' and *eFBFunction_Int'. The output rOutsideTemp_Out takes the state of the substitute value ( rOutsideTemp_Out = 'rOutsideTemp_In') if the substitute value is error-free ('xOutsideTempError_In' = FALSE). 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 the state of the fixed value ( rOutsideTemp_Out = 'rFixedValue') if the substitute value is faulty ('xOutsideTempError_In' = TRUE). 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.
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 the 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 the 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 time-correctly, i.e. all elements of the weather forecast data are used for the calculation that 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 described with 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 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

