FB_HVACCirculationPumpEx

FB_HVACCirculationPumpEx 1:

Application

This function block serves to control pumps in HVAC systems.

The following switch-on conditions must first be fulfilled in order to control the pump via bPump:

bEnable = TRUEANDbErrorPumpProtec = FALSEANDbManSwitch = TRUEANDbCtrlVoltage = TRUE

If one of the switch-on conditions is not fulfilled, then the output bPump is constantly FALSE.

On the basis of the following diagrams it can be seen how the output bPump is controlled depending on the Enum eReqPump, the input bExternal, the outside temperature rOutSideTemp and the valve position rValvePosition. The switch-on conditions mentioned above must be fulfilled for this, and one of the two operation modes eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP must be preselected.

FB_HVACCirculationPumpEx 2:

FB_HVACCirculationPumpEx 3: FB_HVACCirculationPumpEx 4: FB_HVACCirculationPumpEx 5:

FB_HVACCirculationPumpEx 6: FB_HVACCirculationPumpEx 7:

FB_HVACCirculationPumpEx 8: FB_HVACCirculationPumpEx 9:

eHVACReqPump_No: there is no request on the part of the Enum to control the pump

eHVACReqPump_OT_LL: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit)

eHVACReqPump_OT_HL: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit)

eHVACReqPump_VP: the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_LL_OR_VP: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit) OR the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_HL_OR_VP: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit) OR the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_LL_AND_VP: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit) AND the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_HL_AND_VP: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit) AND the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

The output bPump switches itself off, after the switch-on conditions are no longer fulfilled, depending on the Enum eReqPump, the input bExternal, the outside temperature rOutSideTemp or the valve position rValvePosition, with a delay set by the time udiSecStopDelay.

FB_HVACCirculationPumpEx 10:

bError goes TRUE if bErrorPumpProtec is TRUE. However, only the fault bErrorPumpProtec leads to the deactivation of the output bPump. If the error message bErrorFeedb is also to lead to the switch-off of the pump, then the variable must be ANDed with the output bPump after calling the function block. The error message bErrorFeedb is active only in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP and only if the time udiSecFeedbPumpDelay is greater than 0.

Example anti-blocking protection

FB_HVACCirculationPumpEx 11:

The application example shows the function block FB_HVACirculationPumpEx. The example is illustrated in the programming languages ST and CFC. The program example P_CFC_CirculationPumpEx.PRG for the CFC programming languages can be found in the folder Language CFC > Actuator, the program example P_ST_CirculationPumpEx.PRG for the ST programming languages in the folder Language Structur Text > Actuator.

Application example

Download

Required library

tchvac.zip

TcHVAC.lib

VAR_INPUT

eDataSecurityType     : E_HVACDataSecurityType;
bSetDefault           : BOOL;
bEnable               : BOOL;
bExternal             : BOOL;
eCtrlModeActuator     : E_HVACActuatorMode; 
rOutsideTemp          : REAL;
rValvePosition        : REAL;
bFeedbPump            : BOOL;
bPumpProtec           : BOOL;
bManSwitch            : BOOL;
bCtrlVoltage          : 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: FB_HVACCirculationPumpEx 12:Example_PERSISTENT.zip

If eDataSecurityType:= eDataSecurityType_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.

bEnable: the function block is enabled if bEnable = TRUE. If bEnable = FALSE, the bPump output is constant FALSE.

bExternal: the output bPump can be switched on or off directly via the input bExternal. The following conditions must be fulfilled for this: bEnable = TRUEANDbErrorPumpProtec = FALSEANDbManSwitch = TRUEANDbCtrlVoltage = TRUEANDeCtrlModeActuator = eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OPANDeReqPump=eHVACRequestPump_NoRequest. Otherwise bExternal depending on bReqOutsideTemp and bReqValve controls the output bPump, see application.
bExternal
is only active in the operation mode eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP.

eCtrlModeActuator: Enum that defines the operation mode. The following operation modes are supported by the function block FB_HVACCirculationPumpEx: eHVACActuatorMode_Auto_BMS, eHVACActuatorMode_Auto_OP, eHVACActuatorMode_Speed1_BMS, eHVACActuatorMode_Speed1_OP, eHVACActuatorMode_Off_BMS, eHVACActuatorMode_Off_OP.
The two operation modes eHVACActuatorMode_Auto_BMS, eHVACActuatorMode_Auto_OP mean that the function block is in automatic mode.
The output bPump can be switched on directly via the two operation modes eHVACActuatorMode_Speed1_BMS, eHVACActuatorMode_Speed1_OP if the following conditions are met: bEnable = TRUEANDbErrorPumpProtec = FALSEANDbManSwitch = TRUEANDbCtrlVoltage = TRUE
The operation modes eHVACActuatorMode_Off_BMS, eHVACActuatorMode_Off_OP set the output bPump to FALSE.
If an incorrect variable value is present at eCtrlModeActuator, then the last valid variable value is taken. The status of the Enum eCtrlModeActuator is output via eStateModeActuator.

