FB_HVACAnalogTo3Point

FB_HVACAnalogTo3Point 1:

Application

This function block serves to convert an analog signal into a three-point step signal. Hence three-point dampers or valves can be controlled by a controller with a continuous control signal. The function block FB_HVACAnalogTo3Point works with or without a continuous positional feedback signal from the drive.

Example: three-point actuator without feedback and limit switch

FB_HVACAnalogTo3Point 2:

VAR_INPUT

eDataSecurityType    : E_HVACDataSecurityType;
bSetDefault          : BOOL;
bEnable              : BOOL;
rSetpoint            : REAL;
rFeedb               : REAL;
bLimitSwitchOpen     : BOOL;
bLimitSwitchClose    : BOOL;
bCtrlVoltage         : BOOL;
bReset               : BOOL;
tTaskCycleTime       : TIME;

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_HVACAnalogTo3Point 3: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 control voltage is present and there are no errors and bEnable = FALSE, then the output bClose = is TRUE and the output bOpen is FALSE. If the reference mode eReferencingMode = eHVACReferencingMode_Emulation, then the output bClose remains set until either the limit switch is reached, the enable signal is present again or there is an error.
If the reference mode eReferencingMode = eHVACReferencingMode_AnalogFeedback, then the output bClose remains set until either the enable signal is present again, or there is a fault or rFeedback = rMinSetpoint.

rSetpoint: the setpoint for the position of the damper or the valve is transferred to the function block with the variable rSetpoint. The parameters rMaxSetpoint and rMinSetpoint define the value range of rSetpoint.
If an incorrect variable value is present at rSetpoint, then the last valid variable value is used, if available. If there is no valid, last value, then work continues internally with rMinSetpoint. bInvalidParameter is set if the variable value is incorrect, the function block continues to operate normally.

rFeedb: the input variable rFeedb is only active if the referencing mode of the function block eReferencingMode = eHVACReferencingMode_AnalogFeedback. The actual position of the drive is fed back with the scaled input signal rFeedb. The scaling of rFeedb must correspond to the scaling of rSetpoint. The parameters rMaxSetpoint and rMinSetpoint define the value range of rFeedb. rFeedb is returned to the controller via the output variable rPosition.
If there is an incorrect variable value at rFeedb, then the last valid variable value is taken, if available. If there is no valid, last value, then work continues internally with rMinSetpoint. bInvalidParameter is set if the variable value is incorrect, the function block continues to operate normally.

bLimitSwitchOpen/bLimitSwitchClose: if the three-point actuator has limit switches, these can be connected to the inputs bLimitSwitchOpen and bLimitSwitchClose.
The limit switches are used by the function block in the referencing mode eReferencingMode = eHVACReferencingMode_Emulation for referencing. Depending on the direction of driving, the currently calculated position rPosition is automatically set to the corresponding value of rMaxSetpoint/rMinSetpoint by a falling edge on one of the two inputs bLimitSwitchOpen/bLimitSwitchClose. This also takes place when the drive is at a standstill..
Regardless of which referencing mode the function block is in, the associated output bOpenor bClose remains TRUE after the respective limit position switch has been reached.
The limit switches must be connected to the function block as break contacts. If none exist, a TRUE must be applied to the two inputs bLimitSwitchOpen/bLimitSwitchClose.

bCtrlVoltage: a check via the input variable bCtrlVoltage is made of whether control voltage is present. Both outputs bOpen and bClose are set to FALSE in the event of failure of the control voltage. Since many error messages are based on the quiescent current principle, there would be a torrent of error messages following failure of the control voltage. Therefore all error messages are suppressed in the event of a control voltage failure in the FB_HVACAnalogTo3Point.
The control voltage is present if a TRUE is present at input bCtrlVoltage.

bReset: acknowledge input in the event of a fault.

