FB_HVACMotor3Speed

FB_HVACMotor3Speed 1:

Application

This function block serves to control a three-speed drive in HVAC systems. The function block always runs in step 1, the lowest power step, and switches to step 2 or step 3 depending on requirements. It cannot be switched on directly in step 2 or 3. In the event of a restart, disablement, an error or switching off of the motor via the operation mode, restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2.

Application example

Download

Required library

tchvac.zip

TcHVAC.lib

VAR_INPUT

eDataSecurityType      : E_HVACDataSecurityType;       
bSetDefault            : BOOL;
bEnable                : BOOL;       
bAutoSpeed1            : BOOL;       
bAutoSpeed2            : BOOL;       
bAutoSpeed3            : BOOL;       
eCtrlModeActuator      : E_HVACActuatorMode;
bMotorProtecSpeed1     : BOOL;
bMotorProtecSpeed2     : BOOL;
bMotorProtecSpeed3     : BOOL;
bFeedbContactorSpeed1  : BOOL;
bFeedbContactorSpeed2  : BOOL;
bFeedbContactorSpeed3  : BOOL;
bFeedbProcess          : BOOL;
bRepairSwitch          : 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_HVACMotor3Speed 2: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.

bEnable: the function block is enabled if bEnable = TRUE. If bEnable = FALSE, the drive is switched off with a delay specified in the time variable tStopDelay at the respective switch-on stage.
If an enable is present, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2.

bAutoSpeed1: bAutoSpeed1 is only active if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP.
If the input variables bAutoSpeed1 = TRUE, bAutoSpeed2 = FALSE and bAutoSpeed3 = FALSE, then the function block is instructed that the drive should run at speed 1.
If bAutoSpeed1 = FALSE, the drive will be switched off with a delay specified in the time variable tStopDelay.

bAutoSpeed2: bAutoSpeed2 is only active if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP.
If the input variables bAutoSpeed1 = TRUE, bAutoSpeed2 = TRUE and bAutoSpeed3 = FALSE, then the function block is instructed that the drive should run at speed 2.
If bAutoSpeed1 and bAutoSpeed2 = FALSE, the drive will be switched off with a delay specified in the time variable tStopDelay.

bAutoSpeed3: bAutoSpeed3 is only active if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP.
If the input variables bAutoSpeed1 = TRUE, bAutoSpeed2 = TRUE and bAutoSpeed3 = TRUE, then the function block is instructed that the drive should run at speed 3.
If bAutoSpeed1, bAutoSpeed2 and bAutoSpeed3 = FALSE, the drive will be switched off with a delay specified in the time variable tStopDelay.

eCtrlModeActuator: Enum that specifies the operation mode of the motor. In the event of an incorrect entry, operation continues internally with the last valid operating mode. This is eHVACActuatorMode_Auto_BMS in the case of initial commissioning. bInvalidParameter will be set in the event of an incorrect parameter entry.

bMotorProtecSpeed1: input for motor protection speed 1. There is a motor protection fault if the input bMotorProtecSpeed1 is FALSE (quiescent current principle). In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE; the fault is indicated at the output of the function block by bErrorMotorprotecSpeed1. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset.

bMotorProtecSpeed2: input for motor protection speed 2. There is a motor protection fault if the input bMotorProtecSpeed2 is FALSE (quiescent current principle). In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE; the fault is indicated at the output of the function block by bErrorMotorprotecSpeed2. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset.

bMotorProtecSpeed3: input for motor protection speed 3. There is a motor protection fault if the input bMotorProtecSpeed3 is FALSE (quiescent current principle). In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE; the fault is indicated at the output of the function block by bErrorMotorprotecSpeed3. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset.

bFeedbContactorSpeed1: feedback from the power section of the motor for speed 1. The operating feedback is present if the input bFeedbContactorSpeed1 = TRUE. If, after switching on the motor, this feedback is not present after the time delay set by tDelayFeedbContactorSpeed1, the output bErrorFeedbContactorSpeed1 is set in order to indicate a fault. In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset. If no feedback from the power section of the motor is present for speed 1, the output variable bMotorSpeed1 must be applied to the input bFeedbContactorSpeed1.

FB_HVACMotor3Speed 3:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed1 must be applied to the input bFeedbContactorSpeed1. See application example

