# FanAnalog

## `FanAnalog` (FB)

FUNCTION\_BLOCK FanAnalog

### Short description

> Control of a variable-speed fan\
> Additional functions: manual overrides, service switch, operating hours counter, air shortage\
> Typical application: control of a fan with a frequency converter

### Representation

<figure><img src="/files/5326ee453639eb531a4188a63614c905c033371a" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

| Name       | Data type         | Value range                                                               | Initial value          | Function                                                                               |
| ---------- | ----------------- | ------------------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------- |
| *xEn*      | BOOL              |                                                                           |                        | Request for the fan (FALSE = off, TRUE = on)                                           |
| *rY*       | REAL              |                                                                           |                        | Control signal - speed 0.0 - 100.0 %                                                   |
| *xForce*   | BOOL              |                                                                           | FALSE                  | Forced lockout of the fan after manual override (FALSE = off, TRUE = on)               |
| *xFb*      | BOOL              |                                                                           |                        | Operating indication of the fan (FALSE = off, TRUE = on)                               |
| *xPFb*     | BOOL              |                                                                           |                        | Feedback of the air shortage monitoring (FALSE = air shortage, TRUE = no air shortage) |
| *xMSwitch* | BOOL              |                                                                           | TRUE                   | Feedback of the service switch (FALSE = switch off, TRUE = switch on)                  |
| *xAlarmIn* | BOOL              |                                                                           |                        | Fault indication of the fan (FALSE = off, TRUE = on)                                   |
| *eAOO*     | HVACTYPES.eManBin | HVACTYPES.eManBin.Auto, HVACTYPES.eManBin.ManOff, HVACTYPES.eManBin.ManOn | HVACTYPES.eManBin.Auto | Operating mode of the manual override - hardware for the enable                        |
| *eAO*      | HVACTYPES.eManNum | HVACTYPES.eManNum.Auto, HVACTYPES.eManNum.Man                             | HVACTYPES.eManNum.Auto | Operating mode of the manual override - hardware for the control signal                |
| *rPoti*    | REAL              |                                                                           |                        | Manual value - manual override - hardware for the control signal                       |
| *rU*       | REAL              |                                                                           |                        | Feedback signal from the fan in %                                                      |
| *xQuit*    | BOOL              |                                                                           | FALSE                  | Reset of fault indications (monitorings) (FALSE = off, TRUE = on)                      |

#### Outputs

| Name                | Data type       | Value range | Initial value | Function                                                                                                  |
| ------------------- | --------------- | ----------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| *xHB*               | BOOL            |             |               | Enable - fan after manual override (FALSE = off, TRUE = on)                                               |
| *xAB*               | BOOL            |             |               | Enable - fan before manual override (FALSE = off, TRUE = on)                                              |
| *rHA*               | REAL            |             |               | Control signal - fan after manual override in %                                                           |
| *rAA*               | REAL            |             |               | Control signal - fan before manual override in %                                                          |
| *xAlarmFb*          | BOOL            |             |               | Fault indication of the operational monitoring (FALSE = off, TRUE = on)                                   |
| *xAlarmPFb*         | BOOL            |             |               | Fault indication of the air shortage monitoring (FALSE = off, TRUE = on)                                  |
| *dtLastFb*          | DATE\_AND\_TIME |             |               | Date / time of the last operation of the fan                                                              |
| *udiOperatingHours* | UDINT           |             |               | Operating hours of the fan                                                                                |
| *udiCountFb*        | UDINT           |             |               | Number of switch-ons of the fan                                                                           |
| *xAlarm*            | BOOL            |             |               | Collective fault indication (FALSE = off, TRUE = on)                                                      |
| *xAuto*             | BOOL            |             |               | Collective indication - automatic operation (FALSE = not automatic operation, TRUE = automatic operation) |

#### Setpoints / parameters

| Name                  | Data type | Value range                                 | Initial value | Function                                                                         |
| --------------------- | --------- | ------------------------------------------- | ------------- | -------------------------------------------------------------------------------- |
| **udiPFbControlTime** | UDINT     | 0 … 3600s                                   | 60s           | Signal delay of the air shortage monitoring in s                                 |
| **xPFbControl**       | BOOL      |                                             | TRUE          | Enable / disable of the air shortage monitoring (FALSE = disable, TRUE = enable) |
| **xAlarmControl**     | BOOL      |                                             | TRUE          | Influence of *xAlarm* on *xAB* (FALSE = no influence, TRUE = disable)            |
| **udiFbControlTime**  | UDINT     | 0 … 300s                                    | 60s           | Signal delay of the operational monitoring in s                                  |
| **xFbControl**        | BOOL      |                                             | TRUE          | Enable / disable of the operational monitoring (FALSE = disable, TRUE = enable)  |
| **rManValue**         | REAL      |                                             |               | Control signal in manual operation in %                                          |
| **eManModeN**         | eManNum   | eManNum.Auto, eManNum.man                   | eManNum.Auto  | Operating mode of the manual override for the control signal *rHA*               |
| **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 variable-speed fan by means of a continuous control signal *rHA*, which in automatic operation (**eManModeN** = eManNum.Auto) is taken unchanged from the input *rY* is adopted.\
The general enable of the fan is via the request *xEn* and the enable signal *xHB*.\
Essentially the following function blocks are used:

* ManBin
* ManNum
* AirShortage
* CTime
* OperatingHours

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

