# hxChart

## `hxChart` (FB)

FUNCTION\_BLOCK hxChart

### Short description

> Calculation of state variables of moist air based on the Mollier h,x diagram\
> Variables: enthalpy, dew point temperature, absolute humidity\
> Typical application: calculation of the dew point temperature in a zone

### Representation

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

### Interfaces

#### Inputs

| Name  | Data type | Value range    | Initial value | Function                       |
| ----- | --------- | -------------- | ------------- | ------------------------------ |
| *rT*  | REAL      | -20.0 to +50.0 |               | Temperature in degrees Celsius |
| *rRH* | REAL      | 0.1 to 100.0   |               | Relative humidity in percent   |

#### Outputs

| Name   | Data type | Value range | Initial value | Function                                                        |
| ------ | --------- | ----------- | ------------- | --------------------------------------------------------------- |
| *rH*   | REAL      |             |               | Enthalpy in kJ/kg                                               |
| *rX*   | REAL      |             |               | Absolute humidity in grams of water vapor / kilogram of dry air |
| *rDP*  | REAL      |             |               | Dew point temperature in degrees Celsius                        |
| *xErr* | BOOL      |             |               | Aggregate fault                                                 |

#### Setpoints / parameters

| Name   | Data type | Value range     | Initial value | Function             |
| ------ | --------- | --------------- | ------------- | -------------------- |
| **rP** | REAL      | 800.0 to 1200.0 | 980           | Air pressure in mbar |

### Function description

#### General

This function block is used to calculate essential state variables of moist air based on the Mollier h,x diagram.\
For this purpose, the current values of air temperature in degrees Celsius and relative humidity in percent must be provided.\
Ideally, the current air pressure in mbar is available for high accuracy, but it can also be replaced by a constant adjusted for the elevation of the measurement location (barometric height formula).\
\\

| Altitude above sea level (m) | Air pressure (mbar) | Constant |
| ---------------------------- | ------------------- | -------- |
| 0                            | 1013                | 10130    |
| 300                          | 980                 | 9800     |
| 400                          | 966                 | 9660     |
| 600                          | 943                 | 9430     |
| 800                          | 921                 | 9210     |
| 1000                         | 899                 | 8990     |
| 1500                         | 842                 | 8420     |
| 2000                         | 795                 | 7950     |

> **Permissible range of temperature in degrees Celsius&#x20;*****rT***
>
> The temperature in degrees Celsius may only take values between -20.0 and +50.0 degrees Celsius (inclusive).\
> Values outside the permissible range are automatically corrected to the appropriate limit value.\\
>
> **Permissible range of relative humidity in percent&#x20;*****rRH***
>
> The relative humidity in percent may only take values between +0.1 and +100.0 percent (inclusive).\
> Values outside the permissible range are automatically corrected to the appropriate limit value.\\

#### Aggregate fault *xErr*

This output is used to indicate violations of the allowable value ranges.\
It is activated ( = TRUE ) if the temperature in degrees Celsius falls below the limit -20.0 and/or exceeds the limit\
+50.0. It is also activated if the relative humidity in percent falls below the limit +0.1 and/or exceeds the limit +100.0.\
In all other situations the output is not active ( = FALSE ).

### CODESYS

InOut:

| Scope       | Name   | Type   | Initial |
| ----------- | ------ | ------ | ------- |
| Input       | `rT`   | `REAL` |         |
| Input       | `rRH`  | `REAL` |         |
| Input Const | `rP`   | `REAL` | 980.0   |
| Output      | `rH`   | `REAL` |         |
| Output      | `rX`   | `REAL` |         |
| Output      | `rDP`  | `REAL` |         |
| Output      | `xErr` | `BOOL` |         |