bFeedbContactorSpeed2: feedback from the power section of the motor for speed 2. The operating feedback is present if the input bFeedbContactorSpeed2 = TRUE. If, after switching on the motor, this feedback is not present after the time delay set by tDelayFeedbContactorSpeed2, the output bErrorFeedbContactorSpeed2 is set in order to indicate a fault. In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset. If no feedback from the power section of the motor is present for speed 2, the output variable bMotorSpeed2 must be applied to the input bFeedbContactorSpeed2.

FB_HVACMotor3Speed 4:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed2 must be applied to the input bFeedbContactorSpeed2. See application example

bFeedbContactorSpeed3: feedback from the power section of the motor for speed 3. The operating feedback is present if the input bFeedbContactorSpeed3 = TRUE. If, after switching on the motor, this feedback is not present after the time delay set by tDelayFeedbContactorSpeed3, the output bErrorFeedbContactorSpeed3 is set in order to indicate a fault. In the event of a fault, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset. If no feedback from the power section of the motor is present for speed 3, the output variable bMotorSpeed3 must be applied to the input bFeedbContactorSpeed3.

FB_HVACMotor3Speed 5:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed3 must be applied to the input bFeedbContactorSpeed3. See application example

bFeedbProcess: a process feedback signal, for example from a v-belt monitor or a flow monitor can be connected to the input bFeedbProcess. The process feedback is present if the input bFeedbProcess = TRUE (quiescent current principle). If, in the start-up phase after switching on the motor, the process feedback is not present after the time set by tFeedbProcessTimer, the drive switches off and indicates a fault at the output bErrorFeedbProcess. The motor can only be restarted if the fault has been rectified and acknowledged at the input bReset. In order to avoid undesired switching off of the drive during operation due to the process monitoring bFeedbProcess, e.g. in the event of short-term pressure fluctuations, the triggering of the input bFeedbProcess can be delayed by the time tDelayFeedbProcess.
The process feedback is active if either bMotorSpeed1, bMotorSpeed2 or bMotorSpeed3 = TRUE.

bRepairSwitch: the state of the repair switch is monitored with the input bRepairSwitch. The motor can only be switched on if bRepairSwitch = TRUE (quiescent current principle). If the repair switch is switched off, bRepairSwitch = FALSE, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. If the state of the repair switch is TRUE, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2.

bManSwitch: the state of the manual/emergency switch is monitored with the input bManSwitch. The motor can only be switched on if bManSwitch = TRUE (quiescent current principle). If the manual/emergency switch is switched off, bManSwitch= FALSE, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. If the state of the manual/emergency switch is TRUE, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2.

bCtrlVoltage: the control voltage is monitored with the input bCtrlVoltage. The motor can only be switched on if bCtrlVoltage = TRUE (quiescent current principle). If the control voltage is switched off, bCtrlVoltage= FALSE, the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are all FALSE. In order to avoid a torrent of error messages if the control voltage fails, the error messages of the function block are suppressed. If the control voltage is restored, the error messages are enabled again. If control voltage is present, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2 .

bReset: input for acknowledgement of faults via a rising edge.

VAR_OUTPUT

bMotorSpeed1                 : BOOL;
bMotorSpeed2                 : BOOL;    
bMotorSpeed3                 : BOOL;
wState                       : WORD;
bStateAutoSpeed1             : BOOL;    
bStateAutoSpeed2             : BOOL;    
bStateAutoSpeed3             : BOOL;    
bStateRepairSwitch           : BOOL;
bStateManSwitch              : BOOL;
eStateModeActuator           : E_HVACActuatorMode;
bErrorGeneral                : BOOL;
wError                       : WORD;
bErrorMotorprotecSpeed1      : BOOL;
bErrorMotorprotecSpeed2      : BOOL;
bErrorMotorprotecSpeed3      : BOOL;
bErrorFeedbContactorSpeed1   : BOOL;
bErrorFeedbContactorSpeed2   : BOOL;
bErrorFeedbContactorSpeed3   : BOOL;
bErrorFeedbProcess           : BOOL;
bInvalidParameter            : BOOL;            

bMotorSpeed1: output variable for controlling speed 1 of the three-speed drive.

bMotorSpeed2: output variable for controlling speed 2 of the three-speed drive.

bMotorSpeed3: output variable for controlling speed 3 of the three-speed drive.

