FB_HVAC2PointCtrlSequence

FB_HVAC2PointCtrlSequence 1:

This function block represents a 2-point sequence controller. It is used for sequential staged control of discontinuous units. If can be used for cascades of vessels and in sequences of refrigerating machines or recooling plants for controlling the power stages. For each power stage an instance of the function block is used.

FB_HVAC2PointCtrlSequence 2:

FB_HVAC2PointCtrlSequence can be used in a control sequence with other sequence controllers from TcHVAC.lib.

Depending on the application several actuators (stages) are used for reaching a controlled variable, which operate in a so-called control sequence. In the control sequence shown below four stages are enabled via the respective output bOut = TRUE of FB_HVAC2PointCtrlSequence. With active control only one of the 2-point sequence controllers is active at a time. The outputs of the non-active 2-point sequence controller are fixed. This means that depending on the control direction bDirection of the individual controller; bOut is either TRUE or FALSE.

If the action of the active step is insufficient in the switched-on state, the active 2-point controller switches over to the neighboring 2-point controller on the left or right in the controller sequence via iCurrentSequence. This then takes over control of the steps. The previously active controller remains in the end position bOut = TRUE or FALSE, depending on the control direction.

Transfer function of the internal I-transfer element

FB_HVAC2PointCtrlSequence 3:

Through an internal AND link of the I-transfer element consisting of (tCtrl_I_Ti_HighLimit, tCtrl_I_Ti_LowLimit, rCtrl_I_HighLimit, rCtrl_I_LowLimit, st2PointCtrlSequence.rCtrl_I_Out) and the delay times tDelayIncreaseSequence/tDelayDecreaseSequence switching in the control sequence to the right or left is controlled via iCurrentSequence. The active sequence controller is indicated via bActiveCtrl = TRUE (iCurrentSequence = iMyNumberInSequence).

The I-transfer element and the timing elements for the delay times tDelayIncreaseSequence/tDelayDecreaseSequence are activated if

bActiveCtrl = TRUE AND
( (*Decrease*)
(
rX > st2PointCtrlSequence.rW_Max AND ((iMyNumberInSequence <= 1) = FALSE) AND
(
(bDirection = TRUE AND bOut = TRUE) OR
(bDirection = FALSE AND bOut = FALSE)
)
)
OR
( (*Increase*)
rX < st2PointCtrlSequence.rW_Min AND((iMyNumberInSequence >= iNumberOfSequences) = FALSE) AND
(
(bDirection = FALSE AND bOut = TRUE) OR
(bDirection = TRUE AND bOut = FALSE)
)
)
)

Once the I-transfer element (st2PointCtrlSequence.rCtrl_I_out output of the internal I-transfer element) AND the timing elements for the delay times tDelayIncreaseSequence/tDelayDecreaseSequence have been activated, switching in the control sequence to the right or left via iCurrentSequence is controlled as follows:

iCurrentSequence = iCurrentSequence - 1 when st2PointCtrlSequence.rCtrl_I_Out <= st2PointCtrlSequence.rCtrl_I_LowLimit AND st2PointCtrlSequence.tRemainingTimeDecreaseSequence = T#0s.

iCurrentSequence = iCurrentSequence + 1 when st2PointCtrlSequence.rCtrl_I_Out >= st2PointCtrlSequence.rCtrl_I_HighLimit AND st2PointCtrlSequence.tRemainingTimeIncreaseSequence = T#0s.

Behavior of the outputs of four FB_HVAC2PointCtrlSequence in a control sequence

FB_HVAC2PointCtrlSequence 4:
FB_HVAC2PointCtrlSequence 5:

In the control sequence of four FB_HVAC2PointCtrlSequence controllers shown above there may be no gap in the allocation of iMyNumberInSequence (1,2,3,4) and iNumberOfSequence (4), since otherwise automatic switching of the controllers from the active controller to the adjacent controller to the right or left in the control sequence would not work.

FB_HVAC2PointCtrlSequence 6:

If bEnable =FALSE OR bError = TRUE OR (e2PointCtrlMode =eHVAC2PointCtrlMode_On_BMS OR eHVAC2PointCtrlMode_On_OP OR eHVAC2PointCtrlMode_Off_BMS OR eHVAC2PointCtrlMode_Off_OP), then the automatic switchover of the controller from the active controller to the neighboring controller on the left or right in the control sequence remains in operation. The switching mode is therefore always active. The active function block is displayed with bActiveCtrl = TRUE. Depending on the control deviation rE up- or down-switching of the sequence via iCurrentSequence is directly executed. If rX >= rW, then iCurrentSequence = iCurrentSequence - 1. If rX < rW, then iCurrentSequence = iCurrentSequence + 1.

