Commit 0927a5dc authored by hazrmard's avatar hazrmard
Browse files

new RL based control, refactoring docs

parent ff9e708a
Loading
Loading
Loading
Loading

docs/5-dataset.md

deleted100644 → 0
+0 −73
Changes for docs/5-dataset.md: 0 added lines, 73 removed lines.
Original line number Diff line number Diff line
---
title: Datasets and system description
order: 5
hasequations: true
---

![System description](img/5-system-description.png)

*Note: All fields are converted to SI units (Kelvins, watts, $m^3 s^{-1}$).*

## Schematics

For the chillers:

![Chillers](img/4-ChilledWaterSystem-chillers.jpg)

For cooling towers:

![Towers](img/4-ChilledWaterSystem-towers.jpg)

## System parameters

Each cooling tower/chiller system has the following parameters:

1. `Time`: Timestamp in 5 minute increments.

2. `PowChi`: The power consumed by the chiller (*excluding water pumps and fans*).

3. `TempCondIn`: Temperature of water entering the condenser unit to take away heat from the refrigerant liquid in the chiller loop.

4. `TempCondOut`: Temperature of water leaving the condenser after it has absorbed heat from the refrigerant liquid in the chiller loop.

5. `PerFreqFanA`: Fan A's current speed as a percentage of maximum frequency.

6. `PerFreqFanB`: Fan B's current speed as a percentage of maximum frequency.

7. `TempEvapIn`: Temperature of warm water entering the evaporator to be cooled by the refrigerant liquid.

8. `TempEvapOut`: Temperature of cooler water leaving the evaporator after being cooled by the refrigerant liquid.

9. `PowChiP`: Electrical power consumption of the chilled water pump which pumps water through the evaporator unit to be cooled on the Engineering Science Building end.

10. `PowConP`: Electrical power consumption of the condenser water pump which pumps water through the condenser unit on the chiller/cooling tower end.

11. `PowFanA`: Electrical power consumption of cooling tower fan A.

12. `PowFanB`: Electrical power consumption of cooling tower fan B.

13. `FlowEvap`: Flow rate of water through the evaporator. Units of $m^3 s^{-1}$.

14. `TempAmbient`: Ambient temperature.

15. `PerHumidity`: Relative ambient humidity.

16. `TempWetBulb`: Wet-bulb temperature.

17. `PerChiLoad`: Cooling load of the chiller as a fraction of maximum electrical capacity. The maximum cooling capacity in tons is 800 tons. The ratio `Tons / 800` should give roughly the same value as `PerChilLoad`.

18. `FreqFanA`: Spinning rate of fan A in Hertz.

19. `FreqFanB`: Spinning rate of fan B in Hertz.

And the following derived fields:

1. `PowIn`: Total input power calculated as a sum of all power fields.

2. `PowCool`: Rate of heat energy extracted by the evaporator from water coming from living spaces.


## Datasets

For *Chiller 1* at the Engineering Science Building, parameter readings were recorded from January 1, 2018 through December 31, 2018. Measurements were recorded at a 5 minute interval.

docs/8-models.md

deleted100644 → 0
+0 −133
Changes for docs/8-models.md: 0 added lines, 133 removed lines.
Original line number Diff line number Diff line
---
title: 'Models'
order: 8
hasequations: true
---

The cooling tower dissipates heat from water from the condenser in the chiller unit. The following fields in the dataset measure operation of the cooling tower:

* `TempCondIn`
* `TempCondOut`
* `PerFreqFanA`
* `PerFreqFanB`
* `PowConP`
* `PowFanA`
* `PowFanB`

With the follwing environmental varibles:

* `TempAmbient`
* `TempWetbulb`
* `PerHumidity`

**Note**: The dataset mostly has `PerFreqFan[A | B]` neat 100% which makes it difficult to account for variations in fan speed (the control variable).

```
-----------\    (TempCondOut, T_H, Warm water)       ~*~
            =====> Cond Leaving Water Temp =====>|  (Fan)   |
            |                                    |          |
Condenser   |                                    |  Cooling |
            |                                    |  Tower   |
            <===== Cond Entering Water Temp <====|          |
-----------/     (TempCondIn, T_L, Cold water)   \__________/
```

## Evaporative cooling model

A model can be developed to predict the temperature of cooled water from a host of variables.

The rate of evaporative cooling (watts) depends on:

