> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/clock/clock7d2ch.md).

# Clock7d2Ch

## `Clock7d2Ch` (FB)

FUNCTION\_BLOCK Clock7d2Ch

### Short description

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

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-abdd07aa917ad94a4c3f48dbcbc6b5334f1610db%2FClock7d2Ch_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       |             |               | On time 1 of the current weekday    |
| *todActivatedTo*   | TOD       |             |               | Off time 2 of the current weekday   |

#### Setpoints / Parameters

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

### Functional description

#### General

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

Two separate switching periods are assigned to each of the seven weekdays (switching period 1, switching period 2).

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

If off time 1 is before on time 1, then for the check, off time 1 is set to the value of on time 1.\
If on time 2 is before off time 1, then for the check, on time 2 is set to the value of off time 1.\
If off time 2 is before on time 2, then for the check, off time 2 is set to the value of 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: on time 1 = on time 2 = off time 1 = off time 2 = TOD#00:00**
>
> If the on period is active (**xXXXMode** = TRUE), the switching period is not active all day.\
> If the off period is active (**xXXXMode** = FALSE), the switching period is active all day.
>
> **Special case 2: on time 1 = on time 2 = off time 1 = off time 2 = TOD#23:59**
>
> If the on period is active (**xXXXMode** = TRUE), the switching period is active all day.\
> If the off period is active (**xXXXMode** = FALSE), the switching period is not active all day.
>
> **Prerequisite for the use of the function block Clock7d2Ch**
>
> For correct operation, the use of the TimeRead2 function block is required.

#### On periods

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

#### Off periods

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

\
Enable input *xEn*

| *xEn* | *xActive*                                              | *todActivatedFrom*                                   | *todActivatedTo*                                      | Note           |
| ----- | ------------------------------------------------------ | ---------------------------------------------------- | ----------------------------------------------------- | -------------- |
| FALSE | FALSE                                                  | unchanged                                            | unchanged                                             | FB deactivated |
| TRUE  | State depending on weekday, time and switching periods | On time of switching period 1 of the current weekday | Off time of switching period 2 of the current weekday | FB activated   |

#### Display output *xActive*

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

| *xEn* | *xActive* | Switching periods XXX | **xXXXMode** - XXX | Note                   |
| ----- | --------- | --------------------- | ------------------ | ---------------------- |
| FALSE | FALSE     | X                     | X                  | FB deactivated         |
| 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     |

#### On time of the switching periods of the current weekday *todActivatedFrom*

This output permanently shows the 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 displayed.

#### Off time of the switching periods of the current weekday *todActivatedTo*

This output permanently shows the 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 displayed, and in special case 2, the value TOD#23:59 is always displayed.

### Visualization

#### Representation

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

#### Interfaces visualization 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 is 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