tTaskCycleTime: cycle time with which the function block is called. This corresponds to the task cycle time of the calling task if the function block is called in every cycle.
If an incorrect time value of T#0s is applied to tTaskCycleTime, then tTaskCycleTime is internally set to T#1ms. bInvalidParameter is set if the variable value is incorrect.

VAR_OUTPUT

bOpen             : BOOL;
bClose            : BOOL;
byState           : BYTE;
rPosition         : REAL;
bErrorGeneral     : BOOL;
byError           : BYTE;
bErrorLimitSwitch : BOOL;
bInvalidParameter : BOOL;

bOpen: output for opening the three-point actuator.

bClose: output for closing the three-point actuator.

byState: status byte indicating the operating state of the function block.
byState.0 := bEnable
byState
.1 := bOpen
byState.2 := bClose
byState.3 := bLimitSwitchOpen
byState.4 := bLimitSwitchClose
byState.7 := bCtrlVoltage

rPosition: with rPosition either the measured or the calculated position of the drive is fed back to the controller.
If eReferencingMode = eHVACReferencingMode_AnalogFeedback, then rFeedb is returned to the controller via the output variable rPosition. If rFeedb > rMaxSetpoint, then rPosition = rMaxSetpoint and bInvalidParameter is set. If rFeedb < rMinSetpoint, then rPosition = rMinSetpoint and bInvalidParameter is set.
If eReferencingMode = eHVACReferencingMode_Emulation, then the actual position of the drive will be emulated on the basis of a calculation and fed back to the controller via rPosition.

bErrorGeneral: the error message bErrorGeneral becomes TRUE as soon as bErrorGeneralLimitSwitch = TRUE. The outputs bOpen and bClose are then set to FALSE and are only enabled again when the error has been rectified and acknowledged via bReset.

byError: returns all error messages and warnings of the function block
byError.1:= bInvalidParameter
byError.2
:= bErrorGeneral
byError.3:= bErrorLimitSwitch

bErrorLimitSwitch: becomes TRUE if both limit switches are activated simultaneously or if ((rMaxSetpoint - rThreshold) < rSetpoint) and bOpen = TRUE ) or if ((rMinSetpoint + rThreshold) > rSetpoint) and bClose = TRUE). The error bErrorLimitSwitch can only occur if eReferencingMode = eEmulation.

bInvalidParameter: indicates that an incorrect parameter is present at one of the variables rMinSetpoint, rMaxSetpoint, rThreshold, rTolerance, tPauseMin, tPauseMax, tInterval, tStrokeTime, tSwitchOverDeadTime, eReferencingMode, rSetpoint or rFeedback. An incorrect parameter entry 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

VAR_IN_OUT

rMinSetpoint        : REAL;
rMaxSetpoint        : REAL;
rThreshold          : REAL;
rTolerance          : REAL;
tPauseMin           : TIME;
tPauseMax           : TIME;
tInterval           : TIME;
tStrokeTime         : TIME;
tSwitchOverDeadTime : TIME;
eReferencingMode    : E_HVACReferencingMode;

rMinSetpoint/rMaxSetpoint: the parameters rMaxSetpoint (0..32767) and rMinSetpoint (0..32767) define the value range of rSetpoint . rMaxSetpoint must be greater than rMinSetpoint. In addition, the two variables rMaxSetpoint and rMinSetpoint are included in the calculation of the variable pulse-pause modulation, see Figure 1.1.
If an incorrect variable value is present, then the last valid variable value is used, if available. If there is no valid last value, operation continues with the preset value. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variables are stored persistently. rMinSetpoint preset to 0. rMaxSetpoint preset to 100.

