File size: 3,003 Bytes
bb435cb
 
 
 
 
52aceea
 
 
bb435cb
 
 
85d246e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74bc595
4acd2cc
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: Smart Buildings
emoji: 🐨
colorFrom: indigo
colorTo: gray
sdk: streamlit
sdk_version: 1.25.0
app_file: dashboard.py
pinned: false
---

---------------------------------------------------------------------------------
						HOW TO RUN THE ENTIRE PIPELINE?							
						-------------------------------							
				Datastreaming --> Datapipeline --> Dashboard					
_______________________________________________________________________________	
1. Activate the samrtbuilding environment										
2. RUN the below files from smart-buildings directory -----> `cd smart-buildings`	
3. RUN the mqttpublisher.py file -----> `python mqttpublisher`.py					
4. RUN the dashboard.py file -----> `streamlit run dashboard.py`.py					
---------------------------------------------------------------------------------


### RTUPipeline:

This file handles the data preparation part. It first extracts the relevant parameters from the incoming data stream and creates the 30-minute data buffer for the prediction. Then apply the scaler on that buffer.

```markdown
input:
	- scaler_1: Standard scaler RTU 1,2
	- scaler_2: Standard scaler RTU 2,3
	- Incoming datastream as a dataframe
output:
 	- df_new1: prev 30 samples of input parameters - reshaped for RTU-1,2 prediction model 
	- df_trans1: prev 31 samples of rtu parameters - residual is
    calculated w.r.t 31st sample and predicted value 
	- df_new2: prev 30 samples of input parameters - reshaped for RTU-3,4 prediction model
	- df_trans2: prev 31 samples of rtu parameters - residual is calculated w.r.t 31st sample and predicted value
```



### RTUAnomalizer1/2:

There are two files RTUAnomalizer1 and RTUAnomalizer2, both do the same function. One for RTU 1,2 and the other for RTU 3,4. This file handles the prediction and clustering part of the RTU anomalies/faults

```markdown
input:
        model: The prediction model.
        kmeans_models: List of clustering models.
        pca_models: List of PCA models.
	df_new: prev 30 samples of input parameters - reshaped for prediction model - Received from RTUPipeline
	df_trans: prev 31 samples of input parameters - residual is calculated w.r.t 31st sample - Received from RTUPipeline
        
output:
        actual_list: List of actual values.
        pred_list: List of predicted values.
        resid_list: List of residual values.
        resid_pca_list: List of residual values after PCA transformation.
        distance_list: List of distances between residuals and cluster centers.
	resid_list for RTU 1:onverted to 0 and 1 based on the threshold
	resid_list for RTU 2: converted to 0 and 1 based on the threshold
        fault_1: Flag indicating the presence of fault in RTU 1.
        fault_2: Flag indicating the presence of fault in RTU 2.

```

### Note:

Other branches of this repository contain tested methods for this project, including:
PCA-based methods (PCA)
Gaussian Process Regression (Bayesian)
Long short-term memory model (lstm)
Hierarchical Temporal Memory (htm)