# ValveAnalog

## `ValveAnalog` (FB)

FUNCTION\_BLOCK ValveAnalog

### Short description

> Control of a continuous valve actuator with anti-blocking function and continuous position feedback\
> \
> Typical application: control valve in a heating circuit

### Representation

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

### Interfaces

#### Inputs

| Name       | Data type         | Value range                                   | Initial value          | Function                                             |
| ---------- | ----------------- | --------------------------------------------- | ---------------------- | ---------------------------------------------------- |
| *rY*       | REAL              |                                               |                        | Control signal from controller                       |
| *xForce*   | BOOL              |                                               | FALSE                  | Forced override after manual override                |
| *xAlarmIn* | BOOL              |                                               | FALSE                  | Actuator fault message                               |
| *rU*       | REAL              |                                               | 0.0                    | Position feedback from the control valve             |
| *eAO*      | HVACTYPES.eManNum | HVACTYPES.eManNum.Auto, HVACTYPES.eManNum.Man | HVACTYPES.eManNum.Auto | Feedback - automatic operation                       |
| *rPoti*    | REAL              |                                               |                        | Feedback - control signal from hardware manual level |

#### Outputs

| Name          | Data type       | Value range | Initial value | Function                                        |
| ------------- | --------------- | ----------- | ------------- | ----------------------------------------------- |
| *rHA*         | REAL            |             |               | Control signal after manual override            |
| *rAA*         | REAL            |             |               | Control signal before manual override           |
| *xAlarmPos*   | BOOL            |             |               | Fault message from position monitoring          |
| *dtAbsLastOn* | DATE\_AND\_TIME |             |               | Date / time of the last anti-blocking operation |
| *xAlarm*      | BOOL            |             |               | General fault indication                        |
| *xAuto*       | BOOL            |             |               | Collective automatic mode message               |

#### Setpoints / parameters

| Name               | Data type | Value range                                 | Initial value | Function                                                  |
| ------------------ | --------- | ------------------------------------------- | ------------- | --------------------------------------------------------- |
| **udiControlTime** | UDINT     | 0 … 600s                                    | 180s          | Duration of the position monitoring                       |
| **rControlDiff**   | REAL      |                                             | 7.0%          | Monitoring of valve position: Maximum position deviation  |
| **xControl**       | BOOL      |                                             | TRUE          | Enablement of the position monitoring                     |
| **xForceOption**   | BOOL      |                                             | TRUE          | State of the output *rHA* under forced override           |
| **rAbsMaxLimit**   | REAL      |                                             | 100.0         | Upper limit for the control signal before manual override |
| **rAbsMinLimit**   | REAL      |                                             | 0.0           | Lower limit for the control signal before manual override |
| **udiAbsTime**     | UDINT     | 10s … 600s                                  | 180s          | Duration of anti-blocking operation in seconds            |
| **tAbsStartTime**  | TOD       | 00:00:00 - 23:59:59 hrs                     | 08:00:00 hrs  | Time of the anti-blocking operation                       |
| **eAbsDay**        | eDoW      | eDow\.Inactive, eDoW\.Monday … eDoW\.Sunday | eDoW\.Monday  | Weekday of the anti-blocking operation                    |
| **rManValue**      | REAL      |                                             | 0.0           | Manual override: manual value                             |
| **eManModeN**      | eMANNUM   | eMANNUM.Auto, eMANNUM.Man                   |               | Manual override: operating mode                           |

### Function description

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

The control signal before manual override *rAA* is influenced by the anti-blocking module.\
The anti-blocking module is parameterized by the setpoints / parameters *udiAbsTime*, **tAbsStartTime** and **eAbsDay** as parameters, using the position feedback from the control valve *rU* as input signal.\
The minimum change of the valve position required to lock the anti-blocking function is fixed at 10.0%.\
The control signal before manual override *rAA* is limited by the two absolute limits **rAbsMinLimit** and **rAbsmaxLimit** .\
The position feedback from the control valve *rU* may be replaced by the control signal from the controller *rY* if no position feedback is available.

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

The control signal after manual override *rHA* is influenced by the output of the anti-blocking module, the control signal from the controller *rY*, the manual override and the forced control.

| **eManModeN** | Anti-blocking process | *xForce* | **xForceOption** | *rHA*                               | Notes                                                  |
| ------------- | --------------------- | -------- | ---------------- | ----------------------------------- | ------------------------------------------------------ |
| eMANNUM.Auto  | FALSE                 | FALSE    | X                | *rY*                                | Automatic operation with passive anti-blocking process |
| eMANNUM.Auto  | TRUE                  | FALSE    | X                | Output of the anti-blocking process | Automatic operation with active anti-blocking process  |
| eMANNUM.Man   | X                     | FALSE    | X                | **rManValue**                       | Manual override                                        |
| X             | X                     | TRUE     | FALSE            | 0.0                                 | Forced override 0.0%                                   |
| X             | X                     | TRUE     | TRUE             | 100.0                               | Forced override 100.0%                                 |

