mabuseif commited on
Commit
0340a99
·
verified ·
1 Parent(s): 20ddc4a

Update app/results_display.py

Browse files
Files changed (1) hide show
  1. app/results_display.py +60 -6
app/results_display.py CHANGED
@@ -299,7 +299,7 @@ class ResultsDisplay:
299
  "Name": roof["name"],
300
  "Orientation": roof["orientation"],
301
  "Area (m²)": roof["area"],
302
- "U-Value (W/m²·K)": roof["u_value"],
303
  "Temperature Difference (°C)": roof["delta_t"],
304
  "Load (kW)": roof["load"]
305
  })
@@ -401,11 +401,65 @@ class ResultsDisplay:
401
  st.warning("No component breakdown data available.")
402
  return
403
 
404
- # Use component visualization module
405
- self.component_visualization.display_component_breakdown(
406
- session_state["calculation_results"],
407
- session_state["components"]
408
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  def _display_psychrometric_analysis(self, session_state: Dict[str, Any]) -> None:
411
  """
 
299
  "Name": roof["name"],
300
  "Orientation": roof["orientation"],
301
  "Area (m²)": roof["area"],
302
+ "U-Value (W/m²·K)": wall["u_value"],
303
  "Temperature Difference (°C)": roof["delta_t"],
304
  "Load (kW)": roof["load"]
305
  })
 
401
  st.warning("No component breakdown data available.")
402
  return
403
 
404
+ # Try to use component visualization module
405
+ try:
406
+ self.component_visualization.display_component_breakdown(
407
+ session_state["calculation_results"],
408
+ session_state["components"]
409
+ )
410
+ except AttributeError:
411
+ # Fallback visualization if display_component_breakdown is not available
412
+ st.info("Component visualization module not fully implemented. Displaying default breakdown.")
413
+
414
+ results = session_state["calculation_results"]
415
+
416
+ # Cooling load bar chart
417
+ if results.get("cooling"):
418
+ cooling_breakdown = {
419
+ "Walls": results["cooling"]["component_loads"]["walls"],
420
+ "Roof": results["cooling"]["component_loads"]["roof"],
421
+ "Windows": results["cooling"]["component_loads"]["windows"],
422
+ "Doors": results["cooling"]["component_loads"]["doors"],
423
+ "People": results["cooling"]["component_loads"]["people"],
424
+ "Lighting": results["cooling"]["component_loads"]["lighting"],
425
+ "Equipment": results["cooling"]["component_loads"]["equipment"],
426
+ "Infiltration": results["cooling"]["component_loads"]["infiltration"],
427
+ "Ventilation": results["cooling"]["component_loads"]["ventilation"]
428
+ }
429
+
430
+ fig_cooling = px.bar(
431
+ x=list(cooling_breakdown.keys()),
432
+ y=list(cooling_breakdown.values()),
433
+ title="Cooling Load by Component",
434
+ labels={"x": "Component", "y": "Load (kW)"},
435
+ color_discrete_sequence=px.colors.qualitative.Pastel
436
+ )
437
+
438
+ fig_cooling.update_layout(showlegend=False)
439
+ st.plotly_chart(fig_cooling, use_container_width=True)
440
+
441
+ # Heating load bar chart
442
+ if results.get("heating"):
443
+ heating_breakdown = {
444
+ "Walls": results["heating"]["component_loads"]["walls"],
445
+ "Roof": results["heating"]["component_loads"]["roof"],
446
+ "Floor": results["heating"]["component_loads"]["floor"],
447
+ "Windows": results["heating"]["component_loads"]["windows"],
448
+ "Doors": results["heating"]["component_loads"]["doors"],
449
+ "Infiltration": results["heating"]["component_loads"]["infiltration"],
450
+ "Ventilation": results["heating"]["component_loads"]["ventilation"]
451
+ }
452
+
453
+ fig_heating = px.bar(
454
+ x=list(heating_breakdown.keys()),
455
+ y=list(heating_breakdown.values()),
456
+ title="Heating Load by Component",
457
+ labels={"x": "Component", "y": "Load (kW)"},
458
+ color_discrete_sequence=px.colors.qualitative.Pastel
459
+ )
460
+
461
+ fig_heating.update_layout(showlegend=False)
462
+ st.plotly_chart(fig_heating, use_container_width=True)
463
 
464
  def _display_psychrometric_analysis(self, session_state: Dict[str, Any]) -> None:
465
  """