> 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/counter/operatinghours.md).

# OperatingHours

## `OperatingHours` (FB)

FUNCTION\_BLOCK OperatingHours

### Kurzbeschreibung

> Zähler für die Betriebsstunden und Einschaltvorgänge

### Darstellung

<figure><img src="/files/1WnI6pQwOCgTfClJhzGw" alt=""><figcaption></figcaption></figure>

### Schnittstellen

#### Eingänge

| Name     | Datentyp | Wertebereich | Initialwert | Funktion                         |
| -------- | -------- | ------------ | ----------- | -------------------------------- |
| *xFb*    | BOOL     |              |             | Zähler - Eingang                 |
| *xReset* | BOOL     |              | FALSE       | Freigabe - Eingang - Rücksetzung |

#### Ausgänge

| Name                | Datentyp        | Wertebereich | Initialwert | Funktion                                            |
| ------------------- | --------------- | ------------ | ----------- | --------------------------------------------------- |
| *udiOperatingHours* | UDINT           |              |             | Zähler - Ausgang - Betriebsstunden                  |
| *udiCountFb*        | UDINT           |              |             | Zähler - Ausgang - Einschaltungen                   |
| *dtLastFb*          | DATE\_AND\_TIME |              |             | Datum/-zeitpunkt des Ende des letzten Zählprozesses |

### Funktionsbeschreibung

#### Allgemeines

Dieser Funktionsbaustein dient zur Erfassung der Betriebsstunden und Einschaltvorgänge am Zähler-Eingang *xFb*.\
Die Ausgänge *udiOperatingHours* und *udiCountFb* werden auf 0 zurück gesetzt, sobald am Eingang *xReset* eine ansteigende Flanke erkannt wird.\
Der Zählprozess ist aktiv, solange am Zähler-Eingang *xFb* der Zustand TRUE anliegt.\
Der Ausgang *udiOperatingHours* zeigt die kummulierte Zeitdauer der Zählprozesse seit dem letzten Rücksetzvorgang in Stunden an.\
Der Ausgang *udiCountFb* wird mit jeder ansteigenden Flanke am Eingang *xFb* inkrementiert.\
\
Am Ausgang *dtLastFb* steht während des Zählprozesses das aktuelle Datum / die aktuelle Uhrzeit zur Verfügung.\
Am Ausgang *dtLastFb* steht ausserhalb des Zählprozesses das Datum / die Uhrzeit am Ende des letzten Zählprozesses zur Verfügung.\
Am Ausgang *dtLastFb* wird vor dem ersten Zählprozess der Initialisierungswert DT#1970-1-1-0.0.0 ausgegeben.

> **Wertebereiche der Ausgänge&#x20;*****udiOperatingHours*****&#x20;und&#x20;*****udiCountFb***
>
> Gültige Zählerstände befinden sich innerhalb der Grenzen 0 und 4294967295.\
> Die Inkrementierung des Zählerstandes 4294967295 setzt den Zählerstand auf 0 zurück.\
> Anschliessend wird der Zählerstand wieder fortlaufend inkrementiert.
>
> **Voraussetzung für den Einsatz des Funktionsbausteins OperatingHours**
>
> Zur korrekten Funktion ist der Einsatz des Funktionsbausteins TimeRead2 erforderlich.
>
> **Schreibzugriff auf die Zählerstände**
>
> Über den Pfad ‘Instanzname.\_OperatingHours.udiOperatingHours’ bzw. ‘Instanzname.\_OperatingHours.udiCountFb’ ist ein Schreibzugriff auf die beide Zählerstände möglich.

### CODESYS

InOut:

| Scope  | Name                | Type    | Initial |
| ------ | ------------------- | ------- | ------- |
| Input  | `xFb`               | `BOOL`  |         |
| Input  | `xReset`            | `BOOL`  | FALSE   |
| Output | `udiOperatingHours` | `UDINT` |         |
| Output | `udiCountFb`        | `UDINT` |         |
| Output | `dtLastFb`          | `DT`    |         |

Methods:

> mReset

Structure:

* mReset (Method)


---

# 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/counter/operatinghours.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.