VAR_INPUT

eDataSecurityType  : E_HVACDataSecurityType;
bSetDefault        : BOOL;
bEnable            : BOOL;
e2PointCtrlMode    : E_HVAC2PointCtrlMode;
bDirection         : BOOL;
rW                 : REAL;
rX                 : REAL;
iNumberOfSequences : INT;
iMyNumberInSequence: INT;
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, the 2-point sequence controller is disabled. Validation of the variables iNumberOfSequences, iMyNumberInSequence, iCurrentSequence and tTi_Ctrl_I is still active. If an error occurs, it is displayed with bError = TRUE and can be acknowledged with bReset once the fault has been corrected.

e2PointCtrlMode: Enum that specifies the operation mode of the 2-point sequence controller (see E_HVAC2PointCtrlMode). If bEnable = TRUE AND bError = FALSE, then the output bOut can be switched on or off directly via the enum. On starting the PLC e2PointCtrlModeeHVAC2PointCtrlMode_Auto_BMS.
Up- or down-switching of the sequence via iCurrentSequence does not depend on mode e2PointCtrlMode of the 2-point sequence controller.

bDirection: bDirection determines the control direction of the internal 2-point controller. FALSE = heating mode;  TRUE = cooling mode.

rW: The setpoint is transferred with the rW variable.

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

iNumberOfSequences: Number of controllers in the sequence (1..32). If iNumberOfSequences <= 0 an error is issued and indicated with bError = TRUE. The number of device in a sequence is not exceeded by the active sequence controller via iCurrentSequence.

iMyNumberInSequence: The 2-point controller's own number in the sequence (1..32). If iMyNumberInSequence > iNumberOfSequences OR iMyNumberInSequence <= 0, then an error is output and indicated by bError = TRUE.

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

VAR_OUTPUT

bOut                  : BOOL;
bActiveCtrl           : BOOL;
b_rW_Max              : BOOL;
b_rW_Min              : BOOL;
rE                    : REAL;
e2PointCtrlState      : E_HVAC2PointCtrlMode;
st2PointCtrlSequence  : ST_HVAC2PointCtrlSequence;
bError                : BOOL;
eErrorCode            : E_HVACErrorCodes;

bOut: Output of the 2-point sequence controller.

bOut becomes TRUE if

1.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_OP ) AND
bActiveCtrl = TRUE AND
(
(bDirection = TRUE AND ( rX > st2PointCtrlSequence.rW_Max )) OR ( bDirection = FALSE AND ( rX < st2PointCtrlSequence.rW_Min ))
)

2.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_OP ) AND
(
( bDirection = TRUE AND ( iCurrentSequence < iMyNumberInSequence )) OR ( bDirection = FALSE AND ( iCurrentSequence > iMyNumberInSequence ))
)

3.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_On_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_On_OP )

bOut becomes FALSE if

1.
bEnable = FALSE OR bError = TRUE

2.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_OP ) AND
bActiveCtrl = TRUE AND
(
( bDirection = TRUE AND ( rX < st2PointCtrlSequence.rW_Min )) OR ( bDirection = FALSE AND ( rX > st2PointCtrlSequence.rW_Max ))
)

3.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_Auto_OP ) AND
(
( bDirection = TRUE AND ( iCurrentSequence > iMyNumberInSequence )) OR ( bDirection = FALSE AND ( iCurrentSequence < iMyNumberInSequence ))
)

4.
bEnable = TRUE AND bError = FALSE AND
( e2PointCtrlMode = eHVAC2PointCtrlMode_Off_BMS OR e2PointCtrlMode = eHVAC2PointCtrlMode_Off_OP )

bActiveCtrl: bActiveCtrl indicates with TRUE that the function block is the active one in the sequence. bActiveCtrl goes TRUE if bEnable = TRUE, bError = FALSE AND iCurrentSequence = iMyNumberInSequence.

b_rW_Max: b_rW_Max goes TRUE if rX > st2PointCtrlSequence.rW_Max.

b_rW_Min: b_rW_Min goes TRUE if rX < st2PointCtrlSequence.rW_Min.

rE: Control deviation: rE = rW - rX

