# 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 running 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 enabled<br>\* <strong>TRUE:</strong><br>Manual output: device enabled</p>                         |
| *xAB*               | BOOL            |             |               | <p>\* <strong>FALSE:</strong><br>Automatic output: device not enabled<br>\* <strong>TRUE:</strong><br>Automatic output: device enabled</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 overrun                                                                                                                       |
| *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 switch-ons                                                                                                                                  |
| *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> from <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 hrs                     | 08:00:00 hrs  | 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          | Overrun time duration of the device                                                                                                                                   |
| **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 via collective fault |
| FALSE | X        | FALSE           | FALSE            | FALSE                | FALSE | Automatic mode Off                    |
| TRUE  | x        | FALSE           | FALSE            | FALSE                | TRUE  | Automatic mode On                     |
| X     | X        | FALSE           | TRUE             | X                    | TRUE  | Off-delay operation                   |
| X     | x        | FALSE           | X                | TRUE                 | TRUE  | Anti-blocking operation               |

Legend: X = don't care\
\
With the parameter *xAlarmControl* the behavior of the output *xAB* in case of error can be influenced.\
When *xAlarmControl* = TRUE, in case of error (*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 no reaction occurs.

#### 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 = don't care

#### 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 = don't care

#### Off-delay module

The off-delay module is realized by a switch-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 realized by the binary anti-blocking module with adjustable duration.\
The duration *tAbsTime*, the time **tAbsTime** and the weekday **eAbsDay** are adjustable.\
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 = don't care

#### 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** contains 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*. With the parameter **xForceOption** it is defined which state the output *xHB* assumes at TRUE on 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 switch-ons **udiCountFb** are output at the corresponding outputs.\
The timestamp (date / time) of the pump's operation *dtLastFb* is available.

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

#### Operating monitoring

The operating monitoring monitors the correct function of the circulation pump.\
The monitoring can generally be enabled (**xFbControl** = TRUE) or disabled (**xFbControl** = FALSE).\
The automatic mode 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 unequal for a configurable duration **udiFbControlTime** continuously (i.e. pump enabled but no operating 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 mode 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 visual 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>

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

### 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)
