FB_HVACI_CtrlStep

FB_HVACI_CtrlStep 1:

The function block serves the sequential control of power generators.

In conjunction with the power range table FB_HVACPowerRangeTable, the power step controller can be used for the control of several boilers, refrigerating machines or recooling plants.

Switching up or down to the next higher or next lower power step respectively takes place via an integral (rW - rX) and a time delay. First of all, the actual temperature value rX must have exceeded or fallen below a threshold value rW_High / rW_Low. Subsequently the integral starts. If the upper or lower limit value (rIntegralHigh / rIntegralLow) is reached at the output rI_Ctrl, then a timing element is started upon whose expiry (udiSecRT_DelayHigh / udiSecRT_DelayLow) the output iStep is incremented or decremented; see Program flowchart

FB_HVACI_CtrlStep 2:

An integration time setting of udiSecTiHigh/udiSecTiLow = 60 seconds means that the I-transfer element changes by one Kelvin per minute. In the case of a control deviation of rE = 5, the output of the I-transfer element rI_Ctrl has the value 5 after one minute. Example: bDirection = FALSE; udiSecTiLow = 60; rE = 2; rIntegralLow = 10
For the remaining control deviation of 2 and the lower integral limit of 10, rI_Ctrl = rIntegralLow after 5 minutes. The consequence of this is that a timing element with the delay time udiSecDelayLow is started. After its expiry (udiSecRT_DelayHigh / udiSecRT_DelayLow), the output iStep is incremented by 1 and the I-transfer element and the time delays are reset.

FB_HVACI_CtrlStep 3:

iStep is set to 1 for one PLC cycle if bEnable = TRUE, bError = FALSE, eCtrlMode = eHVACCtrlMode_Auto AND iNumberOfStepInProfile > 0.

Conditions

The I-transfer element is released, if

