# DeviceSimple2

## `DeviceSimple2` (FB)

FUNCTION\_BLOCK DeviceSimple2

### Short description

### Representation

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

### Interfaces

#### Inputs

| Name       | Data type         | Value range                                                               | Initial value          | Function                                        |
| ---------- | ----------------- | ------------------------------------------------------------------------- | ---------------------- | ----------------------------------------------- |
| *xEn*      | BOOL              |                                                                           |                        | Device request                                  |
| *xForce*   | BOOL              |                                                                           | FALSE                  | Forced override after manual override           |
| *xFb*      | BOOL              |                                                                           |                        | Device operating message                        |
| *xAlarmIn* | BOOL              |                                                                           |                        | Device fault message                            |
| *eAOO*     | HVACTYPES.eManBin | HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn | HVACTYPES.eManBin.Auto | Operating mode of manual override - hardware    |
| *xQuit*    | BOOL              |                                                                           | FALSE                  | Reset of the operating-monitoring fault message |

#### Outputs

| Name                | Data type       | Value range | Initial value | Function                                                                                                                                                     |
| ------------------- | --------------- | ----------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| *xHB*               | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Manual output: Device not released<br>\* <strong>TRUE:</strong><br>Manual output: Device released</p>                       |
| *xAB*               | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Automatic output: Device not released<br>\* <strong>TRUE:</strong><br>Automatic output: Device released</p>                 |
| *xEnergyRequest*    | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Energy generation request not enabled<br>\* <strong>TRUE:</strong><br>Energy generation request enabled</p>                 |
| *xAlarmFb*          | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Operating-monitoring fault not enabled<br>\* <strong>TRUE:</strong><br>Operating-monitoring fault enabled</p>               |
| *tOffDelay*         | TIME            |             |               | Remaining time of the device's run-on                                                                                                                        |
| *dtLastFb*          | DATE\_AND\_TIME |             |               | Date / time of the device's last operation                                                                                                                   |
| *dtAbsLastOn*       | DATE\_AND\_TIME |             |               | Date / time of the last anti-blocking operation                                                                                                              |
| *udiOperatingHours* | UDINT           |             |               | Operating hours of the device                                                                                                                                |
| *udiCountFb*        | UDINT           |             |               | Number of device switches                                                                                                                                    |
| *xAlarm*            | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Collective fault not enabled<br>\* <strong>TRUE:</strong><br>Collective fault enabled</p>                                   |
| *xAuto*             | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Collective automatic-mode message not enabled<br>\* <strong>TRUE:</strong><br>Collective automatic-mode message enabled</p> |

#### Setpoints / parameters

| Name                  | Data type | Value range                                 | Initial value | Function                                                                                                                                                            |
| --------------------- | --------- | ------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **xAlarmControl**     | BOOL      |                                             | FALSE         | <p>\* <strong>FALSE:</strong><br><em>xHb</em> of <em>xAlarm</em> independent<br>\* <strong>TRUE:</strong><br><em>xHb</em> is when <em>xAlarm</em> = TRUE locked</p> |
| **udiFbControlTime**  | UDINT     | 0 … 300s                                    | 60s           | Duration of the operating monitoring                                                                                                                                |
| **xFbControl**        | BOOL      |                                             | TRUE          | <p>\* <strong>FALSE:</strong><br>Operating monitoring not enabled<br>\* <strong>TRUE:</strong><br>Operating monitoring enabled</p>                                  |
| **xForceOption**      | BOOL      |                                             | TRUE          | <p>\* <strong>FALSE:</strong><br>Output <em>xHB</em> when forced override OFF<br>\* <strong>TRUE:</strong><br>Output <em>xHB</em> when forced override ON</p>       |
| **tAbsTime**          | UDINT     | 0 … 600s                                    | 120s          | Duration of the anti-blocking operation                                                                                                                             |
| **tAbsTime**          | TOD       | 00:00:00 - 23:59:59                         | 08:00:00      | Time of the anti-blocking operation                                                                                                                                 |
| **eAbsDay**           | eDoW      | eDoW\.Monday … eDoW\.Sunday                 | eDoW\.Monday  | Weekday of the anti-blocking operation                                                                                                                              |
| **eOffDelayTimeBase** | eTime     | eTime.Second, eTime.Minute, eTime.Hour      | eTime.Second  | Scaling of the off-delay (seconds / minutes / hours)                                                                                                                |
| **udiOffDelay**       | UDINT     | 0 … 60min                                   | 120s          | Device run-on time duration                                                                                                                                         |
| **eManModeB**         | eMANBIN   | eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn | eMANBIN.Auto  | Operating mode of the manual override for the digital output *xHB*                                                                                                  |

