FB_HVACSchedulerPublicHolidays

FB_HVACSchedulerPublicHolidays 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. As opposed to the FB_HVACSchedulerSpecialPeriods, only daily switching is possible here.

FB_HVACSchedulerPublicHolidays 2:

If the input variable bEnable = FALSE, then the output bOutput = FALSE. The timer switch channels arrHoliday 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_HVACSchedulerPublicHolidays 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

arrHoliday   : ARRAY[1..20] OF ST_HVACHoliday;

arrHoliday: the variable arrHoliday is an array with 20 declarations of the structure variable ST_HVACHoliday.

For each instance of the function block FB_HVACSchedulerPublicHolidays it is necessary to create an array of type ST_HVACHoliday. 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_TYPE

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_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_HVACSchedulerPublicHolidays 4:

switched on from 24/12 00:00 until 26/12 23:59:59

switched on from 03/10 00:00 until 03/10 23:59:59

switched on from 18/07 00:00 until 19/07 23:59:59

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_HVACSchedulerPublicHolidays 5:P_SchedulerPublicHolidays.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.