# Fan1Speed

## `Fan1Speed` (FB)

FUNCTION\_BLOCK Fan1Speed

### Short description

> Control of a single-stage fan\
> Additional functions: air shortage monitoring, operating monitoring, maintenance switch, manual override, status indicator\
> Typical application: control of a room exhaust fan

### Representation

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

### Interfaces

#### Inputs

| Name       | Data type         | Value range                                                               | Initial value          | Function                                                                   |
| ---------- | ----------------- | ------------------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------- |
| *xEn*      | BOOL              |                                                                           |                        | Fan request                                                                |
| *xForce*   | BOOL              |                                                                           | FALSE                  | Forced override after manual override                                      |
| *xFb*      | BOOL              |                                                                           |                        | Fan running indication                                                     |
| *xPFb*     | BOOL              |                                                                           |                        | Air shortage indication                                                    |
| *xMSwitch* | BOOL              |                                                                           | TRUE                   | Maintenance switch indication                                              |
| *xAlarmIn* | BOOL              |                                                                           |                        | Fan fault indication                                                       |
| *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 fault indications (operating monitoring, air shortage monitoring) |

#### Outputs

| Name                | Data type       | Value range | Initial value | Function                                     |
| ------------------- | --------------- | ----------- | ------------- | -------------------------------------------- |
| *xHB*               | BOOL            |             |               | Release - fan after manual override          |
| *xAB*               | BOOL            |             |               | Release - fan before manual override         |
| *xAlarmFb*          | BOOL            |             |               | Operating monitoring fault indication        |
| *xAlarmPFb*         | BOOL            |             |               | Air shortage monitoring fault indication     |
| *dtLastFb*          | DATE\_AND\_TIME |             |               | Date / time of the last operation of the fan |
| *udiOperatingHours* | UDINT           |             |               | Operating hours of the circulation pump      |
| *udiCountFb*        | UDINT           |             |               | Number of starts of the circulation pump     |
| *xAlarm*            | BOOL            |             |               | Collective fault indication                  |
| *xAuto*             | BOOL            |             |               | Collective automatic-mode message            |

#### Setpoints / parameters

| Name                  | Data type | Value range                                 | Initial value | Function                                                           |
| --------------------- | --------- | ------------------------------------------- | ------------- | ------------------------------------------------------------------ |
| **udiPFbControlTime** | UDINT     | 1 to 3600s                                  | 60s           | Reporting delay of the air shortage monitoring                     |
| **xPFbControl**       | BOOL      |                                             | TRUE          | Enable of the air shortage monitoring                              |
| **xAlarmControl**     | BOOL      |                                             | TRUE          | Influence of *xAlarm* on *xAB*                                     |
| **udiFbControlTime**  | UDINT     | 0 … 300s                                    | 60s           | Reporting delay of the operating monitoring                        |
| **xFbControl**        | BOOL      |                                             | TRUE          | Enable / disable of the operating monitoring                       |
| **xForceOption**      | BOOL      |                                             | FALSE         | State of the output *xHB* during forced override                   |
| **eManModeB**         | eMANBIN   | eMANBIN.Auto, eMANBIN.ManOff, eMANBIN.ManOn | eMANBIN.Auto  | Operating mode of the manual override for the digital output *xHB* |

### Function description

#### General

This function block controls a single-stage fan.\
The following function blocks are essentially used:

* AirShortage
* ManBin
* OperatingHours

#### Release - fan before manual override *xAB*

The release - fan before manual override *xAB* is influenced by the fan request *xEn*, the collective fault indication *xAlarm*, the maintenance switch indication *xMSwitch*, the parameter **xAlarmControl** and the air shortage monitoring.\
\
The release - fan before manual override *xAB* is active (= TRUE) if the following conditions are present simultaneously:\
\
Case 1:\
\
\&#xNAN;*xEn* = TRUE (request active)\
\&#xNAN;*xMSwitch* = TRUE (motor protection switch not tripped)\
**xAlarmControl** = FALSE (collective fault indication not considered)\
\
Case 2:\
\
\&#xNAN;*xEn* = TRUE (request active)\
\&#xNAN;*xAlarm* = FALSE (collective fault indication not active)\
\&#xNAN;*xMSwitch* = TRUE (motor protection switch not tripped)\
**xAlarmControl** = TRUE (collective fault indication considered)\
\
In all other situations the release - fan before manual override *xAB* not active (= FALSE).

#### Release - fan after manual override *xHB*

The release - fan before manual override *xHB* corresponds to the release - fan before manual override *xAB*, additionally extended by a manual override module and by a forced override.

| *xAB* | **eManModeB**  | *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

#### Maintenance switch indication *xMSwitch*

*xMSwitch* = TRUE: maintenance switch has not been triggered (normal state)\
\&#xNAN;*xMSwitch* = FALSE: maintenance switch has been triggered (fault state)