e2PointCtrlState: Enum that indicates the state of the operation mode e2PointCtrlMode of the 2-point sequence controller (see E_HVAC2PointCtrlMode).

st2PointCtrlSequence: The structure indicates various states, inputs and outputs of the function block (see ST_HVAC2PointCtrlSequence). Furthermore the remaining times of the VAR_IN_OUT variables tDelayIncreaseSequence and tDelayDecreaseSequence are output if their function is active. Via st2PointCtrlSequence.rCtrl_I_Out the output signal of the internal I-transfer element is displayed.

st2PointCtrlSequence.tRemainingTimeIncreaseSequence: Remaining time of delay time tDelayIncreaseSequence.

st2PointCtrlSequence.tRemainingTimeDecreaseSequence: Remaining time of delay time tDelayDecreaseSequence.

st2PointCtrlSequence.rX: State of rX.

st2PointCtrlSequence.rW_Max: st2PointCtrlSequence.rW_Max := rW + rW_HighLimit – upper setpoint limit; if rX exceeds it, the internal I-transfer element and the timing elements of the delay times tDelayIncreaseSequence/tDelayDecreaseSequence can be activated or deactivated respectively, see Transfer function of the internal I-transfer element in this document

st2PointCtrlSequence.rW_Min: st2PointCtrlSequence.rW_Min := rW - rW_LowLimit – lower setpoint limit; if rX falls below it, the internal I-transfer element and the timing elements of the delay times tDelayIncreaseSequence/tDelayDecreaseSequence can be activated or deactivated respectively, see Transfer function of the internal I-transfer element in this document

st2PointCtrlSequence.rE: Control deviation: rE = rW - rX

st2PointCtrlSequence.rCtrl_I_HighLimit: Upper limit value at which the integration of the internal I-transfer element is stopped. st2PointCtrlSequence.rCtrl_I_HighLimit = rCtrl_I_HighLimit

st2PointCtrlSequence.rCtrl_I_LowLimit: Lower limit value at which the integration of the internal I-transfer element is stopped. st2PointCtrlSequence.rCtrl_I_Low = rCtrl_I_LowLimit * (-1)

st2PointCtrlSequence.rCtrl_I_Out: Output of the internal I-transfer element.
If st2PointCtrlSequence.rCtrl_I_Out = st2PointCtrlSequence.rCtrl_I_HighLimit OR
st2PointCtrlSequence.rCtrl_I_LowLimit AND
either st2PointCtrlSequence.tRemainingTimeIncreaseSequence OR
st2PointCtrlSequence.tRemainingTimeDecreaseSequence = T#0s AND
bActive = TRUE, then the number of the active controller iCurrentSequence is incremented or decremented by 1, depending on bDirection.

st2PointCtrlSequence.e2PointCtrlState: see e2PointCtrlState 

st2PointCtrlSequence.iNumberOfSequences: see iNumberOfSequences

st2PointCtrlSequence.iMyNumberInSequence: see iNumberOfSequences

st2PointCtrlSequence.iCurrentSequence: see iCurrentSequence

st2PointCtrlSequence.bEnable: see bEnable

st2PointCtrlSequence.bError: see bError

st2PointCtrlSequence.bOut: see bOut

st2PointCtrlSequence.bActiveCtrl: see bActiveCtrl

st2PointCtrlSequence.b_rW_Max: see b_rW_Max

st2PointCtrlSequence.b_rW_Min: see b_rW_Min

bError: The output is TRUE if an error is active and one of the variables iNumberOfSequences, iMyNumberInSequence or iCurrentSequence has an incorrect parameter. Once the fault has been corrected the bError message must be acknowledged with bReset. The eErrorCode enum indicates the error number. If bError is TRUE, output bOut becomes FALSE.

eErrorCode: returns the error number if an output bError is set (E_HVACErrorCodes E_HVACErrorCodes). The following errors can occur in this function block: eHVACErrorCodes_Error_iMyNumberInSequence, eHVACErrorCodes_Error_iNumberOfSequences, eHVACErrorCodes_Error_iCurrentSequences

FB_HVAC2PointCtrlSequence 7:

To access the enum error number in the PLC eErrorCode can assigned to a variable of data type WORD.
eHVACErrorCodes_Error_iNumberOfSequences = 27 eHVACErrorCodes_Error_iMyNumberInSequence = 28 eHVACErrorCodes_Error_iCurrentSequences = 29

VAR_IN_OUT

