> 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/hvac-library/functionblocks/clock/clock7d2ch.md).

# Clock7d2Ch

## `Clock7d2Ch` (FB)

FUNCTION\_BLOCK Clock7d2Ch

### Kurzbeschreibung

> Schaltuhr mit 7 Wochentagen, je zwei Ein- / Ausschaltzeitpunkte und binärem Gesamtausgang.\
> Die Funktionsweise (Einschaltperiode oder Ausschaltperiode) ist pro Wochentag definierbar.\
> Typische Anwendung: Festlegung des Nacht- / Tagbetriebs einer Zonentemperaturregelung

### Darstellung

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

### Schnittstellen

#### Eingänge

| Name  | Datentyp | Wertebereich | Initialwert | Funktion        |
| ----- | -------- | ------------ | ----------- | --------------- |
| *xEn* | BOOL     |              |             | Freigabeeingang |

#### Ausgänge

| Name               | Datentyp | Wertebereich | Initialwert | Funktion                                      |
| ------------------ | -------- | ------------ | ----------- | --------------------------------------------- |
| *xActive*          | BOOL     |              |             | Anzeige aktiver Schaltperioden                |
| *todActivatedFrom* | TOD      |              |             | Einschaltzeitpunkt 1 des aktuellen Wochentags |
| *todActivatedTo*   | TOD      |              |             | Ausschaltzeitpunkt 2 des aktuellen Wochentags |

#### Sollwerte / Parameter

| Name            | Datentyp | Wertebereich | Initialwert | Funktion                            |
| --------------- | -------- | ------------ | ----------- | ----------------------------------- |
| **todMonFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Montag       |
| **todMonTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Montag       |
| **todMonFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Montag       |
| **todMonTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Montag       |
| **xMonMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Montag     |
| **todTueFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Dienstag     |
| **todTueTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Dienstag     |
| **todTueFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Dienstag     |
| **todTueTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Dienstag     |
| **xTueMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Dienstag   |
| **todWedFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Mittwoch     |
| **todWedTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Mittwoch     |
| **todWedFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Mittwoch     |
| **todWedTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Mittwoch     |
| **xWedMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Mittwoch   |
| **todThuFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Donnerstag   |
| **todThuTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Donnerstag   |
| **todThuFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Donnerstag   |
| **todThuTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Donnerstag   |
| **xThuMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Donnerstag |
| **todFriFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Freitag      |
| **todFriTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Freitag      |
| **todFriFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Freitag      |
| **todFriTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Freitag      |
| **xFriMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Freitag    |
| **todSatFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Samstag      |
| **todSatTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Samstag      |
| **todSatFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Samstag      |
| **todSatTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Samstag      |
| **xSatMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Samstag    |
| **todSunFrom1** | TOD      |              | TOD#07:00   | Einschaltzeitpunkt 1 - Sonntag      |
| **todSunTo1**   | TOD      |              | TOD#12:00   | Ausschaltzeitpunkt 1 - Sonntag      |
| **todSunFrom2** | TOD      |              | TOD#12:00   | Einschaltzeitpunkt 2 - Sonntag      |
| **todSunTo2**   | TOD      |              | TOD#18:00   | Ausschaltzeitpunkt 2 - Sonntag      |
| **xSunMode**    | BOOL     |              | TRUE        | Modus - Schaltperioden - Sonntag    |
| **sNotice**     | STRING   |              | ‘Notice’    | Bezeichnung - Schaltuhr             |

### Funktionsbeschreibung

#### Allgemeines

#### Wochentage 1 - 7 (Montag … Sonntag, XXX = Mon, Tue, Wed, Thu, Fri, Sat, Sun)

Jedem der sieben Wochentage sind zwei eigene Schaltperioden zugeordnet (Schaltperiode 1, Schaltperiode 2).

Jede Schaltperiode 1 ist durch einstellbare Daten (Einschaltzeitpunkt 1 **todXXXTimeFrom1** und Ausschaltzeitpunkt 1 **todXXXTimeTo1**) definiert.\
Jede Schaltperiode 2 ist durch einstellbare Daten (Einschaltzeitpunkt 2 **todXXXTimeFrom2** und Ausschaltzeitpunkt 2 **todXXXTimeTo2**) definiert.\
Zusätzlich kann eine Betriebsart (**xXXXMode**) pro Wochentag festgelegt werden.

Liegt der Ausschaltzeitpunkt 1 vor dem Einschaltzeitpunkt 1, so wird für die Prüfung der Ausschaltzeitpunkt 1 auf den Wert des Einschaltzeitpunkts 1 gelegt.\
Liegt der Einschaltzeitpunkt 2 vor dem Ausschaltzeitpunkt 1, so wird für die Prüfung der Einschaltzeitpunkt 2 auf den Wert des Ausschaltzeitpunkts 1 gelegt.\
Liegt der Ausschaltzeitpunkt 2 vor dem Einschaltzeitpunkt 2, so wird für die Prüfung der Ausschaltzeitpunkt 2 auf den Wert des Einschaltzeitpunkts 2 gelegt.

Eine Schaltperiode ist aktiv, falls sich die aktuelle Uhrzeit am Wochentag XXX innerhalb der Schaltperioden des Wochentag XXX befindet (**xXXXMode** = TRUE).\
Eine Schaltperiode ist aktiv, falls sich die aktuelle Uhrzeit am Wochentag XXX außerhalb der Schaltperioden des Wochentag XXX befindet (**xXXXMode** = FALSE).

