FB_HVACScheduler1ch

This function block is a weekly scheduler with one channel. Any desired combination of days of the week can be assigned to the channel. The channel can be defined for one-shot or recurring events. Besides the switching signal, the switch-on and switch-off edges plus the next switch-on or switch-off time as a countdown are available as outputs. The data of the channel are transferred as a reference. The function block is therefore able to check the data for changes and to save it as persistent data. After booting, the data are thus available to the BMS again. The switch-on and switch-off points can be specified to the exact second via the variables tiOn_ss and tiOff_ss of the respective time channel.
![]() | If the input variable bEnable = FALSE, then the output bOutput = FALSE. The channel stTimeChannel remains active. |
VAR_INPUT
eDataSecurityType : E_HVACDataSecurityType;
bSetDefault : BOOL;
bEnable : BOOL;
dtSystemTime : DT;
uiOffsetBefore : UINT;
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 by the variable bEnable. If bEnable = FALSE there is no switching at the output bOutput.
dtSystemTime: The variable dtSystemTime transfers the computer system time to the timer program.
uiOffsetBefore: The switch-on time is brought forward by this number of minutes. This function is useful for the time-optimized switching on of heating circuits. A maximum of 240 min, i.e. 4 hours, may be entered. If the resulting switch-on time is before midnight on the previous day, then midnight will be chosen as the switch-on time. The switch-off time is not affected.
bReset: Acknowledge input in the event of a fault. Resets the flag bInvalidParameter
Example 1:
Switch-on period from 1:30 to 5:30; uiOffsetBefor has the value 150 min. The switch-on time is brought forward by only 90 minutes to 0:00.

Example 2:
Switch-on period from 13:30 to 17:30; uiOffsetBefor has the value 150 min. The switch-on time is brought forward by 150 minutes to 11:00.

VAR_OUTPUT
bOutput : BOOL;
bEdgeOn : BOOL;
bEdgeOff : BOOL;
tNextOn : TIME;
tNextOff : TIME;
bInvalidParameter: BOOL;
bOutput: Is TRUE if one of the channels has switched on.
bEdgeOn: Is TRUE for one PLC cycle after bOutput switches on.
bEdgeOff: Is TRUE for one PLC cycle after bOutput switches off.
tNextOn: Time until the next switch-on of the program. Maximum value 10080 minutes (1 week).
tNextOff: Time until the next switch-off of the program. Maximum forecast until midnight.
bInvalidParameter: An error occurred during the plausibility check. It is deleted again by bReset.
VAR_IN_OUT
stTimeChannel : ST_HVACTimeChannel;
stTimeChannel: With the variable stTimeChannel it is possible to generate one switch-on time per day of the week (see ST_HVACTimeChannel).
Special notes regarding time input
The following applies:
- Switch-on time 00:00:00: Switch on begins at 0.00 on the selected day.
- Switch-off time 00:00:00: Switch-off takes place at 23:59:59 on the selected day.

The following applies:
If the switch-on time is later than the switch-off time, the switch-on period is extended through midnight into the next day, regardless of whether the next day is selected.

This setting produces:

For each instance of the function block FB_HVACScheduler1ch it is necessary to create a structure variable of type ST_HVACTimeChannel, which is transferred as a reference (VAR_IN_OUT).
Example:
VAR_GLOBAL
stTimeChannel : ST_HVACTimeChannel;
END_VAR
Within the weekly planner each channel is enabled via the variable bEnable (On/Off). If bEnable = FALSE, then the channel is deactivated and the times entered have no effect. If bAllDays (Mon-Sun) = TRUE, then the times set in uiOn_hh, uiOn_mm, uiOff_hh and uiOff_mm apply to all days of the week from Monday to Sunday. If bAllDays is FALSE, then the days of the week can be selectively assigned to a channel using the variables bMonday to bSunday. For one-shot events, the variable bResetAfterOn (non-recurring) is activated. After the time set in this channel has elapsed, the entries created under uiOn_hh, uiOn_mm, uiOff_hh, uiOff_mm and the days of the week are retained. However, the variable bEnable (On/Off) is reset to FALSE. In this manner a one-shot event can be defined once and reactivated whenever it is required.
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 |