rOutsideTemp: input for transmitting the outside temperature value. Depending on the outside temperature, the pump can be switched on if the temperature falls below or exceeds the limit values rOutsideTempLowLimit / rOutsideTempHighLimit. This depends on the Enum eReqPump to request the pump, see application.
rOutsideTemp
is only active in eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP mode.

rValvePosition: input for transmitting the valve position of the control loop. Depending on the position of the valve rValvePosition associated with the pump, the pump can be switched on when the threshold value rValvePositionLimitOn is exceeded. This depends on the Enum eReqPump to request the pump, see application.
rValvePosition
is only active in the operation mode eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP.

bFeedbPump: feedback from the pump or a relay contact that the pump is switched on. If the output bPump = TRUE, then the input bFeedbPump must be TRUE within the time specification udiSecFeedbPumpDelay and must remain so until bPump = FALSE. This error is otherwise indicated via the output variable bErrorFeedb. After the rectification of the fault it must be acknowledged at the input bReset. The error message bErrorFeedb has no influence on the control of the output bPump.
bFeedbPump is only active in the operation mode eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP and if the time udiSecFeedbPumpDelay is greater than 0.
If there is no feedback on the pump status, but the function is still implemented, a TRUE must not be permanently applied to the input bFeedbPump. This would lead in the switched-off state to an error: bErrorFeedb = TRUE. In this case the output bPump should be applied to the input bFeedbPump.

bPumpProtec: the motor protection for the pump is connected to the input bPumpProtec. There is a pump error if the input bPumpProtec is FALSE. If there is an error, the output bPump goes FALSE and the error is displayed by means of the variable bErrorPumpProtec. The output bPump can only be switched on if bPumpProtec = TRUE (quiescent current principle). After the rectification of the fault it must be acknowledged at the input bReset.

bManSwitch: if the pump has a manual / emergency switch, this can be connected to the input bManSwitch. The state of the manual / emergency switch is monitored. If bManSwitch = FALSE, then output bPump is disabled. The output bPump can only be switched on if bManSwitch = TRUE (quiescent current principle). The state of bManSwitch is indicated by the output variable bStateManSwitch.

bCtrlVoltage: the control voltage monitoring is applied to the input bCtrlVoltage. If bCtrlVoltage = FALSE, the bPump output is constant FALSE. In order to suppress a torrent of messages, the fault messages bPumpProtec, bErrorFeedb and bError are only acquired if the input bCtrlVoltage is TRUE.

bReset: acknowledgment input in the case of a fault following its rectification.

VAR_OUTPUT

bPump                    : BOOL;
byState                  : BYTE;
bReqExternal             : BOOL;    //Request External
bReqOutsideTemp          : BOOL;    //Request Outside Temperature   
bReqValve                : BOOL;    //Request Valve
bStateManSwitch          : BOOL;
udiSecRT_StopDelay       : UDINT;   //Second Remaining Time Stop Delay
udiSecRT_FeedbPumpDelay  : UDINT;   //Second Remaining Time Feedback Pump Delay
eStateModeActuator       : E_HVACActuatorMode;
bError                   : BOOL;
byError                  : BYTE;
bErrorPumpProtec         : BOOL;
bErrorFeedb              : BOOL;
bInvalidParameter        : BOOL;

bPump: output variable for controlling a pump. To control the pump via bPump the following conditions must first be fulfilled: bEnable = TRUEANDbErrorPumpProtec = FALSEANDbManSwitch = TRUEANDbCtrlVoltage = TRUE. If these conditions are satisfied, the pump can be switched on directly via the operation mode eCtrlModeActuator or via various options in automatic mode, see Application.
The output bPump switches itself off after the switch-on conditions are no longer fulfilled depending, on the Enum eReqPump, the input bExternal, the outside temperature rOutSideTemp or the valve position rValvePosition, with a delay set by the time udiSecStopDelay.

