File size: 2,559 Bytes
2bc71f8
18dd115
 
 
 
 
 
 
 
2bc71f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---------------------------------------------------------------------------------
						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					
---------------------------------------------------------------------------------


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.

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

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.