> **Sonderfall 1: Einschaltzeitpunkt 1 = Einschaltzeitpunkt 2 = Ausschaltzeitpunkt 1 = Ausschaltzeitpunkt 2 = TOD#00:00**
>
> Bei aktiver Einschaltperiode (**xXXXMode** = TRUE) ist die Schaltperiode ganztägig nicht aktiv.\
> Bei aktiver Ausschaltperiode (**xXXXMode** = FALSE) ist die Schaltperiode ganztägig aktiv.
>
> **Sonderfall 2: Einschaltzeitpunkt 1 = Einschaltzeitpunkt 2 = Ausschaltzeitpunkt 1 = Ausschaltzeitpunkt 2 = TOD#23:59**
>
> Bei aktiver Einschaltperiode (**xXXXMode** = TRUE) ist die Schaltperiode ganztägig aktiv.\
> Bei aktiver Ausschaltperiode (**xXXXMode** = FALSE) ist die Schaltperiode ganztägig nicht aktiv.
>
> **Voraussetzung für den Einsatz des Funktionsbausteins Clock7d2Ch**
>
> Zur korrekten Funktion ist der Einsatz des Funktionsbausteins TimeRead2 erforderlich.

#### Einschaltperioden

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

#### Ausschaltperioden

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

\
Freigabeeingang *xEn*

| *xEn* | *xActive*                                                          | *todActivatedFrom*                                              | *todActivatedTo*                                                | Hinweis        |
| ----- | ------------------------------------------------------------------ | --------------------------------------------------------------- | --------------------------------------------------------------- | -------------- |
| FALSE | FALSE                                                              | unverändert                                                     | unverändert                                                     | FB deaktiviert |
| TRUE  | Zustand abhängig vom Wochentag, der Uhrzeit und den Schaltperioden | Einschaltzeitpunkt der Schaltperiode 1 des aktuellen Wochentags | Ausschaltzeitpunkt der Schaltperiode 2 des aktuellen Wochentags | FB aktiviert   |

#### Anzeigeausgang *xActive*

Der Anzeigeausgang *xActive* nimmt den Zustand TRUE an, falls bei aktivem Freigabeeingang (*xEn* = TRUE) die Uhrzeit am Wochentag XXX innerhalb der Schaltperiode 1 oder der Schaltperiode 2 des Wochentags XXX liegt (**xXXXMode** = TRUE, Einschaltperiode).\
Der Anzeigeausgang *xActive* nimmt den Zustand TRUE an, falls bei aktivem Freigabeeingang (*xEn* = TRUE) die Uhrzeit am Wochentag XXX außerhalb der Schaltperiode 1 oder der Schaltperiode 2 des Wochentags XXX liegt (**xXXXMode** = FALSE, Ausschaltperiode).\
In allen übrigen Fällen nimmt der Anzeigeausgang *xActive* den Zustand FALSE an.

| *xEn* | *xActive* | Schaltperioden XXX | **xXXXMode** - XXX | Hinweis                       |
| ----- | --------- | ------------------ | ------------------ | ----------------------------- |
| FALSE | FALSE     | X                  | X                  | FB deaktiviert                |
| TRUE  | FALSE     | FALSE              | TRUE               | Einschaltperioden nicht aktiv |
| TRUE  | TRUE      | TRUE               | TRUE               | Einschaltperioden aktiv       |
| TRUE  | TRUE      | FALSE              | FALSE              | Ausschaltperioden nicht aktiv |
| TRUE  | FALSE     | TRUE               | FALSE              | Ausschaltperioden aktiv       |

#### Einschaltzeitpunkt der Schaltperioden des aktuellen Wochentags *todActivatedFrom*

Dieser Ausgang zeigt permanent den Einschaltzeitpunkt der Schaltperiode 1 des aktuellen Wochentags an, falls der Freigabeeingang (*xEn* = TRUE) aktiv ist.\
In allen übrigen Situationen wird er nicht verändert. In den Sonderfällen 1 und 2 wird stets der Wert TOD#00:00 angezeigt.

#### Ausschaltzeitpunkt der Schaltperioden des aktuellen Wochentags *todActivatedTo*

Dieser Ausgang zeigt permanent den Ausschaltzeitpunkt der Schaltperiode 2 des aktuellen Wochentags an, falls der Freigabeeingang (*xEn* = TRUE) aktiv ist.\
In allen übrigen Situationen wird er nicht verändert. Im Sonderfall 1 wird stets der Wert TOD#00:00, im Sonderfall 2 der Wert TOD#23:59 angezeigt.

### Visualisierung

#### Darstellung

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

#### Schnittstellen Visu-Element

| Name               | Datentyp   | Typ          | Initialwert | Funktion                                         |
| ------------------ | ---------- | ------------ | ----------- | ------------------------------------------------ |
| **FB\_Clock7d2Ch** | Clock7d2Ch | VAR\_IN\_OUT |             | Hier FB Clock7d2Ch eintragen Bsp. PRG.Clock7d2Ch |

\
Hinweis: VAR\_IN\_OUT Schnittstellen müssen belegt werden, VAR\_INPUT sind 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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