bEnable = TRUE AND NOT bError AND eCtrlMode = eHVACCtrlMode_Auto AND NOT bBlock
(
(rX >= rW_High AND ((iStep > 0 AND NOT bDirection) OR (iStep < iNumberOfStepInProfile AND bDirection))
OR
(rX < rW_Low AND ((iStep < iNumberOfStepInProfile AND NOT bDirection) OR (iStep > 0 ANDbDirection))
)

. If rI_Ctrl =rIntegralHigh / rIntegralLow, then the timing elements of the delay times udiSecDelayHigh / udiSecDelayLow are activated. After the expiry of the delay times udiSecRT_DelayHigh / udiSecRT_DelayLow, the steps of the power step sequence are controlled as follows:

iStep = iStep + 1 if

(rX < rW_Low AND iStep < iNumberOfStepInProfile AND NOT bDirection)
OR
(rX >= rW_High AND iStep < iNumberOfStepInProfile AND bDirection)

iStep = iStep -1 if

(rX < rW_Low AND iStep > 0 AND bDirection)
OR
(rX >= rW_High AND iStep > 0 AND NOT bDirection)

FB_HVACI_CtrlStep 4:

The I-transfer element and the internal time delays (udiSecDelayLow, udiSecDelayHigh) are reset after each change of iStep.

Transfer function of the I-transfer element (I_Ctrl)

FB_HVACI_CtrlStep 5:

Program flowchart

FB_HVACI_CtrlStep 6:

Program flowchart

FB_HVACI_CtrlStep 7:

Behavior of the different variables

FB_HVACI_CtrlStep 8:

The figure shows when each variable is used and how.

VAR_INPUT

eDataSecurityType       : E_HVACDataSecurityType;
bSetDefault             : BOOL;
bEnable                 : BOOL;
rW                      : REAL;
rX                      : REAL;
eCtrlMode               : E_HVACCtrlMode;
iManualStep             : INT;
bStepUp                 : BOOL;
bStepDown               : BOOL;
bDirection              : BOOL;
iNumberOfStepInProfile  : INT;
bBlock                  : 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 via TRUE. If bEnable = FALSE, then iStep is set constantly to 0. The check of the variable iNumberOfStepInProfile remains active. If an error occurs, it is displayed with bError = TRUE and can be acknowledged with bReset once the fault has been corrected.

rW: The setpoint is transferred with the rW variable.

rX: The variable rX is used to transfer the actual value.

eCtrlMode: Enum that specifies the operation mode of the function block (see E_HVACCtrlMode). If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Manual AND iNumberOfStepInProfile > 0, then the value of the output iStep can be specified via iManualStep. On starting the PLC, eCtrlMode = eHVACCtrlMode_Auto.

iManualStep: If the operation mode eCtrlModeeHVACCtrlMode_Manual AND bEnable = TRUE AND bError = FALSE AND iNumberOfStepInProfile > 0, then the value of the output iStep can be specified via iManualStep. The input range of iManualStep can be 0 at the least and the value of iNumberOfStepInProfile at the most.

bStepUp: If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Auto AND bBlock = FALSE, then the value of the output iStep can be incremented by 1 by a rising edge at the input bStepUp. This can be repeated until iStep = iNumberOfStepInProfile.

bStepDown: If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Auto AND bBlock = FALSE, then the value of the output iStep can be decremented by 1 by a rising edge at the input bStepDown. This can be repeated until iStep = 0.

bDirection: bDirection determines the control direction of the function block. FALSE = heating mode; TRUE = cooling mode

iNumberOfStepInProfile: Number of steps in the power step sequence. iNumberOfStepInProfile can be 0 at the least and the value of g_iMaxNumberOfSteps at the most. If the limit values are not adhered to, an error is output and displayed by bError = TRUE and iStep becomes 0.

bBlock: Using the input variable bBlock, the control of the function block can either be released or the output iStep is set to the value to the variable iNumberOfStepInProfile.

If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Auto AND bBlock = FALSE, then the I-transfer element and the internal timing elements are enabled for the control of the output iStep.

If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Auto AND bBlock = TRUE, then the I-transfer element and the internal timing elements are blocked and iStep = iNumberOfStepInProfile.

bReset: Input for acknowledgement of the faults once they have been corrected. Internally the system responds to a rising edge.

VAR_OUTPUT

iStep               : INT;
rI_Ctrl             : REAL;
rE                  : REAL;
rW_High             : REAL;
rW_Low              : REAL;
b_rW_High           : BOOL;
b_rW_Low            : BOOL;
udiSecRT_DelayHigh  : UDINT;
udiSecRT_DelayLow   : UDINT;
bError              : BOOL;
eErrorCode          : E_HVACErrorCodes;

iStep: The output variable iStep indicates the step in a power step sequence. On starting the function block, iStep = 1 if bEnable = TRUE, bError = FALSE, eCtrlMode = eHVACCtrlMode_Auto AND iNumberOfStepInProfile > 0. iStep can reach the value of iNumberOfStepInProfile at the most and can be 0 at the least.

The value of iStep can be specified manually via iManualStep if bEnable = TRUE, bError = FALSE AND eCtrlMode = eHVACCtrlMode_Manual.

The value of iStep can be incremented or decremented via the input variables bStepUp / bStepDown if bEnable = TRUE, bError = FALSE, eCtrlMode = eHVACCtrlMode_Auto AND bBlock = FALSE.

If bEnable = TRUE, bError = FALSE, eCtrlMode = eHVACCtrlMode_Auto AND bBlock = FALSE and the value of iStep has changed, then the delay timing elements and the I-transfer element are reset.

If bEnable = TRUE, bError = FALSE, eCtrlMode = eHVACCtrlMode_Auto, bBlock = FALSE AND iNumberOfStepInProfile > 0, the output of the I-transfer element rI_Ctrl = rIntegralHigh or rIntegralLow and one of the delay times tRemainingTimeDelayHigh / tRemainingTimeDelayLow = T#0s, then the output iStep is controlled as follows:

iStep = iStep + 1 if

(rX < rW_Low AND iStep < iNumberOfStepInProfile AND NOT bDirection)
OR
(rX >= rW_High AND iStep < iNumberOfStepInProfile AND bDirection).

iStep = iStep -1 if

(rX < rW_Low AND iStep > 0 AND bDirection)
OR
(rX >= rW_High AND iStep > 0 AND NOT bDirection), see Program flowchart

If bEnable = TRUE AND bError = FALSE AND eCtrlModeeHVACCtrlMode_Auto AND bBlock = TRUE, then the I-transfer element and the internal timing elements are blocked and iStep = iNumberOfStepInProfile.

rI_Ctrl: Output of the I-transfer element.
If rI_Ctrl >= rIntegralHigh or rIntegralLow and tRemainingTimeDelayHigh or tRemainingTimeDelayLow = T#0s, then the number of steps is incremented or decremented by 1 via iStep. Subsequently, the I-transfer element and the timing elements for stepping up or down are reset, so that stepping up or down is restarted, see Program flowchart.

rE: Control deviation with which the internal I-transfer element works: rE = rW - rX

rW_High: rW_High := rW + rHysteresisHigh – upper setpoint limit which, when exceeded by rX, causes the I-transfer element to be activated first, followed by the timing element of the delay time udiSecDelayHigh; see Functional description or Behavior of different variables.

rW_Low: rW_Low := rW - rHysteresisLow – lower setpoint limit which, when undershot by rX, causes the I-transfer element to be activated first, followed by the timing element of the delay time udiSecDelayLow; see Functional description or Behavior of different variables.

b_rW_High: b_rW_High goes TRUE if rX > rW_High.

b_rW_Low: b_rW_Low goes TRUE if rX < rW_Low.

udiSecRT_DelayHigh: Remaining time of the delay time udiSecDelayHigh.

udiSecRT_DelayLow: Remaining time of the delay time udiSecDelayLow.

bError: This output signals with a TRUE that there is an error and that there is a wrong parameter on the variable iNumberOfStepInProfile. iStep is set constantly to 0 and the Enum eErrorCode indicates the error code. Once the fault has been corrected the bError message must be acknowledged with bReset.

eErrorCode: returns the error number if an output bError is set (see E_HVACErrorCodes). The following error can occur in this function block: eHVACErrorCodes_InvalidParam_NumberOfStepInProfile.

FB_HVACI_CtrlStep 9:

To access the enum error number in the PLC eErrorCode can assigned to a variable of data type WORD. eHVACErrorCodes_Error_iNumberOfStepInProfil= 32

VAR_IN_OUT

rHysteresisHigh       : REAL;
rHysteresisLow        : REAL;
udiSecDelayHigh       : UDINT;
udiSecDelayLow        : UDINT;
udiSecTiHigh          : UDINT;
udiSecTiLow           : UDINT;
rIntegralHigh         : REAL;
rIntegralLow          : REAL;

rHysteresisHigh: Positive value of the upper limit of the control deviation; see Functional description or Behavior of different variables. rW_High := rW + rHysteresisHigh. The variable is saved persistently. Preset to 5.

rHysteresisLow: Positive value of the lower limit of the control deviation; see Functional description or Behavior of different variables. rW_Low := rWrHysteresisLow. The variable is saved persistently. Preset to 5.

udiSecDelayHigh: Delay time (0..g_udiMaxSec) after whose expiry iStep is incremented or decremented, see Functional description or Behavior of different variables. The variable is saved persistently. Preset to 300 s.

udiSecDelayLow: Delay time (0..g_udiMaxSec) after whose expiry iStep is incremented or decremented, see Functional description or Behavior of different variables. The variable is saved persistently. Preset to 300 s.

udiSecTiHigh: Integration time (0..g_udiMaxSec) for the upper limit of the I-transfer element in seconds; see Functional description or Behavior of different variables. udiSecTiHigh must be > 0. Otherwise the default value or the last valid variable value is used internally. The variable is saved persistently. Preset to 60 s.

udiSecTiLow: Integration time (0..g_udiMaxSec) for the lower limit of the I-transfer element; see Functional description or Behavior of different variables. udiSecTiLow must be > 0. Otherwise the default value or the last valid variable value is used internally. The variable is saved persistently. Preset to 60 s.

rIntegralHigh: Positive value for the upper limit at which the integration of the I-transfer element is stopped (anti-reset-windup measure) and one of the delay times starts; see Functional description or Behavior of different variables. The variable is saved persistently. Preset to 15.

rIntegralLow: Positive value for the lower limit at which the integration of the I-transfer element is stopped (anti-reset-windup measure) and one of the delay times starts; see Functional description or Behavior of different variables. The variable is saved persistently. Preset to 15.

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