byState: pump state output
byState.0 := bEnable;
byState.1 := bPump;
byState.2 := bReqExternal;
byState.3 := bReqOutsideTemp;
byState.4 := bReqValve;
byState.5 := bFeedbPump;
byState.6 := NOTbManSwitch;
byState.7 := bCtrlVoltage;

bReqExternal: If the condition bExternal = TRUE to switch on the pump via bPump is fulfilled, the output variable bReqExternal becomes TRUE. All switch-on conditions and the use of the output bReqExternal to control bPump are described in the Application.

bReqOutsideTemp: if the condition is achieved for requesting the pump via bPump depending on the outside temperature rOutsideTemp, the output variable bReqOutsideTemp becomes TRUE. All switch-on conditions and the use of the output bReqOutsideTemp to control bPump are described in the Application.

bReqValve: if the condition is achieved for requesting the pump via bPump depending on the valve position rValvePosition, the output variable bReqValve becomes TRUE. All switch-on conditions and the use of the output bReqValve to control bPump are described in the Application.

bStateManSwitch: status message of the manual/emergency switch. A TRUE signals that the manual/emergency operating level is activated. bStateManSwitch = NOT bManSwitch

udiSecRT_StopDelay: if the eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP operation mode is selected, the output bPump is switched off after the switch-on conditions are no longer fulfilled, depending on the Enum eReqPump, the input bExternal, the outside temperature rOutSideTemp or the valve position rValvePosition after udiSecRT_StopDelay has elapsed. The output is given in seconds.

udiSecRT_FeedbPumpDelay: if the output bPump = TRUE, then the input bFeedbPump must be TRUE within the time udiSecRT_FeedbPumpDelay and must remain so until bPump = FALSE. Otherwise this error is indicated via the output variable bErrorFeedb.
udiSecRT_FeedbPumpDelay is only active in the operation mode eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP and if the time udiSecFeedbPumpDelay is greater than 0. The output is given in seconds.

eStateModeActuator: indicates the operation mode of the function block. eStateModeActuator is equal to eCtrlModeActuator.

bError: bError becomes TRUE if bErrorPumpProtec is TRUE. However, only the fault bErrorPumpProtec leads to the deactivation of the output bPump. If the fault message bErrorFeedb is also to lead to the switch-off of the pump, then the variable must be ANDed with the output bPump after calling the function block.

byError: output of the errors as byte.
byError.1 := bInvalidParameter
byError.2 := bError
byError.3 := bErrorPumpProtec
byError.4 := bErrorFeedb

bErrorPumpProtec: the motor protection for the pump is connected to the input bPumpProtec. There is a pump error if the input bPumpProtec is FALSE. If there is an error, the output bPump goes FALSE and the error is displayed by means of the variable bErrorPumpProtec. The output bPump can only be switched on if bPumpProtec = TRUE (quiescent current principle). After the rectification of the fault it must be acknowledged at the input bReset.

bErrorFeedb: if the output bPump = TRUE, then the input bFeedbPump must be TRUE within the time udiSecFeedbPumpDelay and must remain so until bPump = FALSE. This error is otherwise indicated via the output variable bErrorFeedb. After the rectification of the fault it must be acknowledged at the input bReset. The error message bErrorFeedb has no influence on the control of the output bPump.
bErrorFeedb is only active in the operation mode eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP and if the time udiSecFeedbPumpDelay is greater than 0.

bInvalidParameter: becomes TRUE if an error occurred during the plausibility check of the following variables: rOutsideTempHighLimit, rOutsideTempLowLimit, rValvePositionLimitOn, rValvePositionLimitOff
The message must be acknowledged with bReset.

VAR_IN_OUT

udiSecStopDelay          : UDINT; 
udiSecFeedbPumpDelay     : UDINT;
rOutsideTempHighLimit    : REAL;
rOutsideTempLowLimit     : REAL;                               
rValvePositionLimitOn    : REAL;
rValvePositionLimitOff   : REAL;                           
eReqPump                 : E_HVACReqPump;

udiSecStopDelay: the time udiSecStopDelay [s] delays the switching off of the pump after the switch-on conditions are no longer fulfilled. It is input in seconds (0s..4294967s). If the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP is selected, the output bPump is switched off after the switch-on conditions are no longer fulfilled depending on the Enum eReqPump, the input bExternal, the outside temperature rOutSideTemp or the valve position rValvePosition after the time udiSecStopDelay has elapsed. The data is given in seconds. The variable is saved persistently. Preset to 0.

