FB_HVACMotor2Speed

FB_HVACMotor2Speed 1:

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.

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: 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 via the specified time variable tStopDelay. If an enable is present, a restart of the motor is blocked for the duration of tDelaySpeed2toSpeed1.

bAutoSpeed1: bAutoSpeed1 is then only active if the operation mode eCtrlModeActuator is either eHVACActuatorMode_Auto_BMS or eHVACActuatorMode_Auto_OP.
If the input variable bAutoSpeed1 = TRUE and the input variable 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 via the specified time variable tStopDelay.

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

eCtrlModeActuator: Enum that specifies the operation mode of the motor (see E_HVACActuatorMode). If specified incorrectly, operation continues internally with the last valid operation mode. This is eHVACActuatorMode_Auto_BMS in the case of initial commissioning. bInvalidParameter is set in the case of an incorrect parameter specification.

bMotorProtecSpeed1: Input for the motor protection speed 1. There is a motor protection error if the input bMotorProtecSpeed1 = FALSE (quiescent current principle). In the event of a fault, the outputs bMotorSpeed1 and bMotorSpeed2 are both FALSE; the error 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 the motor protection speed 2. There is a motor protection error if the input bMotorProtecSpeed2 = FALSE (quiescent current principle). In the event of a fault, the outputs bMotorSpeed1 and bMotorSpeed2 are both 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 both 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 2:

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

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 both 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 3:

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

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, 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 and the outputs bMotorSpeed1 and bMotorSpeed2 are both 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 and 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 state of 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 and 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;
yState.5 := bStateRepairSwitch;
byState.6 := bStateManSwitch;
byState.7 := bCtrlVoltage;

bStateAutoSpeed1: Indicates the state for automatic preselection of 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 of 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: Indicates the state of the repair switch. TRUE indicates that the repair switch is switched off.

bStateManSwitch: Indicates the state 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 (see E_HVACActuatorMode).

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: Delivers all error messages and warnings from 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: Motor protection error, see input variable bMotorProtecSpeed1

bErrorMotorprotecSpeed2: Motor protection error, see input variable bMotorProtecSpeed2

bErrorFeedbContactorSpeed1: Power section feedback error, see input variable bFeedbContactorSpeed1

FB_HVACMotor2Speed 4:

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

bErrorFeedbContactorSpeed2: Power section feedback error, see input variable bFeedbContactorSpeed2

FB_HVACMotor2Speed 5:

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

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 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.

tStopDelay: The switch-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 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.

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 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.

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 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.

tFeedbackProcessTimer: Time delay [s] of the process feedback bFeedbProcess during the motor start-up phase. 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 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.

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 response of the input bFeedbProcess can be delayed by the time tDelayFeedbProcess [s] (0s..3600s). The variable is saved persistently. Preset to 0 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.

tDelaySpeed1: Time delay [s] for the start-up phase of the motor in speed 1 (1s..3600s). The variable is saved persistently. Preset to 3 s.
After this time has elapsed the motor can be switched from the first to the second speed if the operation mode for speed 2 has been selected.
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.

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 purpose of this time delay is to preserve the motor windings.
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.

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 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