wState: statusword indicating the operating state of the function block.
wState.0 := bEnable;
wState
.1 := bMotorSpeed1;
wState
.2 := bMotorSpeed2;
wState
.3 := bMotorSpeed3;
wState
.4 := bStateAutoSpeed1;
wState
.5 := bStateAutoSpeed2;
wState
.6 := bStateAutoSpeed3;
wState.7 := bStateRepairSwitch;
wState
.8 := bStateManSwitch;
wState.9 := bCtrlVoltage;

bStateAutoSpeed1: indicates the state for automatic preselection speed 1 if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP and speed 1 was activated via the input variable bAutoSpeed1.

bStateAutoSpeed2: indicates the state for automatic preselection speed 2 if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP and speed 2 was activated via the input variable bAutoSpeed2.

bStateAutoSpeed3: indicates the state for automatic preselection speed 3 if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP and speed 3 was activated via the input variable bAutoSpeed3.

bStateRepairSwitch: status message of the repair switch. TRUE indicates that the repair switch is switched off.

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

eStateModeActuator: Enum via which the state of the operation mode of the motor is fed back to the controller.

bErrorGeneral: the error message bErrorGeneral becomes TRUE as soon as one of the error messages bErrorMotorprotecSpeed1, bErrorMotorprotecSpeed2, bErrorMotorprotecSpeed3, bErrorFeedbContactorSpeed1, bErrorFeedbContactorSpeed2, bErrorFeedbContactorSpeed23 or bErrorFeedbProcess = TRUE. The outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are then set to FALSE and are only enabled again when the fault has been rectified and acknowledged via bReset. After rectification of the fault a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1 + tDelaySpeed3ToSpeed2.

wError: returns all error messages and warnings of the function block.
wError.1 := bInvalidParameter;
wError
.2 := bErrorGeneral;
wError.3 := bErrorMotorprotecSpeed1;
wError.4 := bErrorMotorprotecSpeed2;
wError
.5 := bErrorMotorprotecSpeed3;
wError.6 := bErrorFeedbContactorSpeed1;
wError
.7 := bErrorFeedbContactorSpeed2;
wError.8 := bErrorFeedbContactorSpeed3;
wError.9 := bErrorFeedbProcess;

bErrorMotorprotecSpeed1: error motor protection, see input variable bMotorProtecSpeed1.

bErrorMotorprotecSpeed2: error motor protection, see input variable bMotorProtecSpeed2.

bErrorMotorprotecSpeed3: error motor protection, see input variable bMotorProtecSpeed3.

bErrorFeedbContactorSpeed1: power section feedback error, see input variable bFeedbContactorSpeed1

FB_HVACMotor3Speed 6:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed1 must be applied to the input bFeedbContactorSpeed1. See application example

bErrorFeedbContactorSpeed2: power section feedback error, see input variable bFeedbContactorSpeed2

FB_HVACMotor3Speed 7:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed2 must be applied to the input bFeedbContactorSpeed2. See application example

bErrorFeedbContactorSpeed3: power section feedback error, see input variable bFeedbContactorSpeed3

FB_HVACMotor3Speed 8:

If no feedback from the power section of the motor is present, the output variable bMotorSpeed3 must be applied to the input bFeedbContactorSpeed3. See application example

bErrorFeedbProcess: process feedback error, see input variable bFeedbackProcess

bInvalidParameter: indicates that an incorrect parameter is present at one of the variables eCtrlModeActuator, tStartDelay, tStopDelay, tDelayFeedbContactorSpeed1, tDelayFeedbContactorSpeed2, tDelayFeedbContactorSpeed3,tFeedbProcessTimer,tDelayFeedbProcess, tDelaySpeed1, tDelaySpeed2, tDelaySpeed1ToSpeed2ToSpeed3, tDelaySpeed2ToSpeed1 or tDelaySpeed3ToSpeed2. 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

tStartDelay                  : TIME;
tStopDelay                   : TIME;
tDelayFeedbContactorSpeed1   : TIME;
tDelayFeedbContactorSpeed2   : TIME;
tDelayFeedbContactorSpeed3   : TIME;
tFeedbProcessTimer           : TIME;
tDelayFeedbProcess           : TIME;
tDelaySpeed1                 : TIME;
tDelaySpeed2                 : TIME;
tDelaySpeed1ToSpeed2ToSpeed3 : TIME;
tDelaySpeed2ToSpeed1         : TIME;
tDelaySpeed3ToSpeed2         : TIME;

