FB_HVACScheduler28ch

FB_HVACScheduler28ch 1:

This function block is a weekly scheduler with 28 channels. Any desired combination of days of the week can be assigned to any channel. The channels can be defined for non-recurring 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 channels is 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.

FB_HVACScheduler28ch 2:

If the input variable bEnable = FALSE, then the output bOutput = FALSE. The channels arrTimeChannel remain 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.

FB_HVACScheduler28ch 3:

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.

FB_HVACScheduler28ch 4:

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. Maximum value 1440 minutes.

bInvalidParameter: An error occurred during the plausibility check. It is deleted again by bReset.

VAR_IN_OUT

arrTimeChannel   : ARRAY[1..28] OF ST_HVACTimeChannel;

arrTimeChannel: The variable arrTimeChannel is an array with 28 declarations of the structure variable ST_HVACTimeChannel (see ST_HVACTimeChannel). It is possible to generate up to 3 switch-on times per day of the week with the 28 channels.

Special notes regarding time input

The following applies:

FB_HVACScheduler28ch 5:

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.

FB_HVACScheduler28ch 6:

This setting produces:

FB_HVACScheduler28ch 7:

For each instance of the function block FB_HVACScheduler28ch it is necessary to create an array of type ST_HVACTimeChannel. The size of the array must be 28, since the function block processes a total of 28 weekly cycles and expects these as a reference (VAR_IN_OUT).

Example

VAR_GLOBAL 
    arrTimeChannel : ARRAY[1..28] OF ST_HVACTimeChannel;
END_VAR

Within the weekly planner each time switch channel is enabled via the variable bEnable (On/Off). If bEnable = FALSE, then the time switch 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 time switch 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.

Example

FB_HVACScheduler28ch 8:

Monday switched on from 07:20 until 17:30

Tuesday switched on from 16:40 until 00:00

Wednesday switched on from 00:00 until 23:59:59 (around the clock – 24 hours!)

Thursday switched on from 15:00 until 03:00 Friday morning, non-recurring!

Friday Time switch channel not activated, always switched off!

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