# Fan2Speed

## `Fan2Speed` (FB)

FUNCTION\_BLOCK Fan2Speed

### Short description

> Control of a two-stage fan\
> Additional functions: air shortage monitoring, operation monitoring, repair switch, manual override, status display\
> Typical application: control of a 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>

### Function description

#### General

This function block controls a single-stage fan.\
Essentially, the following function blocks are used:

AirShortage

ManBin

OperatingHours

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

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

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

The enable - fan before manual override *xHB* corresponds to the enable - 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 = don't care

#### Repair switch indication *xMSwitch*

*xMSwitch* = TRUE: repair switch not tripped (normal condition)\
\&#xNAN;*xMSwitch* = FALSE: repair switch tripped (fault condition)

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

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

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

#### Date/time of the fan’s last operation *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* before the first counting process, the initialization value DT#1970-1-1-0.0.0 is output.

#### Operating monitoring

Operation monitoring can be enabled/disabled via the setpoint/parameter **xFbControl** enabled (= TRUE) or disabled (= FALSE).\
\
When monitoring is disabled, the operation monitoring fault indication *xAlarmFb* is always disabled (= FALSE).\
When monitoring is enabled, the operation monitoring fault indication *xAlarmFb* is activated (= TRUE) if simultaneously during a minimum time period **udiFbControlTime** the following states are present:\
\
\&#xNAN;*xHB* and *xFb* = unequal (enable state and operating state do not match)\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (manual override hardware in automatic)\
\&#xNAN;*xFbControl* = TRUE (operation monitoring is enabled)\
\
The operation monitoring fault indication *xAlarmFb* is reset (= FALSE) if at least one of the following conditions is met:\
\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (switching back to automatic operation of the manual override hardware)\
\&#xNAN;*xQuit* = TRUE (fault reset is active)\
\&#xNAN;*xFbControl* = FALSE (operation monitoring disabled)

#### Air shortage monitoring

It is used to detect an air shortage situation by evaluating the signals at the inputs air shortage situation indication *xPFb* and the fan operating indication *xFb*.\
Air shortage monitoring can be enabled/disabled via the setpoint/parameter **xPFbControl** enabled (= TRUE) or disabled (= FALSE). In the disabled state, the output - fault indication *xAlarmPFb* is not activated (= FALSE).\
\
The output - fault indication *xAlarmPFb* is activated ( *xAlarmPFb* = TRUE) if conditions 1 and 2 below are simultaneously met.\
\
Condition 1: The input for the differential pressure switch *xPFb* is in the state FALSE (= air shortage situation) continuously for at least the waiting time *udiPFbControlTime* .\
\
Condition 2: The operating indication for the fan *xFb* is in the state FALSE (= air shortage situation) continuously for at least the waiting time *udiPFControlTime* is continuously 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 fault reset *xQuit* is active (= TRUE).

#### General fault indication *xAlarm*

The general fault indication is activated (= TRUE) if at least one of the conditions described below is met.\
\
\&#xNAN;*xAlarmIn* = TRUE (fan fault indication is active)\
\&#xNAN;*xAlarmFB* = TRUE (fault from operation monitoring)\
\&#xNAN;*xAlarmPFb* = TRUE (fault from air shortage monitoring)\
\&#xNAN;*xMSwitch* = FALSE (repair switch was tripped)\
\
In all other cases, the general 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** contains 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       | `xEn1`                | `BOOL`  |              |
| Input       | `xEn2`                | `BOOL`  |              |
| Input       | `xForce`              | `BOOL`  | FALSE        |
| Input       | `xFb1`                | `BOOL`  |              |
| Input       | `xFb2`                | `BOOL`  |              |
| Input       | `xPFb`                | `BOOL`  |              |
| Input       | `xMSwitch`            | `BOOL`  | TRUE         |
| Input       | `xAlarmIn1`           | `BOOL`  |              |
| Input       | `xAlarmIn2`           | `BOOL`  |              |
| Input       | `eAOO1`               | eManBin | eManBin.Auto |
| Input       | `eAOO2`               | eManBin | eManBin.Auto |
| Input       | `xQuit`               | `BOOL`  | FALSE        |
| Output      | `xHB1`                | `BOOL`  |              |
| Output      | `xHB2`                | `BOOL`  |              |
| Output      | `xAB1`                | `BOOL`  |              |
| Output      | `xAB2`                | `BOOL`  |              |
| Output      | `xAlarmFb`            | `BOOL`  |              |
| Output      | `xAlarmPFb`           | `BOOL`  |              |
| Output      | `dtLastFb`            | `DT`    |              |
| Output      | `udiOperatingHours1`  | `UDINT` |              |
| Output      | `udiCountFb1`         | `UDINT` |              |
| Output      | `udiOperatingHours2`  | `UDINT` |              |
| Output      | `udiCountFb2`         | `UDINT` |              |
| Output      | `xAlarm`              | `BOOL`  |              |
| Output      | `xAuto`               | `BOOL`  |              |
| Input Const | `udiMinTime_V1_To_V2` | `UDINT` | 10           |
| Input Const | `udiDelay_V2_V1`      | `UDINT` | 6            |
| Input Const | `udiDelay_V1_V2`      | `UDINT` | 1            |
| 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 | `eManModeB2`          | eMANBIN | eMANBIN.Auto |
| Input Const | `eManModeB1`          | eMANBIN | eMANBIN.Auto |

Methods:

> mQuit

> mResetOperatingHours

Structure:

* mQuit (Method)
* mResetOperatingHours (Method)
