# Clock7d2Ch

## `Clock7d2Ch` (FB)

FUNCTION\_BLOCK Clock7d2Ch

### Short description

> Time switch with 7 weekdays, two on/off times each and binary overall output.\
> The operating mode (on period or off period) can be defined per weekday.\
> Typical application: Definition of night/day operation of a zone temperature controller

### Representation

<figure><img src="/files/ade487334d4aa0ea8e63056b074a559bf125f711" 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 1 of the current weekday  |
| *todActivatedTo*   | TOD       |             |               | Switch-off time 2 of the current weekday |

#### Setpoints / parameters

| Name            | Data type | Value range | Initial value | Function                             |
| --------------- | --------- | ----------- | ------------- | ------------------------------------ |
| **todMonFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Monday            |
| **todMonTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Monday           |
| **todMonFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Monday            |
| **todMonTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Monday           |
| **xMonMode**    | BOOL      |             | TRUE          | Mode - switching periods - Monday    |
| **todTueFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Tuesday           |
| **todTueTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Tuesday          |
| **todTueFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Tuesday           |
| **todTueTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Tuesday          |
| **xTueMode**    | BOOL      |             | TRUE          | Mode - switching periods - Tuesday   |
| **todWedFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Wednesday         |
| **todWedTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Wednesday        |
| **todWedFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Wednesday         |
| **todWedTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Wednesday        |
| **xWedMode**    | BOOL      |             | TRUE          | Mode - switching periods - Wednesday |
| **todThuFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Thursday          |
| **todThuTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Thursday         |
| **todThuFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Thursday          |
| **todThuTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Thursday         |
| **xThuMode**    | BOOL      |             | TRUE          | Mode - switching periods - Thursday  |
| **todFriFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Friday            |
| **todFriTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Friday           |
| **todFriFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Friday            |
| **todFriTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Friday           |
| **xFriMode**    | BOOL      |             | TRUE          | Mode - switching periods - Friday    |
| **todSatFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Saturday          |
| **todSatTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Saturday         |
| **todSatFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Saturday          |
| **todSatTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Saturday         |
| **xSatMode**    | BOOL      |             | TRUE          | Mode - switching periods - Saturday  |
| **todSunFrom1** | TOD       |             | TOD#07:00     | Switch-on time 1 - Sunday            |
| **todSunTo1**   | TOD       |             | TOD#12:00     | Switch-off time 1 - Sunday           |
| **todSunFrom2** | TOD       |             | TOD#12:00     | Switch-on time 2 - Sunday            |
| **todSunTo2**   | TOD       |             | TOD#18:00     | Switch-off time 2 - Sunday           |
| **xSunMode**    | BOOL      |             | TRUE          | Mode - switching periods - Sunday    |
| **sNotice**     | STRING    |             | ‘Notice’      | Label - time switch                  |

### Function description

#### General

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

Each of the seven weekdays is assigned two separate switching periods (switching period 1, switching period 2).

Each switching period 1 is defined by adjustable data (switch-on time 1 **todXXXTimeFrom1** and switch-off time 1 **todXXXTimeTo1**) .\
Each switching period 2 is defined by adjustable data (switch-on time 2 **todXXXTimeFrom2** and switch-off time 2 **todXXXTimeTo2**) .\
Additionally, an operating mode (**xXXXMode**) can be set per weekday.

If switch-off time 1 is before switch-on time 1, then for the check the switch-off time 1 is set to the value of switch-on time 1.\
If switch-on time 2 is before switch-off time 1, then for the check the switch-on time 2 is set to the value of switch-off time 1.\
If switch-off time 2 is before switch-on time 2, then for the check the switch-off time 2 is set to the value of switch-on time 2.

A switching period is active if the current time on weekday XXX is within the switching periods of weekday XXX (**xXXXMode** = TRUE).\
A switching period is active if the current time on weekday XXX is outside the switching periods of weekday XXX (**xXXXMode** = FALSE).

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

#### On periods

<figure><img src="/files/c5d226c780fa36558f7c0368df392bdf8637ade4" alt=""><figcaption></figcaption></figure>

#### Off periods

<figure><img src="/files/2e6a18c0c78eff44e7f6b294a187ff4f98f8b8fd" alt=""><figcaption></figcaption></figure>

\
Enable input *xEn*

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

#### Display output *xActive*

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

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

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

This output permanently shows the switch-on time of switching period 1 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 periods of the current weekday *todActivatedTo*

This output permanently shows the switch-off time of switching period 2 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

#### Representation

<figure><img src="/files/47f6f08cd890a8c07897952ab9fea3ff306c9b84" alt=""><figcaption></figcaption></figure>

#### Interfaces Visu-Element

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

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

### CODESYS

InOut:

| Scope       | Name               | Type     | Initial            |
| ----------- | ------------------ | -------- | ------------------ |
| Input       | `xEn`              | `BOOL`   |                    |
| Input Const | `todMonFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todMonTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todMonFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todMonTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xMonMode`         | `BOOL`   | TRUE               |
| Input Const | `todTueFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todTueTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todTueFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todTueTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xTueMode`         | `BOOL`   | TRUE               |
| Input Const | `todWedFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todWedTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todWedFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todWedTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xWedMode`         | `BOOL`   | TRUE               |
| Input Const | `todThuFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todThuTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todThuFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todThuTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xThuMode`         | `BOOL`   | TRUE               |
| Input Const | `todFriFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todFriTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todFriFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todFriTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xFriMode`         | `BOOL`   | TRUE               |
| Input Const | `todSatFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todSatTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todSatFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todSatTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xSatMode`         | `BOOL`   | TRUE               |
| Input Const | `todSunFrom1`      | `TOD`    | TIME\_OF\_DAY#7:0  |
| Input Const | `todSunTo1`        | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todSunFrom2`      | `TOD`    | TIME\_OF\_DAY#12:0 |
| Input Const | `todSunTo2`        | `TOD`    | TIME\_OF\_DAY#18:0 |
| Input Const | `xSunMode`         | `BOOL`   | TRUE               |
| Input Const | `sNotice`          | `STRING` | ‘Notice’           |
| Output      | `xActive`          | `BOOL`   |                    |
| Output      | `todActivatedFrom` | `TOD`    |                    |
| Output      | `todActivatedTo`   | `TOD`    |                    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/clock/clock7d2ch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
