Spaces:
Sleeping
Sleeping
jerin
commited on
Commit
•
c0e84fe
1
Parent(s):
2bc71f8
modify rtu anomalizer and dashbord
Browse files- dashboard.py +19 -9
- src/rtu/RTUAnomalizer1.py +3 -3
- src/rtu/RTUAnomalizer2.py +2 -2
dashboard.py
CHANGED
@@ -176,6 +176,15 @@ def update_status_boxes(df,fault):
|
|
176 |
""",
|
177 |
unsafe_allow_html=True,
|
178 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
|
181 |
|
@@ -308,14 +317,15 @@ with row1_col3:
|
|
308 |
fault_placeholder["dataframe"].dataframe(df_faults)
|
309 |
|
310 |
def fault_table_update(fault,df_faults,current_stat,df_time):
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
319 |
|
320 |
# Details
|
321 |
with st.container():
|
@@ -478,7 +488,7 @@ while True:
|
|
478 |
fault_3,
|
479 |
fault_4
|
480 |
) = rtu_anomalizers[1].pipeline(
|
481 |
-
|
482 |
)
|
483 |
if not vav_1_df_new is None:
|
484 |
(
|
|
|
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 |
|
|
|
317 |
fault_placeholder["dataframe"].dataframe(df_faults)
|
318 |
|
319 |
def fault_table_update(fault,df_faults,current_stat,df_time):
|
320 |
+
for i in range(4):
|
321 |
+
if fault[i]== 1 and current_stat[i] == False:
|
322 |
+
df_faults.loc[len(df_faults)] = [df_time,f'RTU_0{i+1}_fan/damper_fault - Start']
|
323 |
+
current_stat[i] = True
|
324 |
+
|
325 |
+
if fault[i]== 0 and current_stat[i] == True:
|
326 |
+
df_faults.loc[len(df_faults)] = [df_time,f'RTU_0{i+1}_fan/damper_fault - End']
|
327 |
+
current_stat[i] = False
|
328 |
+
fault_placeholder["dataframe"].dataframe(df_faults)
|
329 |
|
330 |
# Details
|
331 |
with st.container():
|
|
|
488 |
fault_3,
|
489 |
fault_4
|
490 |
) = rtu_anomalizers[1].pipeline(
|
491 |
+
df_new2, df_trans2, rtu_data_pipeline.scaler2
|
492 |
)
|
493 |
if not vav_1_df_new is None:
|
494 |
(
|
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]>
|
215 |
rtu_2_dist = [int(x) for x in rtu_2_dist]
|
216 |
-
if sum(rtu_2_dist)>0.
|
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]>
|
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
|
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
|
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 |
)
|