rW_HighLimit            : REAL;
rW_LowLimit             : REAL;
tDelayIncreaseSequence  : TIME;
tDelayDecreaseSequence  : TIME;
tCtrl_I_Ti_HighLimit    : TIME;
tCtrl_I_Ti_LowLimit     : TIME;
rCtrl_I_HighLimit       : REAL;
rCtrl_I_LowLimit        : REAL;
iCurrentSequence        : INT;

rW_HighLimit: Positive value of the upper control deviation limit. st2PointCtrlSequence.rW_Max =rW_Max := rW + rW_HighLimit.
The variable is saved persistently. Preset to 5.

rW_LowLimit: Positive value of the lower control deviation limit. st2PointCtrlSequence.rW_Min =rW_Min := rW - rW_LowLimit.
The variable is saved persistently. Preset to 5.

tDelayIncreaseSequence: Delay time after whose expiry iCurrentSequence is incremented by 1, see Transfer function of the internal I-transfer element in this document.
The variable is saved persistently. Preset to 5 min.

tDelayDecreaseSequence: Delay time after which iCurrentSequence is decreased by 1, see Transfer function of the internal I-transfer element in this document.
The variable is saved persistently. Preset to 5 min.

tCtrl_I_Ti_HighLimit: Integration time for the upper limit of the internal I-transfer element, see Transfer function of the internal I-transfer element in this document. tCtrl_I_Ti_HighLimit must be > T#0s.
The variable is saved persistently. Preset to 10 min.

tCtrl_I_Ti_LowLimit: Integration time for the lower limit of the internal I-transfer element, see Transfer function of the internal I-transfer element in this document. tCtrl_I_Ti_LowLimit must be > T#0s.
The variable is saved persistently. Preset to 10 min.

rCtrl_I_HighLimit: Positive value for the upper limit at which the integration of the internal I-transfer element is stopped (ARW measure, anti-reset windup), see Transfer function of the internal I-transfer element in this document.
The variable is saved persistently. Preset to 10.

rCtrl_I_LowLimit: Negative value for the lower limit at which the integration of the internal I-transfer element is stopped (ARW measure, anti-reset windup), see Transfer function of the internal I-transfer element in this document.
The variable is saved persistently. Preset to -10.

iCurrentSequence: Number of the active controller in the sequence (0..32). The number of devices in a sequence iNumberOfSequences is not exceeded by the active sequence controller over iCurrentSequence.
If iCurrentSequence > iNumberOfSequences or iCurrentSequence < 0 an error is indicated with bError = TRUE.
Up- or down-switching of the sequence via iCurrentSequence depending on the control deviation rE takes place if the function block is active in the sequence bActiveCtrl = TRUE.

1. iCurrentSequence = iCurrentSequence - 1 if st2PointCtrlSequence.rCtrl_I_Out >= st2PointCtrlSequence.rLimit_Ctrl_I_Min AND st2PointCtrlSequence.tRemainingTimeDecreaseSequence = T#0s AND bActiveCtrl = TRUE

2. iCurrentSequence = iCurrentSequence + 1 if st2PointCtrlSequence.rCtrl_I_Out >= st2PointCtrlSequence.rLimit_Ctrl_I_Max AND st2PointCtrlSequence.tRemainingTimeIncreaseSequence = T#0s AND bActiveCtrl = TRUE

FB_HVAC2PointCtrlSequence 8:

To ensure correct functioning of the automatic switchover of the controller from the active controller to the neighboring controller on the left or right in the control sequence, iCurrentSequence may not be written to continuously from the outside in a control sequence. The active sequence controller must be defined when starting a control sequence. iCurrentSequence must be written for one PLC cycle and must be > 0 and <= iNumberOfSequences.

FB_HVAC2PointCtrlSequence 9:

If bEnable =FALSE OR bError = TRUE OR (e2PointCtrlMode =eHVAC2PointCtrlMode_On_BMS OR eHVAC2PointCtrlMode_On_OP OR eHVAC2PointCtrlMode_Off_BMS OR eHVAC2PointCtrlMode_Off_OP), then the automatic switchover of the controller from the active controller to the neighboring controller on the left or right in the control sequence remains in operation. The switching mode is therefore always active. The active function block is displayed with bActiveCtrl = TRUE. Depending on the control deviation rE up- or down-switching of the sequence via iCurrentSequence is directly executed. If rX >= rW, then iCurrentSequence = iCurrentSequence - 1. If rX < rW, then iCurrentSequence = iCurrentSequence + 1.

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