* *Liquid temperature* $T(t)$ - more evaporation at *higher* water temperatures.
* *Ambient temperature* $T_a (K)$ -`TempAmbient`- more evaporation at *higher* temperatures.
* *Wet-bulb temperature* $T_w (K)$ -`TempWetbulb`- more evaporation at *lower* temperatures.
* *Air speed* $v_{air} (m/s)$- more evaporation at *higher* air speed.
* *Sunlight* $R (W/m^2)$- more evaporation at *higher* incident solar radiation.

The total cooling depends on:

* *Total time for evaporation* $t_{evap}$ - More evaporation the longer water remains in the cooling tower.

A first-order approximation would be:

$$
\frac{d}{dt} E_{evap}(T) \propto T(t) (T_a - T_w) v_{air} R
$$

Where:

$$
\begin{align*}
E_{evap}(T)                 &= c_m m (T(0) - T(t)) \\
\frac{d}{dt} E_{evap}(T)    &= -c_m m \frac{d}{dt} T(t)
\end{align*}
$$

Combining, and adding constant of proportionality $k$:

$$
\begin{align*}
-c_m m \frac{d}{dt} T           &= k T(t) (T_a - T_w) v_{air} R \\
\frac{1}{T(t)} \frac{d}{dt} T   &= -\frac{k (T_a - T_w) v_{air} R}{c_m m} \\
T(t) &= T(0) e^{-\frac{k (T_a - T_w) v_{air} R}{c_m m} t}
\end{align*}
$$

$v_{air}$ is unknown but can be approximated as $k_1 (\texttt{PerFreqFanA + PerFreqFanB}$).

$R$ can be calculated from time of day and location - however it is assumed constant if evaporation is in shade.

$m$ is held constant for a "parcel" of liquid being considered.

$T(t_{evap}) = \texttt{TempCondIn}$ and $T(0) = \texttt{TempCondOut}$ from the dataset.

This model makes several assumptions:

* Cooling is modelled from a stationary packet of water. Energy is lost to the environment. This does not account for convection/conduction to warmer water entering or cooler water exiting the cooling tower. However, if the temperature gradient across the body of water is small, these effects may be neglegible.

* All proportionality relationships are assumed to be first-order. That may not be the case in reality.

### Multi-layer Perceptron (MLP)

The model can be solved as an exponential function. It can be modelled by a neural network.

The following network parameters are used:

* Inputs: `TempCondOut`, `PerFreqFanA`, `PerFreqFanB`, `TempAmbient`, `TempWetBulb`
* Output: `TempCondIn`

```
learning rate: 1e-3
hidden_layer_sizes = (20, 20)
activation: ReLU
solver: ADAM
momentum: 0.9
```

Fan power control signals are bi-modally distributed with low variance arount 100% and 0% (see [trends][3]). A minority of control signals fall in the (0%, 95%) interval. This may cause the model to simply learn system dynamics for the modes of the distribution. Two approaches are used:

#### Single MLP Model

A single MLP is trained on the entirety of the data. This achieves a [coefficient of determination][2] of 0.953.

#### Composite MLP

Three identical MLPs are trained separately on clusters of samples where the control signals, `PerFreqFanA` and `PerFreqFanB` are:

* Equal to 0
* Between 0 and 0.95
* Greater than 0.95

The following results are obtained:

| Cluster      	| Coefficient of determination 	|
|--------------	|------------------------------	|
| == 0         	| 0.97                         	|
| 0 < & < 0.95 	| 0.67                         	|
| > 0.95       	| 0.87                         	|

Giving a weighed coefficient of determination of 0.86.

[1]: 0-thermo-basics.md
[2]: https://en.wikipedia.org/wiki/Coefficient_of_determination
[3]: 6-trends.md
 No newline at end of file
+73 −5
Changes for docs/datasets/v1/dataset.md: 73 added lines, 5 removed lines.
Original line number Diff line number Diff line
---
title: Pre-processing
order: 4
title: Datasets and system description
order: 5
hasequations: true
---

This is the data set for *Chiller 1* at the Engineering Science Building. Parameter readings were recorded from January 1, 2018 through December 31, 2018. Measurements were recorded at a 5 minute interval.

## Data extraction

The data are made available through the MetaSys application. The application is responsible for aggregating sensor readings in Engineering Science Building. It allows upto 14 days' of data and 10 fields to be viewed and copy-pasted to a spreadsheet at once.
@@ -15,11 +18,11 @@ Vanderbilt University
        ESB Chiller 1
