akshayballal commited on
Commit
a2eb081
2 Parent(s): 3759ba9 c0e84fe

Merge branch 'lstm_pipeline' of hf.co:spaces/smartbuildings/smart-buildings into lstm_pipeline

Browse files
dashboard.py CHANGED
@@ -176,6 +176,15 @@ def update_status_boxes(df, fault):
176
  """,
177
  unsafe_allow_html=True,
178
  )
 
 
 
 
 
 
 
 
 
179
 
180
 
181
  # Zones
@@ -307,17 +316,21 @@ with row1_col3:
307
 
308
 
309
  def fault_table_update(fault, df_faults, current_stat, df_time):
310
- if fault[i] == 1 and current_stat[i] == False:
311
- df_faults.loc[len(df_faults)] = [
312
- df_time,
313
- f"RTU_0{i+1}_fan/damper_fault - Start",
314
- ]
315
- current_stat[i] = True
316
-
317
- if fault[i] == 0 and current_stat[i] == True:
318
- df_faults.loc[len(df_faults)] = [df_time, f"RTU_0{i+1}_fan/damper_fault - End"]
319
- current_stat[i] = False
320
- fault_placeholder["dataframe"].dataframe(df_faults)
 
 
 
 
321
 
322
 
323
  # Details
@@ -500,7 +513,7 @@ while True:
500
  fault_3,
501
  fault_4,
502
  ) = rtu_anomalizers[1].pipeline(
503
- df_new1, df_trans1, rtu_data_pipeline.scaler1
504
  )
505
  if not vav_1_df_new is None:
506
  (
 
176
  """,
177
  unsafe_allow_html=True,
178
  )
179
+ elif fault[i] == 0:
180
+ rtu_placeholders[i]["box"].markdown(
181
+ f"""
182
+ <div style='background-color:#447F80;padding:3px;border-radius:5px;margin-bottom:10px'>
183
+ <h4 style='color:black;text-align:center;'>RTU{i+1}</h4>
184
+ </div>
185
+ """,
186
+ unsafe_allow_html=True,
187
+ )
188
 
189
 
190
  # Zones
 
316
 
317
 
318
  def fault_table_update(fault, df_faults, current_stat, df_time):
319
+ for i in range(4):
320
+ if fault[i] == 1 and current_stat[i] == False:
321
+ df_faults.loc[len(df_faults)] = [
322
+ df_time,
323
+ f"RTU_0{i+1}_fan/damper_fault - Start",
324
+ ]
325
+ current_stat[i] = True
326
+
327
+ if fault[i] == 0 and current_stat[i] == True:
328
+ df_faults.loc[len(df_faults)] = [
329
+ df_time,
330
+ f"RTU_0{i+1}_fan/damper_fault - End",
331
+ ]
332
+ current_stat[i] = False
333
+ fault_placeholder["dataframe"].dataframe(df_faults)
334
 
335
 
336
  # Details
 
513
  fault_3,
514
  fault_4,
515
  ) = rtu_anomalizers[1].pipeline(
516
+ df_new2, df_trans2, rtu_data_pipeline.scaler2
517
  )
518
  if not vav_1_df_new is None:
519
  (
src/rtu/RTUAnomalizer1.py CHANGED
@@ -211,9 +211,9 @@ class RTUAnomalizer1:
211
  self.fault_1 = 1
212
  else:
213
  self.fault_1 = 0
214
- rtu_2_dist = np.array(self.distance_list).T[1]>0.5 #rtu_2_threshold
215
  rtu_2_dist = [int(x) for x in rtu_2_dist]
216
- if sum(rtu_2_dist)>0.05*60: # 80% of the 60 min window
217
  self.fault_2 = 1
218
  else:
219
  self.fault_2 = 0
@@ -245,7 +245,7 @@ class RTUAnomalizer1:
245
  self.resid_pca_list,
246
  dist,
247
  np.array(self.distance_list[30:]).T[0]>1, #rtu_1_threshold
248
- np.array(self.distance_list[30:]).T[1]>0.5, #rtu_2_threshold
249
  self.fault_1,
250
  self.fault_2
251
  )
 
211
  self.fault_1 = 1
212
  else:
213
  self.fault_1 = 0
214
+ rtu_2_dist = np.array(self.distance_list).T[1]>2.5 #rtu_2_threshold
215
  rtu_2_dist = [int(x) for x in rtu_2_dist]
216
+ if sum(rtu_2_dist)>0.8*60: # 80% of the 60 min window
217
  self.fault_2 = 1
218
  else:
219
  self.fault_2 = 0
 
245
  self.resid_pca_list,
246
  dist,
247
  np.array(self.distance_list[30:]).T[0]>1, #rtu_1_threshold
248
+ np.array(self.distance_list[30:]).T[1]>2.5, #rtu_2_threshold
249
  self.fault_1,
250
  self.fault_2
251
  )
src/rtu/RTUAnomalizer2.py CHANGED
@@ -211,7 +211,7 @@ class RTUAnomalizer2:
211
  self.fault_1 = 1
212
  else:
213
  self.fault_1 = 0
214
- rtu_2_dist = np.array(self.distance_list).T[1]>1.5 #rtu_4_threshold
215
  rtu_2_dist = [int(x) for x in rtu_2_dist]
216
  if sum(rtu_2_dist)>0.8*60: # 80% of the 60 min window
217
  self.fault_2 = 1
@@ -245,7 +245,7 @@ class RTUAnomalizer2:
245
  self.resid_pca_list,
246
  dist,
247
  np.array(self.distance_list[30:]).T[0]>1.5, #rtu_3_threshold
248
- np.array(self.distance_list[30:]).T[1]>1.5, #rtu_4_threshold
249
  self.fault_1,
250
  self.fault_2
251
  )
 
211
  self.fault_1 = 1
212
  else:
213
  self.fault_1 = 0
214
+ rtu_2_dist = np.array(self.distance_list).T[1]>1 #rtu_4_threshold
215
  rtu_2_dist = [int(x) for x in rtu_2_dist]
216
  if sum(rtu_2_dist)>0.8*60: # 80% of the 60 min window
217
  self.fault_2 = 1
 
245
  self.resid_pca_list,
246
  dist,
247
  np.array(self.distance_list[30:]).T[0]>1.5, #rtu_3_threshold
248
+ np.array(self.distance_list[30:]).T[1]>1, #rtu_4_threshold
249
  self.fault_1,
250
  self.fault_2
251
  )