FB_HVACMotor2Speed

FB_HVACMotor2Speed 1:

Application

This function block serves to control a two-stage drive in HVAC systems. The function block always runs in stage 1, the lower power stage. It cannot be switched on directly in stage 2. 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.

Application example

Download

Required library

tchvac.zip

TcHVAC.lib

VAR_INPUT

eDataSecurityType     : E_HVACDataSecurityType;       
bSetDefault           : BOOL;
bEnable               : BOOL;       
bAutoSpeed1           : BOOL;       
bAutoSpeed2           : BOOL;       
eCtrlModeActuator     : E_HVACActuatorMode;
bMotorProtecSpeed1    : BOOL;
bMotorProtecSpeed2    : BOOL;
bFeedbContactorSpeed1 : BOOL;
bFeedbContactorSpeed2 : 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_HVACMotor2Speed 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 will be switched off in the respective switch-on stage with a delay specified in the time variable tStopDelay. If an enable is present, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1.

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 and bAutoSpeed2 = FALSE, 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 variable bAutoSpeed1 and bAutoSpeed2 = TRUE, the function block is instructed to run the drive in at speed 2. If bAutoSpeed1 andbAutoSpeed2 = FALSE, the drive is 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 and bMotorSpeed2 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 and bMotorSpeed2 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.

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 and bMotorSpeed2 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_HVACMotor2Speed 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 and bMotorSpeed2 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_HVACMotor2Speed 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

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 or bMotorSpeed2 = 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 and bMotorSpeed2 are all FALSE. If the state of the repair switch is TRUE, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1.

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 and bMotorSpeed2 are both FALSE. If the state of the manual/emergency switch is TRUE, a restart of the motor is blocked for the duration of tDelaySpeed2ToSpeed1.

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 and bMotorSpeed2 are both 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.

bReset: acknowledge input in the event of a fault.

VAR_OUTPUT

bMotorSpeed1               : BOOL;
bMotorSpeed2               : BOOL;
byState                    : BYTE;
bStateAutoSpeed1           : BOOL;       
bStateAutoSpeed2           : BOOL;       
bStateRepairSwitch         : BOOL;
bStateManSwitch            : BOOL;
eStateModeActuator         : E_HVACActuatorMode;
bErrorGeneral              : BOOL;
byError                    : BYTE;
bErrorMotorprotecSpeed1    : BOOL;
bErrorMotorprotecSpeed2    : BOOL;
bErrorFeedbContactorSpeed1 : BOOL;
bErrorFeedbContactorSpeed2 : BOOL;
bErrorFeedbProcess         : BOOL;
bInvalidParameter          : BOOL;               

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

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

byState: status byte indicating the operating state of the function block
byState.0 := bEnable;
byState
.1 := bMotorSpeed1;
byState
.2 := bMotorSpeed2;
byState
.3 := bStateAutoSpeed1;
byState
.4 := bStateAutoSpeed2;
byState.5 := bStateRepairSwitch;
byState
.6 := bStateManSwitch;
byState.7 := 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.

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, bErrorFeedbContactorSpeed1, bErrorFeedbContactorSpeed2 or bErrorFeedbProcess = TRUE. The outputs bMotorSpeed1 and bMotorSpeed2 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.

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

bErrorMotorprotecSpeed1: error motor protection, see input variable bMotorProtecSpeed1.

bErrorMotorprotecSpeed2: error motor protection, see input variable bMotorProtecSpeed2.

bErrorFeedbContactorSpeed1: power section feedback error, see input variable bFeedbContactorSpeed1

FB_HVACMotor2Speed 5:

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_HVACMotor2Speed 6:

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

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, tFeedbProcessTimer,tDelayFeedbProcess, tDelaySpeed1 or tDelaySpeed1ToSpeed2. 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;
tFeedbProcessTimer          : TIME;
tDelayFeedbProcess          : TIME;
tDelaySpeed1                : TIME;
tDelaySpeed1ToSpeed2        : TIME;
tDelaySpeed2ToSpeed1        : 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 and bAutoSpeed2 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, then the default value is used. 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.

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.

tDelaySpeed1ToSpeed2: time delay for the motor switchover phase from speed 1 to speed 2, so that both outputs bMotorSpeed1 and bMotorSpeed2 are FALSE for a short while (100ms..10s). 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 both outputs bMotorSpeed1 and bMotorSpeed2 are FALSE for the time tDelaySpeed2ToSpeed1 in 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, 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.