### Function description

#### Automatic output *xAB*

The digital automatic output *xAB* is influenced by the input *xEn*, the output *xAlarm*, the off-delay module and the anti-blocking module.

| *xEn* | *xAlarm* | *xAlarmControl* | Off-delay module | Anti-blocking module | *xAB* | Notes                                |
| ----- | -------- | --------------- | ---------------- | -------------------- | ----- | ------------------------------------ |
| X     | TRUE     | TRUE            | X                | X                    | FALSE | Shutdown allowed by collective fault |
| FALSE | X        | FALSE           | FALSE            | FALSE                | FALSE | Automatic operation Off              |
| TRUE  | x        | FALSE           | FALSE            | FALSE                | TRUE  | Automatic operation On               |
| X     | X        | FALSE           | TRUE             | X                    | TRUE  | Off-delay operation                  |
| X     | x        | FALSE           | X                | TRUE                 | TRUE  | Anti-blocking operation              |

Legend: X = any\
\
With the parameter *xAlarmControl* the behavior of the output *xAB* in case of fault can be influenced.\
When *xAlarmControl* = TRUE then in case of fault (*xAlarm* = TRUE) the automatic output *xAB* is switched off; if the manual override module is in automatic, then the output *xHB* is also switched off.\
When *xAlarmControl* = FALSE there is no reaction.

#### Manual output *xHB*

The digital manual output *xHB* corresponds to the digital automatic output *xAB*, additionally extended by a manual override module and by a forced override.

| *xAB* | eMANBIN        | *xForce* | **xForceOption** | *xHB* | Notes                                          |
| ----- | -------------- | -------- | ---------------- | ----- | ---------------------------------------------- |
| FALSE | eMANBIN.Auto   | FALSE    | X                | FALSE | Manual override module in automatic            |
| TRUE  | eMANBIN.Auto   | FALSE    | X                | TRUE  | Manual override module in automatic            |
| X     | eMANBIN.ManOn  | FALSE    | X                | TRUE  | Manual override module in manual operation On  |
| X     | eMANBIN.ManOff | FALSE    | X                | FALSE | Manual override module in manual operation Off |
| X     | X              | TRUE     | FALSE            | FALSE | Forced override Off                            |
| X     | X              | TRUE     | TRUE             | TRUE  | Forced override On                             |

Legend: X = any

#### Request - energy generation *xEnergyRequest*

The digital output *xEnergyRequest* is influenced by the input *xFb*, the off-delay module and the anti-blocking module.

| *xFB* | Off-delay module | Anti-blocking module | *xEnergyRequest* | Notes                           |
| ----- | ---------------- | -------------------- | ---------------- | ------------------------------- |
| FALSE | X                | X                    | FALSE            | Circulation pump is not running |
| TRUE  | FALSE            | FALSE                | TRUE             | Circulation pump is running     |
| TRUE  | TRUE             | X                    | FALSE            | Off-delay module is running     |
| TRUE  | X                | TRUE                 | FALSE            | Anti-blocking module is running |

Legend: X = any

#### Off-delay module

The off-delay module is implemented by a shut-off delay with adjustable duration. The input of the off-delay module is active if the enable 'xEn' is active and at the same time the collective fault *xAlarm* is not active.

#### Anti-blocking module

The anti-blocking module is implemented by the binary anti-blocking module with adjustable duration.\
The duration *tAbsTime*, the time **tAbsTime** and the weekday **eAbsDay** are configurable.\
The timestamp (date / time) of the last anti-blocking operation *dtAbsLastOn* is available.

#### Output *xAlarm*

| *xAlarmIn* | *xAlarmFb* | *xAlarm* | Notes                                |
| ---------- | ---------- | -------- | ------------------------------------ |
| FALSE      | FALSE      | FALSE    | Collective fault is inactive         |
| TRUE       | FALSE      | TRUE     | External hardware fault is active    |
| FALSE      | TRUE       | TRUE     | Operating-monitoring fault is active |
| TRUE       | TRUE       | TRUE     | Both faults are active               |