```

![MetaSys navigation](img/4-metasys-path.png)
![MetaSys navigation](../../img/4-metasys-path.png)

Multiple columns may share names (for e.g each power measurement for the 4 fans in the 2 cooling towers is labelled `Output Power.Trend - Present Value`). Therefore the order of selection of columns is vital.

![MetaSys Fields](img/4-metasys-fields.png)
![MetaSys Fields](../../img/4-metasys-fields.png)

The data are copied to an excel document. Since the number of fields is greater than 10, two sheets are made (with suffixes _1 and _2) for the first 10 and remaining fields. The document is then fed to a pipeline to run basic pre-processing and clean-up tasks.

@@ -27,7 +30,7 @@ The data are copied to an excel document. Since the number of fields is greater

### Renaming fields

The fields were manually renamed to be consistent, illustrative, and unique. Details of field names can be seen in the [dataset description](5-dataset.md).
The fields were manually renamed to be consistent, illustrative, and unique.

| Original Name                                                    	| Renamed     	|
|------------------------------------------------------------------	|-------------	|
@@ -121,6 +124,71 @@ Using the flag `--keep_zeros` for `preprocess.py` will keep rows where power val

In essence, the system is analyzed only at the states when all components (chiller, water pumps, fans) are operational.

![System description](../../img/5-system-description.png)

*Note: All fields are converted to SI units (Kelvins, watts, $m^3 s^{-1}$).*



## Schematics

For the chillers:

![Chillers](../../img/4-ChilledWaterSystem-chillers.jpg)

For cooling towers:

![Towers](../../img/4-ChilledWaterSystem-towers.jpg)

## System parameters

Each cooling tower/chiller system has the following parameters:

1. `Time`: Timestamp in 5 minute increments.

2. `PowChi`: The power consumed by the chiller (*excluding water pumps and fans*).

3. `TempCondIn`: Temperature of water entering the condenser unit to take away heat from the refrigerant liquid in the chiller loop.

4. `TempCondOut`: Temperature of water leaving the condenser after it has absorbed heat from the refrigerant liquid in the chiller loop.

5. `PerFreqFanA`: Fan A's current speed as a percentage of maximum frequency.

6. `PerFreqFanB`: Fan B's current speed as a percentage of maximum frequency.

7. `TempEvapIn`: Temperature of warm water entering the evaporator to be cooled by the refrigerant liquid.

8. `TempEvapOut`: Temperature of cooler water leaving the evaporator after being cooled by the refrigerant liquid.

9. `PowChiP`: Electrical power consumption of the chilled water pump which pumps water through the evaporator unit to be cooled on the Engineering Science Building end.

10. `PowConP`: Electrical power consumption of the condenser water pump which pumps water through the condenser unit on the chiller/cooling tower end.

11. `PowFanA`: Electrical power consumption of cooling tower fan A.

12. `PowFanB`: Electrical power consumption of cooling tower fan B.

13. `FlowEvap`: Flow rate of water through the evaporator. Units of $m^3 s^{-1}$.

14. `TempAmbient`: Ambient temperature.

15. `PerHumidity`: Relative ambient humidity.

16. `TempWetBulb`: Wet-bulb temperature.

17. `PerChiLoad`: Cooling load of the chiller as a fraction of maximum electrical capacity. The maximum cooling capacity in tons is 800 tons. The ratio `Tons / 800` should give roughly the same value as `PerChilLoad`.

18. `FreqFanA`: Spinning rate of fan A in Hertz.

19. `FreqFanB`: Spinning rate of fan B in Hertz.

And the following derived fields:

1. `PowIn`: Total input power calculated as a sum of all power fields.

2. `PowCool`: Rate of heat energy extracted by the evaporator from water coming from living spaces.


[1]: https://en.wikipedia.org/wiki/Arden_Buck_equation
[2]: https://en.wikipedia.org/wiki/Dew_point#Calculating_the_dew_point
[3]: https://journals.ametsoc.org/doi/pdf/10.1175/JAMC-D-11-0143.1
+4 −0
Changes for docs/datasets/v1/preprocessing.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
---
title: Pre-processing
order: 4
---
+1 −0
Changes for environment.yml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,3 +15,4 @@ dependencies:
    - dateutil
    - ipyvolume
    - gym
    - git+https://git.isis.vanderbilt.edu/SmartBuildings/bdx@v0.2.2
 No newline at end of file
Loading