FB_HVACCmdCtrl_8

FB_HVACCmdCtrl_8 1:

Application

With this function block, individual aggregates in a system can be sequentially switched on (bQ_Cmd > bQ1 > bQ2 ... bQ8) or switched off (bQ8 > bQ7 > bQ6 ... bQ_Cmd). 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 ANDstState.udiStep = n

Example for the output bQ_Cmd

bQ_Cmd = bCmdANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[0] = 0 ANDstState.udiStep = 0

Example for the output bQ2

bQ2 = bQ1ANDbEvt2ANDstState.udiSecRT_DelayOn = 0 ANDstState[2].udiSecRT_MinOff = 0 ANDstState.udiStep = 2

Switch-off condition if and are TRUE: bEn bCmd

Q(n) = NOT Q(n + 1) AND (DelayOff(n) = 0 AND (MinOn(n) = 0 ANDstState.udiStep = n

Example for the output bQ8

bQ8 = stState.udiSecRT_DelayOff = 0 ANDstState[7].udiSecRT_MinOn = 0 ANDstState.udiStep = 8

Example for the output bQ_Cmd

bQ_Cmd = NOTbQ1 AND stState.udiSecRT_DelayOff = 0 ANDstState[0].udiSecRT_MinOn = 0 ANDstState.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 ifbEn = 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.

FB_HVACCmdCtrl_8 2:

Time responses of an individual step

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

FB_HVACCmdCtrl_8 3:

The application example shows the function block FB_HVACCmdCtrl_8 in conjunction with FB_HVACPriority_INT_8 as the system start program for a ventilation system. The example AC03_StartAC.PRG can be found in the folder Language CFC > SpecialFunctions > Start.

Application example

Download

Required library

tchvac.zip

TcHVAC.lib

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;

eDST:if eDST := 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_HVACCmdCtrl_8 4:Example_PERSISTENT.zip

If eDST:= 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 eDST:= eHVACDataSecurityType_Persistent. It would lead to early wear of the flash memory.

bEn: enable of 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 ANDstState.udiSecRT_MinOff[1] = 0 ANDstState.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 = bQ1ANDbEvt2ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[2] = 0 ANDstState.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 = bQ2ANDbEvt3ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[3] = 0 ANDstState.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 = bQ3ANDbEvt4ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[4] = 0 ANDstState.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 = bQ4ANDbEvt5ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[5] = 0 ANDstState.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 = bQ5ANDbEvt6ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[6] = 0 ANDstState.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 = bQ6ANDbEvt7ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[7] = 0 ANDstState.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 = bQ7ANDbEvt8ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[8] = 0 ANDstState.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 phase.

To bQ_Cmd belongs the input variable bCmd and the parameter structure stParamCmd. 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 phase.

To bQ1 belongs the event 1 bEvt1 and the parameter structure stParam1. 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 phase.

To bQ2 belongs the event 2 bEvt2 and the parameter structure stParam2. 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 = bEvt2ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[2] = 0 ANDstState.udiStep = 2

Switch-off condition

bQ2 = NOTbQ2ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[2] = 0 ANDstState.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 phase.

To bQ3 belongs the event 3 bEvt3 and the parameter structure stParam3.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 = bEvt3ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[3] = 0 ANDstState.udiStep = 3

Switch-off condition

bQ3 = NOTbQ3ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[3] = 0 ANDstState.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 phase.

To bQ4 belongs the event 4 bEvt4 and the parameter structure stParam4. 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 = bEvt4ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[4] = 0 ANDstState.udiStep = 4

Switch-off condition

bQ4 = NOTbQ4ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[4] = 0 ANDstState.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 phase.

To bQ5 belongs the event 5 bEvt5 and the parameter structure stParam5. 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 = bEvt5ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[5] = 0 ANDstState.udiStep = 5

Switch-off condition

bQ5 = NOTbQ5ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[5] = 0 ANDstState.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 phase.

To bQ6 belongs the event 6 bEvt6 and the parameter structure stParam6. 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 = bEvt6ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[6] = 0 ANDstState.udiStep = 6

Switch-off condition

bQ6 = NOTbQ6ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[6] = 0 ANDstState.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 phase.

To bQ7 belongs the event 7 bEvt7 and the parameter structure stParam7. 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 = bEvt7ANDstState.udiSecRT_DelayOn = 0 ANDstState.udiSecRT_MinOff[7] = 0 ANDstState.udiStep = 7

Switch-off condition

bQ7 = NOTbQ7ANDstState.udiSecRT_DelayOff = 0 ANDstState.udiSecRT_MinOn[7] = 0 ANDstState.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 phase.

To bQ8 belongs the event 8 bEvt8 and the parameter structure stParam8. 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 ANDstState.udiSecRT_MinOn[8] = 0 ANDstState.udiStep = 8

stState: this structure indicates the remaining time of the switch-on or switch-off delay of the active step and the minimum switch-on and switch-off duration of the outputs.

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