#### 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 and switching cycles

The number of operating hours and switching cycles are recorded (= counting process active) if the fan running indication *xFb* is active and at the same time the collective fault indication *xAlarm* is not active (= FALSE).\
The results are available at the counter outputs **udiOperatingHours** and **udiCountFb** available.

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

#### Date / time of the last operation of the fan *dtLastFb*

At the output *dtLastFb* the current date / time is available during the counting process.\
At the output *dtLastFb* the date / time at the end of the last counting process is available outside the counting process.\
At the output *dtLastFb* the initialization value DT#1970-1-1-0.0.0 is output before the first counting process.

#### Operating monitoring

The operating monitoring can be enabled (= TRUE) or disabled (= FALSE) by the setpoint / parameter **xFbControl** When monitoring is disabled the operating monitoring fault indication *xAlarmFb* is always disabled (= FALSE).\
When monitoring is enabled the operating monitoring fault indication *xAlarmFb* is activated (= TRUE) if the following conditions are present simultaneously for a minimum duration **udiFbControlTime** as follows:\
\
\&#xNAN;*xHB* and *xFb* = not equal (enable state and operating state do not match)\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (manual override - hardware in automatic)\
\&#xNAN;*xFbControl* = TRUE (operating monitoring is enabled)\
\
The operating monitoring fault indication *xAlarmFb* is reset (= FALSE) if at least one of the following conditions is met:\
\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (switch back to automatic operation of the manual override - hardware)\
\&#xNAN;*xQuit* = TRUE (reset of fault indications is active)\
\&#xNAN;*xFbControl* = FALSE (operating monitoring disabled)

#### Air shortage monitoring

It serves to detect an air shortage situation by evaluating the signals at the inputs air shortage indication *xPFb* and the fan running indication *xFb*.\
The air shortage monitoring can be enabled (= TRUE) or disabled (= FALSE) by the setpoint / parameter **xPFbControl** In the disabled state the output - fault indication *xAlarmPFb* is not activated (= FALSE).\
\
The output - fault indication *xAlarmPFb* is activated (*xAlarmPFb* = TRUE) if the conditions 1 and 2 below are both met simultaneously.\
\
Condition 1: The input for the differential pressure switch *xPFb* remains for at least the waiting time *udiPFbControlTime* permanently in the state FALSE (= air shortage situation).\
\
Condition 2: The running indication for the fan *xFb* remains for at least the waiting time *udiPFControlTime* remains permanently in the state TRUE (= fan in operation).\
\
\
The output - fault indication *xAlarmPFb* is deactivated in the following cases (*xAlarmPFb* = FALSE):\
\
Case 1: Conditions 1 and / or 2 are not met and the reset of the fault indication *xQuit* is active (= TRUE).

#### Collective fault indication *xAlarm*

The collective fault indication is activated (= TRUE) if at least one of the following described conditions is met.\
\
\&#xNAN;*xAlarmIn* = TRUE (fan fault indication is active)\
\&#xNAN;*xAlarmFB* = TRUE (error from the operating monitoring)\
\&#xNAN;*xAlarmPFb* = TRUE (error from the air shortage monitoring)\
\&#xNAN;*xMSwitch* = FALSE (maintenance switch has been triggered)\
\
In all other cases the collective fault is not active (= FALSE).

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

### CODESYS

InOut:

| Scope       | Name                | Type    | Initial      |
| ----------- | ------------------- | ------- | ------------ |
| Input       | `xEn`               | `BOOL`  |              |
| Input       | `xForce`            | `BOOL`  | FALSE        |
| Input       | `xFb`               | `BOOL`  |              |
| Input       | `xPFb`              | `BOOL`  |              |
| Input       | `xMSwitch`          | `BOOL`  | TRUE         |
| Input       | `xAlarmIn`          | `BOOL`  |              |
| Input       | `eAOO`              | eManBin | eManBin.Auto |
| Input       | `xQuit`             | `BOOL`  | FALSE        |
| Output      | `xHB`               | `BOOL`  |              |
| Output      | `xAB`               | `BOOL`  |              |
| Output      | `xAlarmFb`          | `BOOL`  |              |
| Output      | `xAlarmPFb`         | `BOOL`  |              |
| Output      | `dtLastFb`          | `DT`    |              |
| Output      | `udiOperatingHours` | `UDINT` |              |
| Output      | `udiCountFb`        | `UDINT` |              |
| Output      | `xAlarm`            | `BOOL`  |              |
| Output      | `xAuto`             | `BOOL`  |              |
| Input Const | `udiPFbControlTime` | `UDINT` | 60           |
| Input Const | `xPFbControl`       | `BOOL`  | TRUE         |
| Input Const | `xAlarmControl`     | `BOOL`  | TRUE         |
| 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)