tStartDelay: the start-up of the motor after enabling and switching on via the operation mode of the motor is delayed by the time tStartDelay [s] (0s..3600s). The variable is saved persistently. Preset to 0 s.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tStopDelay: the switching off of the motor in the respective switch-on stage, either by switching the enable bEnable to FALSE, or by switching off via the operation mode eCtrlModeActuator , or in automatic operation mode by switching the input variables bAutoSpeed1, bAutoSpeed2 and bAutoSpeed3 to FALSE, is delayed by the time tStopDelay [s]. Once the delayed switch-off of the motor has been activated it can no longer be canceled (0s..3600s). The variable is saved persistently. Preset to 0 s.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelayFeedbContactorSpeed1: time delay of the feedback of the power section after switching on the motor. If this time has elapsed and bFeedbContactorSpeed1 = FALSE, then this is fed back to the controller via the error message bErrorFeedbContactorSpeed1 (100ms..3600s). The variable is saved persistently. Preset to 100 ms.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, operation continues with the default value. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelayFeedbContactorSpeed2: time delay of the feedback of the power section after switching on the motor. If this time has elapsed and bFeedbContactorSpeed2 = FALSE, then this is fed back to the controller via the error message bErrorFeedbContactorSpeed2 (100ms..3600s). The variable is saved persistently. Preset to 100 ms.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelayFeedbContactorSpeed3: time delay of the feedback of the power section after switching on the motor. If this time has elapsed and bFeedbContactorSpeed3 = FALSE, then this is fed back to the controller via the error message bErrorFeedbContactorSpeed3 (100ms..3600s). The variable is saved persistently. Preset to 100 ms.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tFeedbackProcessTimer: time delay [s]of the process feedback bFeedbProcess [s] after start-up phase of the motor. If this time has elapsed and bFeedbProcess = FALSE, then this is fed back to the controller via the error message bErrorFeedbProcess (0s..3600s). The variable is saved persistently. Preset to 0 s.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelayFeedbProcess: in order to avoid undesired switching off of the drive during operation due to the process monitoring bFeedbProcess, e.g. in the event of short-term pressure fluctuations, the triggering of the input bFeedbProcess can be delayed by the time tDelayFeedbProcess (0s..3600s). The variable is saved persistently. Preset to 0 s.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelaySpeed1: time delay [s] for the start-up phase of the motor in speed 1 (1s..3600s). The variable is saved persistently. Preset to 3s.
After this time has elapsed, the motor can be switched from the first to the second speed if the operating mode for speed 2 is selected.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelaySpeed2: time delay [s] for the start-up phase of the motor in speed 2 (1s..3600s). The variable is saved persistently. Preset to 3s.
After this time has elapsed, the motor can be switched from the second to the third speed if the operation mode for speed 3 is selected.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelaySpeed1ToSpeed2ToSpeed3: time delay for the motor switchover phase from speed 1 to speed 2 or from speed 2 to speed 3, so that the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are FALSE for a short while (1s..3600s). The variable is saved persistently. Preset to 250 ms. The time delay serves to protect the motor windings.
If an incorrect variable value is present, the last valid variable value is used, if available. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelaySpeed2ToSpeed1: time delay [s] for the motor switchover phase from speed 2 to speed 1 (1s..3600s). The variable is saved persistently. Preset to 10 s. In this phase the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are set to FALSE for the duration of tDelaySpeed2ToSpeed1in order to reduce the speed of the motor when switching to speed 1.
If an incorrect variable value is present, the last valid variable value is used, if available. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.

tDelaySpeed3ToSpeed2: time delay [s] for the motor switchover phase from speed 3 to speed 2 (1s..3600s). The variable is saved persistently. Preset to 10 s. In this phase the outputs bMotorSpeed1, bMotorSpeed2 and bMotorSpeed3 are FALSE for the time tDelaySpeed3ToSpeed2 in order to reduce the speed of the motor when switching to speed 2.
If an incorrect variable value is present, the last valid variable value, if available, is used. If there is no valid last value, then the default value is used. bInvalidParameter will be set in the event of an incorrect parameter entry.