# Clock7d1Ch

## `Clock7d1Ch` (FB)

FUNCTION\_BLOCK Clock7d1Ch

### Short description

> Time switch with 7 weekdays, each having one on/off time and a binary overall output.\
> The mode of operation (on period or off period) can be defined per weekday.\
> Typical application: defining night/day operation of a zone temperature control.

### Representation

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

### Interfaces

#### Inputs

| Name  | Data type | Value range | Initial value | Function     |
| ----- | --------- | ----------- | ------------- | ------------ |
| *xEn* | BOOL      |             |               | Enable input |

#### Outputs

| Name               | Data type | Value range | Initial value | Function                               |
| ------------------ | --------- | ----------- | ------------- | -------------------------------------- |
| *xActive*          | BOOL      |             |               | Display of active switching periods    |
| *todActivatedFrom* | TOD       |             |               | Switch-on time of the current weekday  |
| *todActivatedTo*   | TOD       |             |               | Switch-off time of the current weekday |

#### Setpoints / Parameters

| Name           | Data type | Value range | Initial value | Function                            |
| -------------- | --------- | ----------- | ------------- | ----------------------------------- |
| **todMonFrom** | TOD       |             | TOD#07:00     | Switch-on time - Monday             |
| **todMonTo**   | TOD       |             | TOD#12:00     | Switch-off time - Monday            |
| **xMonMode**   | BOOL      |             | TRUE          | Mode - switching period - Monday    |
| **todTueFrom** | TOD       |             | TOD#07:00     | Switch-on time - Tuesday            |
| **todTueTo**   | TOD       |             | TOD#12:00     | Switch-off time - Tuesday           |
| **xTueMode**   | BOOL      |             | TRUE          | Mode - switching period - Tuesday   |
| **todWedFrom** | TOD       |             | TOD#07:00     | Switch-on time - Wednesday          |
| **todWedTo**   | TOD       |             | TOD#12:00     | Switch-off time - Wednesday         |
| **xWedMode**   | BOOL      |             | TRUE          | Mode - switching period - Wednesday |
| **todThuFrom** | TOD       |             | TOD#07:00     | Switch-on time - Thursday           |
| **todThuTo**   | TOD       |             | TOD#12:00     | Switch-off time - Thursday          |
| **xThuMode**   | BOOL      |             | TRUE          | Mode - switching period - Thursday  |
| **todFriFrom** | TOD       |             | TOD#07:00     | Switch-on time - Friday             |
| **todFriTo**   | TOD       |             | TOD#12:00     | Switch-off time - Friday            |
| **xFriMode**   | BOOL      |             | TRUE          | Mode - switching period - Friday    |
| **todSatFrom** | TOD       |             | TOD#07:00     | Switch-on time - Saturday           |
| **todSatTo**   | TOD       |             | TOD#12:00     | Switch-off time - Saturday          |
| **xSatMode**   | BOOL      |             | TRUE          | Mode - switching period - Saturday  |
| **todSunFrom** | TOD       |             | TOD#07:00     | Switch-on time - Sunday             |
| **todSunTo**   | TOD       |             | TOD#12:00     | Switch-off time - Sunday            |
| **xSunMode**   | BOOL      |             | TRUE          | Mode - switching period - Sunday    |
| **sNotice**    | STRING    |             | ‘Notice’      | Designation - time switch           |

### Function description

#### General

#### Weekdays 1 - 7 (Monday … Sunday, XXX = Mon, Tue, Wed, Thu, Fri, Sat, Sun)

Each of the seven weekdays has its own switching period assigned.\
\
Each switching period is defined by adjustable data (switch-on time **todXXXTimeFrom** and switch-off time **todXXXTimeTo** ) defined.\
In addition, an operating mode ( **xXXXMode** ) per weekday.\
\
If the switch-off time is earlier than the switch-on time, then for the check the switch-off time is set to the value of the switch-on time.\
\
A switching period is active if the current time on weekday XXX is within the switching period of weekday XXX ( **xXXXMode** = TRUE ).\
A switching period is active if the current time on weekday XXX is outside the switching period of weekday XXX ( **xXXXMode** = FALSE ).\
\\

> **Special case 1: switch-on time = switch-off time = TOD#00:00**
>
> When an on period is active ( **xXXXMode** = TRUE ) the switching period is not active for the whole day.\
> When an off period is active ( **xXXXMode** = FALSE ) the switching period is active all day.\\
>
> **Special case 2: switch-on time = switch-off time = TOD#23:59**
>
> When an on period is active ( **xXXXMode** = TRUE ) the switching period is active all day.\
> When an off period is active ( **xXXXMode** = FALSE ) the switching period is not active all day.\\
>
> **Prerequisite for using the function block Clock7d1Ch**
>
> For correct operation the use of the function block TimeRead2 is required.\\

#### On period

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

#### Off period

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

#### Enable input *xEn*