Legend: X = don't care

#### Position monitoring

The position monitoring can be enabled ( **xControl** = TRUE ) or disabled ( **xControl** = FALSE ).\
When position monitoring is enabled, the absolute value of the difference between the control signal after manual override *rHA* and the position feedback from the control valve *rU* is determined and compared with the threshold **rControlDiff** .\
If this difference permanently exceeds the threshold during an alarm delay **udiControlTime** an alarm signal is generated, provided at the same time the feedback - automatic operation *eAO* signals the automatic operation ( *eAO* = HVACTYPES.eManNum.Auto ).\
This alarm signal is forwarded to the output *xAlarmPos* transferred ( *xAlarmPos* = TRUE ).\
The alarm signal is deactivated again ( *xAlarmPos* = FALSE ) as soon as the difference falls below the threshold for the first time.

#### Position feedback from the control valve *rU*

The position feedback from the control valve *rU* may be replaced by the control signal from the controller *rY* if no position feedback is available.

#### Anti-blocking module

The anti-blocking module is implemented by the numerical anti-blocking module with adjustable duration (FB: AbsA).\
The duration *udiAbsTime*, the time **todAbsStartTime** and the weekday **eAbsDay** are adjustable.\
The minimum runtime to lock the anti-blocking operation is 30 s.\
The timestamp (date / time) of the last anti-blocking operation *dtAbsLastOn* is available.

#### Aggregate fault *xAlarm*

The aggregate fault *xAlarm* is activated ( = TRUE ) if *xAlarmPos* or the input *xAlarmIn* is active.\
In all other cases the collective fault *xAlarm* is not activated ( = FALSE ).

#### Collective automatic mode message *xAuto*

The collective automatic mode message *xAuto* is activated ( = TRUE ) if the input *eAO* has the value HVACTYPES.eManNum.Auto and the setpoint / parameter **eManModeN** contains the value eMANNUM.Auto.\
In all other cases the aggregate message is automatic operation *xAuto* is not activated ( = FALSE ).

#### Forced override *xForce*

The forced override acts directly on the output *rHA*. With the parameter **xForceOption** it is defined which state the output *rHA* assumes at TRUE on the input *xForce* takes.\
\
When **xForceOption** = FALSE\
If the input *xForce* is TRUE, then the output *rHA* set to 0.\
\
At **xForceOption** = TRUE\
If the input *xForce* is TRUE, then the output *rHA* set to 100.

### CODESYS

InOut:

| Scope       | Name              | Type    | Initial           |
| ----------- | ----------------- | ------- | ----------------- |
| Input       | `rY`              | `REAL`  |                   |
| Input       | `xForce`          | `BOOL`  | FALSE             |
| Input       | `xAlarmIn`        | `BOOL`  | FALSE             |
| Input       | `rU`              | `REAL`  | 0                 |
| Input       | `eAO`             | eManNum | eManNum.Auto      |
| Input       | `rPoti`           | `REAL`  |                   |
| Output      | `rHA`             | `REAL`  |                   |
| Output      | `rAA`             | `REAL`  |                   |
| Output      | `xAlarmPos`       | `BOOL`  |                   |
| Output      | `dtAbsLastOn`     | `DT`    |                   |
| Output      | `xAlarm`          | `BOOL`  |                   |
| Output      | `xAuto`           | `BOOL`  |                   |
| Input Const | `udiControlTime`  | `UDINT` | 200               |
| Input Const | `rControlDiff`    | `REAL`  | 7                 |
| Input Const | `xControl`        | `BOOL`  | TRUE              |
| Input Const | `xForceOption`    | `BOOL`  | TRUE              |
| Input Const | `rAbsMaxLimit`    | `REAL`  | 100               |
| Input Const | `rAbsMinLimit`    | `REAL`  | 0                 |
| Input Const | `udiAbsTime`      | `UDINT` | 180               |
| Input Const | `todAbsStartTime` | `TOD`   | TIME\_OF\_DAY#8:0 |
| Input Const | `eAbsDay`         | eDoW    | eDow\.Monday      |
| Input Const | `rManValue`       | `REAL`  | 0                 |
| Input Const | `eManModeN`       | eMANNUM | eMANNUM.Auto      |
