FB_HVACCmdCtrl_8

With this function block, individual units in a system can be sequentially switched on (bQ_Cmd > bQ1 > bQ2… bQ8) or switched off (bQ8 > bQ7 > bQ6… bQ_Cmd) in a certain order. FB_HVACCmdCtrl_8 can be used as the starting function block of a ventilation system.
An event and a parameter structure with time variables belong to each output. These can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output.
Switch-on condition if and are TRUE: bEn bCmd
Q(n) = Q(n - 1) AND Event(n) AND (DelayOn(n) = 0 AND (MinOff(n) = 0 AND stState.udiStep = n
Example for the output bQ_Cmd
bQ_Cmd = bCmd AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[0] = 0 AND stState.udiStep = 0
Example for the output bQ2
bQ2 = bQ1 AND bEvt2 AND stState.udiSecRT_DelayOn = 0 AND stState[2].udiSecRT_MinOff = 0 AND stState.udiStep = 2
Switch-off condition if is TRUE and is FALSE: bEn bCmd
Q(n) = NOT Q(n + 1) AND (DelayOff(n) = 0 AND (MinOn(n) = 0 AND stState.udiStep = n
Example for the output bQ8
bQ8 = stState.udiSecRT_DelayOff = 0 AND stState[7].udiSecRT_MinOn = 0 AND stState.udiStep = 8
Example for the output bQ_Cmd
bQ_Cmd = NOTbQ1 AND stState.udiSecRT_DelayOff = 0 AND stState[0].udiSecRT_MinOn = 0 AND stState.udiStep = 0
Current step
On the basis of the status variable stState.udiStep it is possible to see which step the function block is currently in.
Switch-on and switch-off sequence
If bEn and bCmd are TRUE the switch-on sequence is (bQ_Cmd > bQ1 > bQ2 … bQ8). The switch-off sequence (bQ8 > bQ7 > bQ6 … bQ_Cmd) is active if bEn = TRUE and bCmd = FALSE.
If an output has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off phase. In the switch-off sequence, no event (bEvt1-8) has any effect on the switch-off conditions of the outputs.
If the function block is in the switch-off sequence and the switch-on phase is activated by bCmd = TRUE, then the function block starts in step 0 with the switch-on conditions of bQ_Cmd. For the other outputs the minimum switch-on or switch-off times are active until their expiry.

Time responses of an individual step
The diagram shows the time responses of step 1 or the output bQ1.

VAR_INPUT
eDST : E_HVACDataSecurityType;
bEn : BOOL;
bCmd : BOOL;
bEvt1 : BOOL;
bEvt2 : BOOL;
bEvt3 : BOOL;
bEvt4 : BOOL;
bEvt5 : BOOL;
bEvt6 : BOOL;
bEvt7 : BOOL;
bEvt8 : 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. |
bEn: Enables the function block. The function block is disabled if bEn is FALSE. All outputs go to FALSE and the timers for the switch-on and switch-off delays as well as the minimum switch-on and switch-off times are reset. A collective error message or an emergency stop switch for immediately switching off a system can be connected to the input bEn.
bCmd: The switch-on or switch-off sequence of the function block is defined with bCmd. If bCmd is TRUE, then the function block is in the switch-on sequence of the outputs. The switching on of a system could come, for example, from a timer program. If bCmd is FALSE, then the function block is in the switch-off sequence of the outputs.
bCmd counts as one of the switch-on conditions of bQ_Cmd.
bEvt1: The event bEvt1 counts as one of the switch-on conditions of bQ1. In the switch-on phase of bQ1, the switch-on delay of the output is active only if bEvt1 is TRUE.
Switch-on condition:
bQ1 = bQ_CmdANDbEvt1ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[1] = 0 AND stState.udiStep = 1
The event bEvt1 has no effect on the switch-off condition of bQ1.
bEvt2: The event bEvt2 counts as one of the switch-on conditions of bQ2. In the switch-on phase of bQ2, the switch-on delay of the output is active only if bEvt2 is TRUE.
Switch-on condition:
bQ2 = bQ1ANDbEvt2 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[2] = 0 AND stState.udiStep = 2
The event bEvt2 has no effect on the switch-off condition of bQ2.
bEvt3: The event bEvt3 counts as one of the switch-on conditions of bQ3. In the switch-on phase of bQ3, the switch-on delay of the output is active only if bEvt3 is TRUE.
Switch-on condition:
bQ3 = bQ2 AND bEvt3ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[3] = 0 AND stState.udiStep = 3
The event bEvt3 has no effect on the switch-off condition of bQ3.
bEvt4: The event bEvt4 counts as one of the switch-on conditions of bQ4. In the switch-on phase of bQ4, the switch-on delay of the output is active only if bEvt4 is TRUE.
Switch-on condition:
bQ4 = bQ3 AND bEvt4ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[4] = 0 AND stState.udiStep = 4
The event bEvt4 has no effect on the switch-off condition of bQ4.
bEvt5: The event bEvt5 counts as one of the switch-on conditions of bQ5. In the switch-on phase of bQ5, the switch-on delay of the output is active only if bEvt5 is TRUE.
Switch-on condition:
bQ5 = bQ4 AND bEvt5ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[5] = 0 AND stState.udiStep = 5
The event bEvt5 has no effect on the switch-off condition of bQ5.
bEvt6: The event bEvt6 counts as one of the switch-on conditions of bQ6. In the switch-on phase of bQ6, the switch-on delay of the output is active only if bEvt6 is TRUE.
Switch-on condition:
bQ6 = bQ5 AND bEvt6ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[6] = 0 AND stState.udiStep = 6
The event bEvt6 has no effect on the switch-off condition of bQ6.
bEvt7: The event bEvt7 counts as one of the switch-on conditions of bQ7. In the switch-on phase of bQ7, the switch-on delay of the output is active only if bEvt7 is TRUE.
Switch-on condition:
bQ7 = bQ6ANDbEvt7 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[7] = 0 AND stState.udiStep = 7
The event bEvt7 has no effect on the switch-off condition of bQ7.
bEvt8: The event bEvt8 counts as one of the switch-on conditions of bQ8. In the switch-on phase of bQ8, the switch-on delay of the output is active only if bEvt8 is TRUE.
Switch-on condition:
bQ8 = bQ7 AND bEvt8ANDstState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[8] = 0 AND stState.udiStep = 8
The event bEvt8 has no effect on the switch-off condition of bQ8.
VAR_OUTPUT
bQ_Cmd : BOOL;
bQ1 : BOOL;
bQ2 : BOOL;
bQ3 : BOOL;
bQ4 : BOOL;
bQ5 : BOOL;
bQ6 : BOOL;
bQ7 : BOOL;
bQ8 : BOOL;
stState : ST_HVACCmdCtrl_8State;
bQ_Cmd: Output to enable a device. If the output bQ_Cmd has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The input variable bCmd and the parameter structure stParamCmd belong to bQ_Cmd. bCmd is one of the switch-on conditions of bQ_Cmd. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ_Cmd = bCmdANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[0] = 0 ANDstState.udiStep = 0
Switch-off condition
bQ_Cmd = NOTbQ1ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[0] = 0 ANDstState.udiStep = 0
bQ1: Output to enable a device. If the output bQ1 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 1 bEvt1 and the parameter structure stParam1 belong to bQ1. bEvt1 is one of the switch-on conditions of bQ1. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ1 = bEvt1ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[1] = 0 ANDstState.udiStep = 1
Switch-off condition
bQ1 = NOTbQ1ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[1] = 0 ANDstState.udiStep = 1
bQ2: Output to enable a device. If the output bQ2 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 2 bEvt2 and the parameter structure stParam2 belong to bQ2. bEvt2 is one of the switch-on conditions of bQ2. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ2 = bEvt2 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[2] = 0 AND stState.udiStep = 2
Switch-off condition
bQ2 = NOTbQ2 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[2] = 0 AND stState.udiStep = 2
bQ3: Output to enable a device. If the output bQ3 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 3 bEvt3 and the parameter structure stParam3 belong to bQ3. bEvt3 is one of the switch-on conditions of bQ3. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ3 = bEvt3 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[3] = 0 ANDstState.udiStep = 3
Switch-off condition
bQ3 = NOTbQ3 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[3] = 0 AND stState.udiStep = 3
bQ4: Output to enable a device. If the output bQ4 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 4 bEvt4 and the parameter structure stParam4 belong to bQ4. bEvt4 is one of the switch-on conditions of bQ4. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ4 = bEvt4 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[4] = 0 AND stState.udiStep = 4
Switch-off condition
bQ4 = NOTbQ4 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[4] = 0 AND stState.udiStep = 4
bQ5: Output to enable a device. If the output bQ5 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 5 bEvt5 and the parameter structure stParam5 belong to bQ5. bEvt5 is one of the switch-on conditions of bQ5. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ5 = bEvt5 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[5] = 0 AND stState.udiStep = 5
Switch-off condition
bQ5 = NOT bQ5 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[5] = 0 AND stState.udiStep = 5
bQ6: Output to enable a device. If the output bQ6 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 6 bEvt6 and the parameter structure stParam6 belong to bQ6. bEvt6 is one of the switch-on conditions of bQ6. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ6 = bEvt6 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[6] = 0 AND stState.udiStep = 6
Switch-off condition
bQ6 = NOTbQ6 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[6] = 0 AND stState.udiStep = 6
bQ7: Output to enable a device. If the output bQ7 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 7 bEvt7 and the parameter structure stParam7 belong to bQ7. bEvt7 is one of the switch-on conditions of bQ7. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ7 = bEvt7 AND stState.udiSecRT_DelayOn = 0 AND stState.udiSecRT_MinOff[7] = 0 AND stState.udiStep = 7
Switch-off condition
bQ7 = NOTbQ7 AND stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[7] = 0 AND stState.udiStep = 7
bQ8: Output to enable a device. If the output bQ8 has been set in the switch-on sequence, then it remains latched and is only reset in the switch-off sequence.
The event 8 bEvt8 and the parameter structure stParam8 belong to bQ8. bEvt8 is one of the switch-on conditions of bQ8. The time variables of the parameter structure can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration for the output. The state of the time responses is indicated with the output structure stState.
Switch-on condition
bQ8 = bEvt8ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[8] = 0 ANDstState.udiStep = 8
Switch-off condition
bQ8 = stState.udiSecRT_DelayOff = 0 AND stState.udiSecRT_MinOn[8] = 0 AND stState.udiStep = 8
stState: This structure indicates the remaining times of the switch-on or switch-off delay of the active step and the minimum switch-on or minimum switch-off duration of the outputs (see ST_HVACCmdCtrl_8State).
stState.udiSecRT_DelayOn: In the switch-on phase of the outputs (bCmd = TRUE), the remaining time of the switch-on delay of the current step stState.udiStep is indicated by stState.udiSecRT_DelayOn.
Example: If stState.udiStep = 5, then the function block is in step 5. The time variable of the parameter structure stParam5.udiSecDelayOn is used for the switch-on delay of the output bQ5 and the remaining time is indicated by udiSecRT_DelayOn.
stState.udiSecRT_DelayOff: In the switch-off phase of the outputs (bCmd = FALSE) the remaining time of the switch-off delay of the current step stState.udiStep is indicated by udiSecRT_DelayOff.
Example: If stState.udiStep = 0, then the function block is in step 0. The time variable stParamCmd.udiSecDelayOff is used for the switch-off delay of the output bQ_Cmd and the remaining time is indicated by udiSecRT_DelayOff.
stState.udiStep: State indicating which step the function block is in.
Examples:
- If stState.udiStep = 0, then the function block is in the switch-on or switch-off sequence of the output bQ_Cmd.
- If stState.udiStep = 1, then the function block is in the switch-on or switch-off sequence of the output bQ1.
- If stState.udiStep = 8, then the function block is in the switch-on or switch-off sequence of the output bQ8
stState.udiSecRT_MinOn[0]: .. g_iNumOfCmdCtrl_8 The remaining time of the minimum switch-on duration of the outputs is indicated in the one-dimensional field (Table) stState.udiSecRT_MinOn[0..g_iNumOfCmdCtrl_8]. Following the expiry of the minimum switch-on duration of an output, the output can be switched off in the current step stState.udiStep.
stState.udiSecRT_MinOff[0]: .. g_iNumOfCmdCtrl_8 The remaining time of the minimum switch-off duration of the outputs is indicated in the one-dimensional field (Table) stState.udiSecRT_MinOff[0..g_iNumOfCmdCtrl_8]. Following the expiry of the minimum switch-off duration of an output, the output can be switched on in the current step stState.udiStep.
VAR_IN_OUT
stParamCmd : ST_HVACCmdCtrl_8Param;
stParam1 : ST_HVACCmdCtrl_8Param;
stParam2 : ST_HVACCmdCtrl_8Param;
stParam3 : ST_HVACCmdCtrl_8Param;
stParam4 : ST_HVACCmdCtrl_8Param;
stParam5 : ST_HVACCmdCtrl_8Param;
stParam6 : ST_HVACCmdCtrl_8Param;
stParam7 : ST_HVACCmdCtrl_8Param;
stParam8 : ST_HVACCmdCtrl_8Param;
stParamCmd: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ_CMD (see ST_HVACCmdCtrl_8Param). The variable is saved persistently.
stParam1: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ1. The variable is saved persistently.
stParam2: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ2. The variable is saved persistently.
stParam3: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ3. The variable is saved persistently.
stParam4: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ4. The variable is saved persistently.
stParam5: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ5. The variable is saved persistently.
stParam6: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ6. The variable is saved persistently.
stParam7: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ7. The variable is saved persistently.
stParam8: The structure contains time variables that can be used to define a switch-on or switch-off delay as well as a minimum switch-on or minimum switch-off duration of the output bQ8. The variable is saved persistently.
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 |