Spaces:
Sleeping
Sleeping
jerin
commited on
Commit
•
6b33198
1
Parent(s):
8e50b17
update dashbord: add fault table
Browse files- dashboard.py +24 -12
dashboard.py
CHANGED
@@ -75,7 +75,8 @@ for i in range(1, 2):
|
|
75 |
|
76 |
|
77 |
all_data = pd.read_csv("data/bootstrap_data.csv")
|
78 |
-
|
|
|
79 |
# energy_pipeline_north = EnergyPredictionPipeline(
|
80 |
# scaler_path="src/energy_prediction/models/scalerNorth.pkl",
|
81 |
# wing="north",
|
@@ -175,6 +176,8 @@ def update_status_boxes(df,fault):
|
|
175 |
""",
|
176 |
unsafe_allow_html=True,
|
177 |
)
|
|
|
|
|
178 |
|
179 |
|
180 |
# Zones
|
@@ -293,22 +296,26 @@ with row1_col2:
|
|
293 |
|
294 |
# Faults
|
295 |
with row1_col3:
|
296 |
-
st.
|
|
|
297 |
"""
|
298 |
<div style="background-color:#E2F0D9;padding:1px;border-radius:5px;margin-bottom:20px">
|
299 |
-
<h3 style="color:black;text-align:center;">
|
300 |
</div>""",
|
301 |
unsafe_allow_html=True,
|
302 |
)
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
|
|
|
|
|
|
312 |
|
313 |
# Details
|
314 |
with st.container():
|
@@ -368,6 +375,7 @@ def create_residual_plot(resid_pca_list, distance, rtu_id,lim=8):
|
|
368 |
labels={"x": "Time", "y": "Residual"},
|
369 |
width=500,
|
370 |
height=500,
|
|
|
371 |
)
|
372 |
fig.update_layout(
|
373 |
xaxis_range=[-lim, lim],
|
@@ -392,6 +400,8 @@ resid_placeholder = st.empty()
|
|
392 |
|
393 |
resid_vav_placeholder = st.empty()
|
394 |
|
|
|
|
|
395 |
while True:
|
396 |
|
397 |
if mqtt_client.data_list:
|
@@ -426,6 +436,7 @@ while True:
|
|
426 |
rtu_4_distance = None
|
427 |
fault_3 = None
|
428 |
fault_4 = None
|
|
|
429 |
|
430 |
df_new1, df_trans1, df_new2, df_trans2 = rtu_data_pipeline.fit(
|
431 |
pd.DataFrame(mqtt_client.data_list)
|
@@ -533,4 +544,5 @@ while True:
|
|
533 |
# ax.set_ylabel("Energy (kWh)")
|
534 |
# st.pyplot(fig)
|
535 |
update_status_boxes(df,[fault_1,fault_2,fault_3,fault_4])
|
|
|
536 |
mqtt_client.data_list.clear()
|
|
|
75 |
|
76 |
|
77 |
all_data = pd.read_csv("data/bootstrap_data.csv")
|
78 |
+
df_faults = pd.DataFrame(columns = ["_______Time_______","__________Issue__________"])
|
79 |
+
current_stat = [False,False,False,False]
|
80 |
# energy_pipeline_north = EnergyPredictionPipeline(
|
81 |
# scaler_path="src/energy_prediction/models/scalerNorth.pkl",
|
82 |
# wing="north",
|
|
|
176 |
""",
|
177 |
unsafe_allow_html=True,
|
178 |
)
|
179 |
+
|
180 |
+
|
181 |
|
182 |
|
183 |
# Zones
|
|
|
296 |
|
297 |
# Faults
|
298 |
with row1_col3:
|
299 |
+
fault_placeholder = {"heading": st.empty(), "dataframe": st.empty()}
|
300 |
+
fault_placeholder["heading"].markdown(
|
301 |
"""
|
302 |
<div style="background-color:#E2F0D9;padding:1px;border-radius:5px;margin-bottom:20px">
|
303 |
+
<h3 style="color:black;text-align:center;">Fault Log</h3>
|
304 |
</div>""",
|
305 |
unsafe_allow_html=True,
|
306 |
)
|
307 |
+
|
308 |
+
fault_placeholder["dataframe"].dataframe(df_faults)
|
309 |
+
|
310 |
+
def fault_table_update(fault,df_faults,current_stat,df_time):
|
311 |
+
if fault[i]== 1 and current_stat[i] == False:
|
312 |
+
df_faults.loc[len(df_faults)] = [df_time,f'RTU_0{i+1}_fan/damper_fault - Start']
|
313 |
+
current_stat[i] = True
|
314 |
+
|
315 |
+
if fault[i]== 0 and current_stat[i] == True:
|
316 |
+
df_faults.loc[len(df_faults)] = [df_time,f'RTU_0{i+1}_fan/damper_fault - End']
|
317 |
+
current_stat[i] = False
|
318 |
+
fault_placeholder["dataframe"].dataframe(df_faults)
|
319 |
|
320 |
# Details
|
321 |
with st.container():
|
|
|
375 |
labels={"x": "Time", "y": "Residual"},
|
376 |
width=500,
|
377 |
height=500,
|
378 |
+
color_discrete_sequence=px.colors.qualitative.Set2,
|
379 |
)
|
380 |
fig.update_layout(
|
381 |
xaxis_range=[-lim, lim],
|
|
|
400 |
|
401 |
resid_vav_placeholder = st.empty()
|
402 |
|
403 |
+
|
404 |
+
|
405 |
while True:
|
406 |
|
407 |
if mqtt_client.data_list:
|
|
|
436 |
rtu_4_distance = None
|
437 |
fault_3 = None
|
438 |
fault_4 = None
|
439 |
+
|
440 |
|
441 |
df_new1, df_trans1, df_new2, df_trans2 = rtu_data_pipeline.fit(
|
442 |
pd.DataFrame(mqtt_client.data_list)
|
|
|
544 |
# ax.set_ylabel("Energy (kWh)")
|
545 |
# st.pyplot(fig)
|
546 |
update_status_boxes(df,[fault_1,fault_2,fault_3,fault_4])
|
547 |
+
fault_table_update([fault_1,fault_2,fault_3,fault_4],df_faults,current_stat,df_time)
|
548 |
mqtt_client.data_list.clear()
|