udiSecFeedbPumpDelay: if the output bPump = TRUE, then the input bFeedbPump must be TRUE within the time udiSecFeedbPumpDelay and must remain so until bPump = FALSE. Otherwise this error is indicated via the output variable bErrorFeedb (0s..4294967s).
udiSecFeedbPumpDelay is only active in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP and if the time udiSecFeedbPumpDelay is greater than 0. The input is given in seconds. The variable is saved persistently. Preset to 0.

rOutsideTempHighLimit: value above which the pump is switched on or off depending on the outside temperature rOutsideTemp and the Enum eReqPump (-60 °C..60 °C), see Application.
rOutsideTempHighLimit is only active in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP.
If there is an incorrect variable value at rOutsideTempHighLimit, then the last valid variable value is taken. bInvalidParameter will be set in the event of an incorrect parameter entry. The variable is saved persistently. Preset to 4.

rOutsideTempLowLimit: value below which the pump is switched on or off depending on the outside temperature rOutsideTemp and the Enum eReqPump (-60 °C..60 °C), see Application.
rOutsideTempLowLimit is only active in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP.
If there is an incorrect variable value at rOutsideTempLowLimit, then the last valid variable value is taken. bInvalidParameter will be set in the event of an incorrect parameter entry. The variable is saved persistently. Preset to 1.

rValvePositionLimitOn: threshold value for the position of a control valve rValvePosition associated with the pump from which the pump should switch on automatically if exceeded, e.g. heater pump (0%..100%), see Application.
rValvePositionLimitOn is only active in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP.
rValvePositionLimitOn must not be smaller than rValvePositionLimitOff. Otherwise the last valid variable value is taken and bInvalidParameter is set.
If there is an incorrect variable value at rValvePositionLimit, then the last valid variable value is taken. bInvalidParameter will be set in the event of an incorrect parameter entry. The variable is saved persistently. Preset to 5.

rValvePositionLimitOff: threshold value for the position of a control valve rValvePosition associated with the pump from which the pump is to switch off automatically if the value falls below, e.g. heater pump (0%..100%), see Application.
rValvePositionLimitOff is only active in the operation mode eHVACActuatorMode_Auto_BMS OR eHVACActuatorMode_Auto_OP.
rValvePositionLimitOff must not be greater than rValvePositionLimitOn. Otherwise the last valid variable value is taken and bInvalidParameter is set.
If there is an incorrect variable value at rValvePositionLimit, then the last valid variable value is taken. bInvalidParameter will be set in the event of an incorrect parameter entry. The variable is saved persistently. Preset to 1.

eReqPump: using the Enum eReqPump, switch-on conditions or combinations of switch-on conditions can be set for switching on the pump.
The switch-on conditions are as follows:

- depending on the outside temperature, the pump can be switched on if the temperature falls below or exceeds the limit values rOutsideTempLowLimit / rOutsideTempHighLimit.

- depending on the position of the valve rValvePosition associated with the pump, the pump can be switched on when the threshold value rValvePositionLimitOn is exceeded.

In addition, the Enum combinations can be used to specify whether the temperature-dependent and valve-position-dependent switch-on conditions are ORed or ANDed together.

The following switch-on conditions or combinations of switch-on condition can be set via the Enum in order to control the output bPump:

eHVACReqPump_No: there is no request on the part of the Enum to control the pump

eHVACReqPump_OT_LL: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit)

eHVACReqPump_OT_HL: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit)

eHVACReqPump_VP: the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_LL_OR_VP: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit) OR the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_HL_OR_VP: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit) OR the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_LL_AND_VP: the outside temperature (OT = rOutsideTemp) must be lower than rOutsideTempLowLimit (LL = Lower Limit) AND the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

eHVACReqPump_OT_HL_AND_VP: the outside temperature (OT = rOutsideTemp) must be higher than rOutsideTempHighLimit (HL = Higher Limit) AND the valve position (VP = rValvePosition) must be larger than rValvePositionLimitOn

Preconditions for the use of the Enum eReqPump are that bEnable = TRUEANDbErrorPumpProtec = FALSEANDbManSwitch = TRUEANDbCtrlVoltage = TRUEANDeCtrlModeActuator = eHVACActuatorMode_Auto_BMSOReHVACActuatorMode_Auto_OP.
If there is an incorrect variable value at eReqPump, then the last valid variable value is taken.bInvalidParameter will be set in the event of an incorrect parameter entry.