# Holiday

## `Holiday` (FB)

FUNCTION\_BLOCK Holiday

### Short description

> Definition of 10 holiday periods ( = channels ) with switch-on and switch-off dates.\
> Typical application: clock system

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-20965fdac949908f224899e8a94d7bfbc49a465d%2FHoliday_FB.png?alt=media" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name  | Data type | Value range | Initial value | Function                                                                  |
| ----- | --------- | ----------- | ------------- | ------------------------------------------------------------------------- |
| *xEN* | BOOL      |             |               | Enable / disable the holiday periods ( FALSE = disabled, TRUE = enabled ) |

#### Outputs

| Name            | Data type | Value range | Initial value | Function                                                                            |
| --------------- | --------- | ----------- | ------------- | ----------------------------------------------------------------------------------- |
| *xActive*       | BOOL      |             |               | State of the holiday periods ( FALSE = not active, TRUE = active )                  |
| *datActiveFrom* | DATE      |             |               | Switch-on date of the last active holiday period ( channel 10 = highest priority )  |
| *datActiveTo*   | DATE      |             |               | Switch-off date of the last active holiday period ( channel 10 = highest priority ) |

#### Setpoints / parameters

| Name                  | Data type | Value range | Initial value | Function                                                         |
| --------------------- | --------- | ----------- | ------------- | ---------------------------------------------------------------- |
| **xCh10\_Mode**       | BOOL      |             | TRUE          | Enable / disable channel 10 ( FALSE = disabled, TRUE = enabled ) |
| **datCH10\_DateFrom** | DATE      |             | DATE#2019-1-1 | Switch-on date channel 10                                        |
| **datCH10\_DateTo**   | DATE      |             | DATE#2019-1-1 | Switch-off date channel 10                                       |
| **sCH10\_Notice**     | STRING    |             | 'Notice'      | Label for channel 10                                             |
| **xCh9\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 9 ( FALSE = disabled, TRUE = enabled )  |
| **datCH9\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 9                                         |
| **datCH9\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 9                                        |
| **sCH9\_Notice**      | STRING    |             | 'Notice'      | Label for channel 9                                              |
| **xCh8\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 8 ( FALSE = disabled, TRUE = enabled )  |
| **datCH8\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 8                                         |
| **datCH8\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 8                                        |
| **sCH8\_Notice**      | STRING    |             | 'Notice'      | Label for channel 8                                              |
| **xCh7\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 7 ( FALSE = disabled, TRUE = enabled )  |
| **datCH7\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 7                                         |
| **datCH7\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 7                                        |
| **sCH7\_Notice**      | STRING    |             | 'Notice'      | Label for channel 7                                              |
| **xCh6\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 6 ( FALSE = disabled, TRUE = enabled )  |
| **datCH6\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 6                                         |
| **datCH6\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 6                                        |
| **sCH6\_Notice**      | STRING    |             | 'Notice'      | Label for channel 6                                              |
| **xCh5\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 5 ( FALSE = disabled, TRUE = enabled )  |
| **datCH5\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 5                                         |
| **datCH5\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 5                                        |
| **sCH5\_Notice**      | STRING    |             | 'Notice'      | Label for channel 5                                              |
| **xCh4\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 4 ( FALSE = disabled, TRUE = enabled )  |
| **datCH4\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 4                                         |
| **datCH4\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 4                                        |
| **sCH4\_Notice**      | STRING    |             | 'Notice'      | Label for channel 4                                              |
| **xCh3\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 3 ( FALSE = disabled, TRUE = enabled )  |
| **datCH3\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 3                                         |
| **datCH3\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 3                                        |
| **sCH3\_Notice**      | STRING    |             | 'Notice'      | Label for channel 3                                              |
| **xCh2\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 2 ( FALSE = disabled, TRUE = enabled )  |
| **datCH2\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 2                                         |
| **datCH2\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 2                                        |
| **sCH2\_Notice**      | STRING    |             | 'Notice'      | Label for channel 2                                              |
| **xCh1\_Mode**        | BOOL      |             | TRUE          | Enable / disable channel 1 ( FALSE = disabled, TRUE = enabled )  |
| **datCH1\_DateFrom**  | DATE      |             | DATE#2019-1-1 | Switch-on date channel 1                                         |
| **datCH1\_DateTo**    | DATE      |             | DATE#2019-1-1 | Switch-off date channel 1                                        |
| **sCH1\_Notice**      | STRING    |             | 'Notice'      | Label for channel 1                                              |