| *xEn* | *xActive*                                             | *todActivatedFrom*                                            | *todActivatedTo*                                               | Note        |
| ----- | ----------------------------------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------- | ----------- |
| FALSE | FALSE                                                 | unchanged                                                     | unchanged                                                      | FB disabled |
| TRUE  | State depending on weekday, time and switching period | Switch-on time of the switching period of the current weekday | Switch-off time of the switching period of the current weekday | FB enabled  |

#### Display output *xActive*

The display output *xActive* takes the state TRUE if, with enable input active ( *xEn* = TRUE ) the time on weekday XXX is within the switching period of weekday XXX ( **xXXXMode** = TRUE, on period ).\
The display output *xActive* takes the state TRUE if, with enable input active ( *xEn* = TRUE ) the time on weekday XXX is outside the switching period of weekday XXX ( **xXXXMode** = FALSE, off period ).\
In all other cases the display output *xActive* assumes the state FALSE.\
\\

| *xEn* | *xActive* | Switching period XXX | **xXXXMode** - XXX | Note                  |
| ----- | --------- | -------------------- | ------------------ | --------------------- |
| FALSE | FALSE     | X                    | X                  | FB disabled           |
| TRUE  | FALSE     | FALSE                | TRUE               | On period not active  |
| TRUE  | TRUE      | TRUE                 | TRUE               | On period active      |
| TRUE  | TRUE      | FALSE                | FALSE              | Off period not active |
| TRUE  | FALSE     | TRUE                 | FALSE              | Off period active     |

#### Switch-on time of the switching period of the current weekday *todActivatedFrom*

This output permanently shows the switch-on time of the switching period of the current weekday if the enable input ( *xEn* = TRUE ) is active.\
In all other situations it is not changed. In special cases 1 and 2 the value TOD#00:00 is always shown.\\

#### Switch-off time of the switching period of the current weekday *todActivatedTo*

This output permanently shows the switch-off time of the switching period of the current weekday if the enable input ( *xEn* = TRUE ) is active.\
In all other situations it is not changed. In special case 1 the value TOD#00:00 is always shown, in special case 2 the value TOD#23:59 is shown.\\

### Visualization

Matching visualization element from the HVACV Visu Library: **FB\_Clock7d1Ch**

#### Representation

>

#### Visu element interfaces

| Name               | Data type  | Type         | Initial value | Function                                     |
| ------------------ | ---------- | ------------ | ------------- | -------------------------------------------- |
| **FB\_Clock7d1Ch** | Clock7d1Ch | VAR\_IN\_OUT |               | Enter FB Clock7d1Ch here e.g. PRG.Clock7d1Ch |

Or visual element **Clock7d1Ch\_D** as dialog. Call the dialog e.g. via the visual element **Clock7d1Ch\_Button**

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

#### Visu element interfaces

| Name               | Data type  | Type         | Initial value | Function                                                                                                                                                                                                    |
| ------------------ | ---------- | ------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **FB\_Clock7d1Ch** | Clock7d1Ch | VAR\_IN\_OUT |               | Enter FB Clock7d1Ch here e.g. PRG.Clock7d1Ch                                                                                                                                                                |
| **ClockNumber**    | INT        | VAR\_INPUT   |               | Clock number. Used only for displaying the title.                                                                                                                                                           |
| **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 Times of the weekday clocks can only be viewed and not edited.                                                                                                                          |

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

### CODESYS

InOut:

| Scope       | Name               | Type       | Initial                       |
| ----------- | ------------------ | ---------- | ----------------------------- |
| Input       | `xEn`              | `BOOL`     |                               |
| Input Const | `todMonFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todMonTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xMonMode`         | `BOOL`     | TRUE                          |
| Input Const | `todTueFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todTueTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xTueMode`         | `BOOL`     | TRUE                          |
| Input Const | `todWedFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todWedTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xWedMode`         | `BOOL`     | TRUE                          |
| Input Const | `todThuFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todThuTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xThuMode`         | `BOOL`     | TRUE                          |
| Input Const | `todFriFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todFriTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xFriMode`         | `BOOL`     | TRUE                          |
| Input Const | `todSatFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todSatTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xSatMode`         | `BOOL`     | TRUE                          |
| Input Const | `todSunFrom`       | `TOD`      | TIME\_OF\_DAY#6:0             |
| Input Const | `todSunTo`         | `TOD`      | TIME\_OF\_DAY#18:0            |
| Input Const | `xSunMode`         | `BOOL`     | TRUE                          |
| Input Const | `sNotice`          | `STRING`   | ‘Notice’                      |
| Input Const | `eMode`            | eClockMode | eClockMode.EachModeSeparately |
| Output      | `xActive`          | `BOOL`     |                               |
| Output      | `todActivatedFrom` | `TOD`      |                               |
| Output      | `todActivatedTo`   | `TOD`      |                               |