Legend: X = any

#### Collective automatic-mode message *xAuto*

The collective automatic-mode message *xAuto* is activated (= TRUE) if the input *eAOO* has the value HVACTYPES.eManBin.Auto and the setpoint / parameter **eManModeB** has the value eMANBIN.Auto.\
In all other cases the collective automatic-mode message *xAuto* is not activated (= FALSE).

#### Forced override *xForce*

The forced override acts directly on the output *xHB*. The parameter **xForceOption** determines which state the output *xHB* assumes when TRUE at the input *xForce* .

#### Operating hours counter

The operating hours counter is active if the circulation pump is running (*xFb* = TRUE) and at the same time the collective fault *xAlarm* is not active (*xAlarm* = FALSE).\
The number of operating hours **udiOperatingHours**, and the number of starts **udiCountFb** are output on the corresponding outputs.\
The timestamp (date / time) of the operation of the circulation pump *dtLastFb* is available.

> **Write access to the counter values**
>
> Via the path 'InstanceName.\_OperatingHours.udiOperatingHours' or 'InstanceName.\_OperatingHours.udiCountFb' write access to both counters is possible.

#### Operating monitoring

The operating monitoring supervises the correct function of the circulation pump.\
The monitoring can generally be enabled (**xFbControl** = TRUE) or disabled (**xFbControl** = FALSE).\
The automatic operation of the circulation pump must also be active (*eAOO* = HVACTYPES.eManBin.Auto).\
\
The input *xFb* and the output *xHB* are permanently compared with each other.\
If the states are continuously unequal during an adjustable time duration **udiFbControlTime** (i.e. pump enabled but no running feedback), the operating-monitoring fault *xAlarmFb* is activated.\
\
The operating-monitoring fault *xAlarmFb* is reset if the enable of the monitoring **xFbControl** is locked, or the reset input *xQuit* is active, or the automatic operation of the circulation pump (*eAOO* = HVACTYPES.eManBin.Auto) is activated.

### Visualization

#### Representation

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

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

#### Interfaces Visu-Element

| Name          | Data type | Type         | Initial value | Function                                                                                                                                                                                                    |
| ------------- | --------- | ------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **FB\_Pump**  | Pump      | VAR\_IN\_OUT |               | Enter FB Pump here e.g. PRG.Pump                                                                                                                                                                            |
| **rRotation** | INT       | VAR\_INPUT   |               | Here the rotation of the pump graphic can be entered as an angle in degrees. e.g. 90 corresponds to a rotation of 90 degrees to the right. -90 degrees corresponds to a rotation of 90 degrees to the left. |

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

{% hint style="info" %}
Note: VAR\_IN\_OUT interfaces must be assigned, VAR\_INPUT are optional.
{% endhint %}

### CODESYS

InOut:

| Scope       | Name                | Type    | Initial      |
| ----------- | ------------------- | ------- | ------------ |
| Input       | `xEn`               | `BOOL`  |              |
| Input       | `xForce`            | `BOOL`  | FALSE        |
| Input       | `xFb`               | `BOOL`  |              |
| Input       | `xAlarmIn`          | `BOOL`  |              |
| Input       | `eAOO`              | eManBin | eManBin.Auto |
| Input       | `xQuit`             | `BOOL`  | FALSE        |
| Output      | `xHB`               | `BOOL`  |              |
| Output      | `xAB`               | `BOOL`  |              |
| Output      | `xAlarmFb`          | `BOOL`  |              |
| Output      | `dtLastFb`          | `DT`    |              |
| Output      | `udiOperatingHours` | `UDINT` |              |
| Output      | `udiCountFb`        | `UDINT` |              |
| Output      | `xAlarm`            | `BOOL`  |              |
| Output      | `xAuto`             | `BOOL`  |              |
| Input Const | `udiFbControlTime`  | `UDINT` | 60           |
| Input Const | `xFbControl`        | `BOOL`  | TRUE         |
| Input Const | `xForceOption`      | `BOOL`  | FALSE        |
| Input Const | `eManModeB`         | eMANBIN | eMANBIN.Auto |

Methods:

> mQuit

> mResetOperatingHours

Structure:

* mQuit (Method)
* mResetOperatingHours (Method)