The release - fan before manual override *xAB* is activated (= TRUE) if the following conditions are met simultaneously:\
\
Case 1:\
\
\&#xNAN;*xEn* = TRUE\
\&#xNAN;*xMSwitch* = TRUE\
**xAlarmControl** = FALSE\
\
Case 2:\
\
\&#xNAN;*xEn* = TRUE\
\&#xNAN;*xMSwitch* = TRUE\
**xAlarmControl** = TRUE\
\&#xNAN;*xAlarm* = FALSE\
\
In all other situations the enable - fan before manual override is *xAB* is not activated (= FALSE).

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

The enable - fan after manual override *xHB* corresponds to the release - fan before manual override *xAB*, additionally extended by a manual override module.\
The enable can generally only occur if the forced lockout of the fan after manual override is not active (*xForce* = FALSE)\
and the collective fault indication is not active (*xAlarm* = FALSE).

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

Legend: X = any

#### Maintenance switch indication *xMSwitch*

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

#### Forced lockout of the fan after manual override *xForce*

*xForce* = FALSE: no forced lockout (normal condition)\
\&#xNAN;*xForce* = TRUE: forced lockout (exceptional condition)

#### 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.
>
> **Prerequisite for the use of the function block FanAnalog**
>
> The use of the TimeRead2 function block is required for correct operation.

#### 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** the following conditions are given:\
\
\&#xNAN;*xHB* and *xFb* = unequal (enable state and operating state do not match)\
\&#xNAN;*eAOO* = HVACTYPES.eManBin.Auto (manual override - hardware for the enable in automatic)\
**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 (reversion to automatic operation of the manual override - hardware)\
\&#xNAN;*xQuit* = TRUE (reset of the monitorings is active)\
**xFbControl** = FALSE (operating monitoring disabled)

#### Air shortage monitoring

The air shortage monitoring is performed by evaluating the states at the inputs *xPFb* or *xFb*.\
\
The fault indication of the air shortage monitoring *xAlarmPFb* is activated (= TRUE) if, with monitoring enabled (**xPFbControl** = TRUE) during the signal delay of the air shortage monitoring, **udiPFbControlTime** permanently the input *xPFb* is not active (= FALSE) and the\
input *xFb* is active (= TRUE).\
\
The fault indication of the air shortage monitoring *xAlarmPFb* is deactivated (= FALSE) if the conditions for activation are no longer present and at the same time the monitoring is disabled (**xPFbControl** = FALSE) and/or the reset of the fault indications (monitorings) is active (*xQuit* = TRUE).

#### Collective fault indication *xAlarm*

The collective fault indication is activated (= TRUE) if at least one of the following described conditions is fulfilled.\
\
\&#xNAN;*xAlarmIn* = TRUE (fault indication of the fan is active)\
\&#xNAN;*xAlarmFB* = TRUE (error from the operational monitoring)\
\&#xNAN;*xAlarmPFB* = TRUE (error from the air shortage monitoring)\
\&#xNAN;*xMSwitch* = FALSE (service switch in off position)\
\
In all other cases the collective fault is not active (= FALSE).

#### Control signal fan before manual override *rAA*

The control signal of the fan before manual override *rAA* is taken unchanged from the input Control signal - speed *rY* if either the output *xHB* and / or the input *xFb* are active.\
In all other situations the control signal *rAA* is fixed to the value 0.0 %.

#### Control signal fan after manual override *rHA*

The actuator control signal after manual override *rHA* corresponds to the control signal of the fan before manual override *rAA* additionally extended by a manual override module.

| *rAA* | **eManModeN** | *rHA*         | Notes                                      |
| ----- | ------------- | ------------- | ------------------------------------------ |
| X     | eMANNUM.Auto  | *rAA*         | Manual override module in automatic        |
| X     | eMANNUM.Man   | **rManValue** | Manual override module in manual operation |

Legend: X = any

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

The collective automatic-mode message *xAuto* is activated (= TRUE) if the following conditions are met simultaneously:

* Input *eAOO* = HVACTYPES.eManBin.Auto
* Input *eAO* = HVACTYPES.eManNum.Auto
* Setpoint / parameters **eManModeB** = eMANBIN.Auto
* Setpoint / parameters **eManModeN** = eMANNUM.Auto

### CODESYS

InOut:

| Scope       | Name                | Type    | Initial      |
| ----------- | ------------------- | ------- | ------------ |
| Input       | `xEn`               | `BOOL`  |              |
| Input       | `rY`                | `REAL`  |              |
| Input       | `xForce`            | `BOOL`  | FALSE        |
| Input       | `xFb`               | `BOOL`  |              |
| Input       | `xPFb`              | `BOOL`  |              |
| Input       | `xMSwitch`          | `BOOL`  | TRUE         |
| Input       | `xAlarmIn`          | `BOOL`  |              |
| Input       | `eAOO`              | eManBin | eManBin.Auto |
| Input       | `eAO`               | eManNum | eManNum.Auto |
| Input       | `rPoti`             | `REAL`  |              |
| Input       | `rU`                | `REAL`  |              |
| Input       | `xQuit`             | `BOOL`  | FALSE        |
| Output      | `xHB`               | `BOOL`  |              |
| Output      | `xAB`               | `BOOL`  |              |
| Output      | `rHA`               | `REAL`  |              |
| Output      | `rAA`               | `REAL`  |              |
| 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 | `rManValue`         | `REAL`  |              |
| Input Const | `eManModeN`         | eMANNUM | eMANNUM.Auto |
| Input Const | `eManModeB`         | eMANBIN | eMANBIN.Auto |

Methods:

> mQuit

> mResetOperatingHours

Structure:

* mQuit (Method)
* mResetOperatingHours (Method)


---

# Agent Instructions: 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:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/components/fananalog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