rThreshold/rTolerance: if the difference between the position setpoint rSetpoint and the calculated or measured actual position value rPosition of the actuator is greater than the threshold value set by the variable rThreshold (0.001..32767), then the function block begins to correct the position by cycling the outputs bOpen or bClose, depending on the control deviation value. Correction continues until the deviation is smaller than the value rTolerance (0.001..32767). A hysteresis loop for the opening and closing movement of the drive is defined by the value of rThreshold – rTolerance . This is necessary in order to prevent the drive reacting to the smallest changes of the control value. Wear on the drive and the relay is thus reduced. rThreshold must be greater than rTolerance.
rSetpoint - rPosition
> = rThreshold control of bOpen
rPosition- rSetpoint
> = rThreshold control of bClose
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 preset value is used. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variables are stored persistently. rThreshold preset to 5.0. rTolerance preset to 2.0.

tPauseMin/tPauseMax/tInterval: a variable pulse/pause modulation for cycling the three-point actuator can be set with the parameters tPauseMin [s] (0..3600), tPauseMax [s] (0..3600)and tInterval [s] (0..3600). The pause length is defined as a function of the control deviation by the parameters tPauseMin and tPauseMax. In the case of a small deviation the pause time is long in relation to the interval time. Analogously, the pause time is short if the deviation is large. The effective driving speed of the three-point actuator is thus higher for larger control deviations than it is for smaller ones; see following fig. The following condition must be fulfilled in any case: tPauseMin < tPauseMax < tInterval
If a wrong variable value is present, then the last valid variable value is used, if available. If there is no valid last value, then the preset value is used. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variables are stored persistently. tPauseMin preset to 2s. tPauseMax preset to 8s. tInterval preset to 10s.

tStrokeTime: the variable tStrokeTime specifies the complete stroke time of the drive. If the drive has no continuous position feedback, the actual position of the drive will be emulated on the basis of a calculation. For this reason the precise input of the total stroke time of the actuator is important. The following condition must be met in any case: tStrokeTime > tInterval
If an incorrect variable value is present, then the last valid variable value is used, if available. If there is no valid last value, then the preset value is used. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variable is saved persistently. Preset to 200 s.

tSwitchOverDeadTime: dwell time at a change of direction (0..3600). During this time, both outputs are reset.
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 preset value is used. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variable is saved persistently. Preset to 500 ms.

eReferencingMode: Enum via which the referencing mode of the function block is specified.
Depending on the equipment of the actuator used, the position is referenced depending on eReferencingMode.
If eReferencingMode = eHVACReferencingMode_Emulation, then the position of the actuator is calculated on the basis of the control of bOpen and bClose by means of tStrokeTime. However, as the operating hours of the three-point valve or three-point damper increase, deviations could occur due to mechanical inaccuracies in the drive. In order to achieve automatic matching of the actual and calculated positions, one of the outputs bOpen or bClose will be set to TRUE upon reaching the calculated position rPosition of rMaxSetpoint or rMinSetpoint and it is correspondingly given the value of the parameter rMaxSetpoint or rMinSetpoint. A falling edge on the signal inputs bLimitSwitchOpenand bLimitSwitchClose is used to reference the position of the drive to rMaxSetpoint or rMinSetpoint. After reaching the respective limit switch, the corresponding output bOpenor bClose will remain set to TRUE.
If eReferencingMode = eHVACReferencingMode_AnalogFeedback the position of the drive is transferred by means of the signal rFeedback. After reaching the respective limit switch, the corresponding output bOpenor bClose will remain set to TRUE.
If an incorrect variable value is present, then the last valid variable value is used, if available. If there is no valid last value, then the preset value is used. bInvalidParameter is set if the parameter is incorrect, the function block continues to operate normally. The variable is saved persistently. Preset to 0.

Fig. 1.1

FB_HVACAnalogTo3Point 4:

Example

tInterval

120 seconds

tPauseMin

10 seconds

tPauseMax

60 seconds

 

 

rSetpoint

100%

rPosition

50%

tPauseInterval / bClose OR bOpen

35 seconds/85 seconds

 

 

rSetpoint

50%

rPosition

25%

tPauseInterval / bClose OR bOpen

47.5 seconds/72.5 seconds