### Function description

#### General

This function block evaluates up to 10 freely definable holiday periods ( = channels ).\
If the evaluation is generally enabled ( *xEN* = TRUE ), then for all activated holiday periods ( **xChX\_Mode** = TRUE, 0 < X < 11 ) it is checked whether the current date lies within the holiday period. If this is the case for at least one activated holiday period, the output *xActive* is activated ( = TRUE ).\
In all other cases the output *xActive* is deactivated ( = FALSE ).\
If the switch-off date is earlier than the switch-on date ( channels 1 - 10 ), the switch-off date is internally set equal to the switch-on date.\
If the switch-on and switch-off date of a channel ( channels 1 - 10 ) are identical, that day is considered a holiday.\
On the outputs *datActiveFrom* or *datActiveTo* are available ( requirement: *xEN* = TRUE ) the switch-on date / switch-off date of channel 10.\
\\

> **Prerequisite for using the Holiday function block**
>
> The use of the TimeRead2 function block is required for correct operation.\\

### Visualization

Matching visualization element from the HVACV Visu Library: **Holidays**

#### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-5616d0c99725a5747b0cc5c96eb762c65a831e36%2FHolidays.PNG?alt=media" alt=""><figcaption></figcaption></figure>

#### Visu element interfaces

| Name             | Data type | Type         | Initial value | Function                                                                                                                                                                                                                                                                                                  |
| ---------------- | --------- | ------------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **FB\_Holiday**  | Holiday   | VAR\_IN\_OUT |               | Enter FB Holiday here e.g. PRG.Holiday                                                                                                                                                                                                                                                                    |
| **BMS\_Active**  | BOOL      | VAR\_INPUT   |               | BMS (Building Management System) BMS (building management). If BMS\_Active = TRUE the input/editing of the clocks is disabled because they can then only be set via the BMS. Times can then only be viewed.                                                                                               |
| **DisableInput** | BOOL      | VAR\_INPUT   |               | DisableInput = TRUE clock times of the weekly clocks can only be viewed and not edited. /// - BMS (Building Management System) BMS (building management). If BMS\_Active = TRUE the input/editing of the clocks is disabled because they can then only be set via the BMS. Times can then only be viewed. |

\
Note: VAR\_IN\_OUT interfaces must be assigned, VAR\_INPUT are optional.

### CODESYS

InOut:

| Scope       | Name               | Type     | Initial       |
| ----------- | ------------------ | -------- | ------------- |
| Input       | `xEn`              | `BOOL`   |               |
| Input Const | `sCH1_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH1_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH1_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH1_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH2_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH2_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH2_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH2_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH3_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH3_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH3_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH3_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH4_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH4_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH4_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH4_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH5_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH5_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH5_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH5_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH6_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH6_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH6_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH6_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH7_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH7_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH7_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH7_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH8_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH8_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH8_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH8_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH9_Notice`      | `STRING` | 'Notice'      |
| Input Const | `datCH9_DateTo`    | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH9_DateFrom`  | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH9_Mode`        | `BOOL`   | TRUE          |
| Input Const | `sCH10_Notice`     | `STRING` | 'Notice'      |
| Input Const | `datCH10_DateTo`   | `DATE`   | DATE#2022-1-1 |
| Input Const | `datCH10_DateFrom` | `DATE`   | DATE#2022-1-1 |
| Input Const | `xCH10_Mode`       | `BOOL`   | TRUE          |
| Output      | `xActive`          | `BOOL`   |               |
| Output      | `datActiveFrom`    | `DATE`   |               |
| Output      | `datActiveTo`      | `DATE`   |               |
