FB_HVACTemperatureSensor

This function block serves the acquisition and further processing of temperature values for sensor types PT100, PT200, PT1000, NI100, NI120 and NI1000. The function block FB_HVACTemperatureSensor is matched to the KL320x bus terminals. These Bus Terminals can either be ordered preconfigured or set to the corresponding sensor types in the software.
VAR_INPUT
eDataSecurityType : E_HVACDataSecurityType;
bSetDefault : BOOL;
iRawValue : INT;
byStatusRawValue : BYTE;
tTaskCycleTime : TIME;
tCtrlCycleTime : TIME;
bEnableLimitCtrl : BOOL;
bReset : BOOL;
eDataSecurityType: If eDataSecurityType:= eHVACDataSecurityType_Persistent, the persistent VAR_IN_OUT variables of the function block are stored in the flash of the computer if a value changes. For this to work, the function block FB_HVACPersistentDataHandling must be instanced once in the main program, which is called cyclically. Otherwise the instanced FB is not released internally.
A change of value can be initiated by the building management system, a local operating device or via a write access from TwinCAT. When the computer is restarted the saved data are automatically read back from the flash into the RAM.
Application example: example_persistent.zip
If eDataSecurityType:= eHVACDataSecurityType_Idle the persistently declared variables are not saved in a fail-safe manner.
Notice | |
A cyclically changing variable must never be linked with the IN_OUT variable of a function block, if eDataSecurityType:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory. |
bSetDefault: If the variable is TRUE, the default values of the VAR_IN_OUT variables are adopted.
iRawValue: Raw value of the temperature sensor in 1/10°C from the bus terminal
byStatusRawValue: Status byte of the temperature sensor from the bus terminal. Serves for fault diagnosis, e.g. wire breakage or short circuit.
tTaskCycleTime: Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the cycle time of the calling task. tTaskCycleTime must be longer than T#0ms.
tCtrlCycleTime: The variable tCtrlCycleTime specifies the cycle time with which the 2nd order filter is processed internally. The cycle time tCtrlCycleTime must be greater than or equal to tTaskCycleTime. If this is not the case, an error bErrorCycleTime occurs and either the replacement value rReplacementValue or the last valid measured value will be output at rPresentValue, depending on the mode eTemperatureSensorMode that is set.
bEnableLimitCtrl: Enables rHighLimit and rLowLimit for limit monitoring
bReset: Acknowledge input in the event of an error. In addition the 2nd order filter can be synchronized via this input to the present measuring signal, so that this can be output at rPresentValue.
VAR_OUTPUT
rPresentValue : REAL;
bErrorGeneral : BOOL;
byError : BYTE;
bErrorShortCircuit : BOOL;
bErrorBrokenSensor : BOOL;
bErrorHighLimit : BOOL;
bErrorLowLimit : BOOL;
bErrorCycleTime : BOOL;
bInvalidParameter : BOOL;
rPresentValue: Temperature output variable with one decimal place, rPresentValue = (iRawValue / 10.0) + rOffset, if bErrorShortCircuit or bErrorBrokenSensor = TRUE, then rPresentValue depends on the operation mode eTemperatureSensorMode.
bErrorGeneral: The error message bErrorGeneral becomes TRUE as soon as one of the error messages bErrorHighLimit, bErrorLowLimit, bErrorCycleTime, bErrorShortCircuit or bErrorBrokenSensor = TRUE. The value of the output variable rPresentValue is then dependent on the operation mode eTemperatureSensorMode and is enabled once the error has been rectified and, depending on the operation mode, acknowledged with bReset.
byError: Delivers all error messages and warnings,
byError.1 := bInvalidParameter
byError.2 := bErrorGeneral
byError.3 := bErrorHighLimit
byError.4 := bErrorLowLimit
byError.5 := bErrorShortCircuit
byError.6 := bErrorBrokenSensor
byError.7 := bErrorCycleTime
bErrorShortCircuit: Error, short circuit in the connected temperature sensor. After rectification of the error, acknowledgment depends on the operation mode.
bErrorBrokenSensor: Error, wire breakage in the connected temperature sensor. After rectification of the error, acknowledgment depends on the operation mode.
bErrorHighLimit: Warning upper limit value exceeded; becomes TRUE if rPresentValue >= rHighLimit. The warning that the upper limit value has been exceeded can only be acknowledged if rPresentValue <= rHighLimit -1.0 for a period of 5 seconds.
bErrorLowLimit: Warning: lower limit value undershot; goes TRUE if rPresentValue <= rLowLimit. The warning that the lower limit value has been undershot can only be acknowledged if rPresentValue >= rLowLimit +1.0 for a period of 5 seconds
bErrorCycleTime: Error caused by an incorrect time input at the input variables tTaskCycleTime and tCtrlCycleTime, which must be acknowledged after correcting the error.
bInvalidParameter: Indicates that an incorrect parameter is present at one of the variables rOffset, rHighLimit, rLowLimit, rReplacementValue, tFilterTime or eTemperatureSensorMode. An incorrect parameter specification does not lead to a standstill of the function block; see description of variables. After rectifying the incorrect parameter entry, the message bInvalidParameter must be acknowledged via bReset.
VAR_IN_OUT
rOffset : REAL;
rHighLimit : REAL;
rLowLimit : REAL;
rReplacementValue : REAL;
tFilterTime : TIME;
eTemperatureSensorMode : E_HVACTemperatureSensorMode;
rOffset: Temperature compensation in Kelvin (-50..+50), rPresentValue = (iRawValue / 10.0) + rOffset. The variable is saved persistently. Preset to 0.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value.
bInvalidParameter is set in the case of an incorrect parameter specification.
rHighLimit: Upper limit value (-250..+850); the output bErrorHighLimit is set if rPresentValue >= rHighLimit. rHighLimit must be greater than rLowLimit. The variable is saved persistently. Preset to 120.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value. bInvalidParameter is set in the case of an incorrect parameter specification.
rLowLimit: Lower limit value (-250..+850); the output bErrorLowLimit is set if rPresentValue <= rLowLimit. The variable is saved persistently. Preset to -60.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value. bInvalidParameter is set in the case of an incorrect parameter specification.
rReplacementValue: Replacement value (-250..+850) that is output at rPresentValue in the case of the errors bErrorShortCircuit and bErrorBrokenSensor if the selected operation mode eTemperatureSensorMode = eHVACTemperatureSensorMode_ReplacementValue or eHVACTemperatureSensorMode_AutoResetReplacementValue. The variable is saved persistently. Preset to 0.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value. bInvalidParameter is set in the case of an incorrect parameter specification.
tFilterTime: Filter constant (1ms..100s). To avoid large fluctuations and jumps in the measuring signal, the function block is provided with a 2nd order filter. Upon a restart of the controller, or following correction of the error bErrorShortCircuit or bErrorBrokenSensor, the 2nd order filter is synchronized immediately and additionally after 2 seconds with the present measuring signal, so that the latter is output at rPresentValue. The measuring signal can be synchronized via the input bReset during running operation. The variable is saved persistently. Preset to 10 s.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value. bInvalidParameter is set in the case of an incorrect parameter specification.
eTemperatureSensorMode: Enum that specifies the operation mode of the function block (see E_HVACTemperatureSensorMode). The variable is saved persistently. Preset to 3.
eTemperatureSensorMode = eHVACTemperatureSensorMode_ReplacementValue: If bErrorShortCircuit or bErrorBrokenSensor = TRUE, then rPresentValue = rReplacementValue. After correction of the error, the function block must be acknowledged with a rising edge at the input variable bReset.
eTemperatureSensorMode = eHVACTemperatureSensorMode_LastValue: If bErrorShortCircuit or bErrorBrokenSensor = TRUE, then the last valid temperature value that was present 10 seconds previously is output at rPresentValue. After correction of the error, it must be acknowledged with a rising edge at the input variable bReset.
eTemperatureSensorMode = eHVACTemperatureSensorMode_AutoResetReplacementValue : If bErrorShortCircuit or bErrorBrokenSensor = TRUE, then rPresentValue = rReplacementValue. The function block acknowledges itself automatically following correction of the error.
eTemperatureSensorMode = eHVACTemperatureSensorMode_AutoResetLastValue: If bErrorShortCircuit or bErrorBrokenSensor = TRUE, then the last valid temperature value that was present 10 seconds previously is output at rPresentValue. The function block acknowledges itself automatically following correction of the error.
If no correct variable value is present, then the last valid variable value, if one exists, will be taken. If there is no valid last value, operation continues with the default value. bInvalidParameter is set in the case of an incorrect parameter specification.
Requirements
Development environment | required library | required function |
---|---|---|
TwinCAT 3.1 build 4022.16 or higher | Tc2_HVAC V3.3.1.0 | TF8000 | TC3 HVAC V1.0.0.0 |