FB_HVACScheduler1ch

FB_HVACScheduler1ch 1:

Application

This function block is a weekly timer switch with one timer switch channel. Any desired combination of days of the week can be assigned to the timer switch channel. The timer switch 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 timer switch channel 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_HVACScheduler1ch 2:

If the input variable bEnable = FALSE, then the output bOutput = FALSE. The timer switch channel stTimeChannel remains active.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
bSetDefault      : BOOL;
bEnable          : BOOL;
dtSystemTime     : DT;
uiOffsetBefore   : UINT;            0 .. 240     min 
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: FB_HVACScheduler1ch 3: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 with 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 time from 1:30 to 5:30, uiOffsetBefor has the value 150 min. The switch-on time is only advanced by 90 min to 00:00.

FB_HVACScheduler1ch 4:

Example 2:

Switch-on time 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_HVACScheduler1ch 5:

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.

TYPE ST_HVACTimeChannel :
STRUCT
  uiOn_hh      : UINT;
  uiOn_mm      : UINT;
  uiOn_ss      : UINT;
  uiOff_hh     : UINT; 
  uiOff_mm     : UINT;
  uiOff_ss     : UINT;
  bEnable      : BOOL;
  bAllDays     : BOOL;
  bMonday      : BOOL;
  bTuesday     : BOOL;
  bWednesday   : BOOL;
  bThursday    : BOOL;
  bFriday      : BOOL;
  bSaturday    : BOOL;
  bSunday      : BOOL;
  bResetAfterOn: BOOL;
  bQ           : BOOL;
END_STRUCT
END_TYPE

Special notes regarding time input

The following applies:

FB_HVACScheduler1ch 6:

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_HVACScheduler1ch 7:

This setting produces:

FB_HVACScheduler1ch 8:

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

Sample:

VAR_GLOBAL 
    stTimeChannel : ST_HVACTimeChannel;
END_VAR

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

Visualization template for the Target VISU with one timer switch channel: FB_HVACScheduler1ch 9:P_Scheduler1ch.ZIP

VAR_OUTPUT

bOutput          : BOOL;
bEdgeOn          : BOOL;
bEdgeOff         : BOOL;
tNextOn          : TIME;    0 .. 10080   min       (* Nächster Einschaltpunkt, max 7 Tage * 24 h * 60 min = 10080 *)
tNextOff         : TIME;    0 .. 1440    min       (* Nächster Ausschaltpunkt, max gleicher Tage 24 h * 60 min = 1440 *)
bInvalidParameter: BOOL;

bOutput: is TRUE if one of the timer switch 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 timer program. Maximum value 10080 minutes (1 week).

tNextOff: time until the next switch-off of the timer program. Maximum forecast until midnight.

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