FB_HVACSchedulerSpecialPeriods

FB_HVACSchedulerSpecialPeriods 1:

Application

This function block is a yearly scheduler in which, e.g., school holidays or factory shutdowns can be entered. The function block is enabled by the input variable bEnable. The input dtSystemTime is linked to the current system time. The output bOutput is set if the timer switch conditions are satisfied. 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 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 times on the respective day can be entered to the exact minute.

FB_HVACSchedulerSpecialPeriods 2:

If the input variable bEnable = FALSE, then the output bOutput = FALSE. The timer switch channels arrPeriod remain active.

VAR_INPUT

eDataSecurityType: E_HVACDataSecurityType;
bSetDefault      : BOOL;
bEnable          : BOOL;
dtSystemTime     : DT;
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_HVACSchedulerSpecialPeriods 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.

bReset: acknowledge input in the event of a fault. Resets the flag bInvalidParameter.

VAR_IN_OUT

arrPeriod         : ARRAY[1..20] OF ST_HVACPeriod;

arrPeriod: the variable arrPeriod is an array with 20 declarations of the structure variable ST_HVACPeriod.

For each instance of the function block FB_HVACSchedulerSpecialPeriods it is necessary to create an array of type ST_HVACPeriod. The size of the array must be 20, since the function block processes a total of 20 time channels and expects these as a reference (VAR_IN_OUT).

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

FB_HVACSchedulerSpecialPeriods 4:

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. 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 , uiOn_Day, uiOff_Day, uiOn_Month and uiOff_Month 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_HVACSchedulerSpecialPeriods 5:

switched on from 12/01 12:20 until 14/01 at 12:00

switched on from 23/06 00:00 until 25/08 23:59:59

switched on from 03/10 12:00 until 03/10 at 18:00, non-recurring!

1.1. to 1.1. Timer switch channel not activated, always switched off!

Visualization template for the Target VISU with one timer switch channel: FB_HVACSchedulerSpecialPeriods 6:P_SchedulerSpecialPeriods.zip

VAR_OUTPUT

bOutput          : BOOL;
bEdgeOn          : BOOL;
bEdgeOff         : BOOL;
tNextOn          : TIME;      0 .. t#71582m47s295msmin    (* Nächster Einschaltpunkt, Range max.  = Obergrenze von Time ca.50 Tage *)
tNextOff         : TIME;      0 .. t#71582m47s295msmin    (* Nächster Ausschaltpunkt, Range max.  = Obergrenze von Time ca.50 Tage *)
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.

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

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