Upload 31 files
Browse files
utils/component_visualization.py
CHANGED
|
@@ -257,6 +257,79 @@ class ComponentVisualization:
|
|
| 257 |
)
|
| 258 |
|
| 259 |
return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
@staticmethod
|
| 262 |
def create_3d_building_model(components: Dict[str, List[Any]]) -> go.Figure:
|
|
|
|
| 257 |
)
|
| 258 |
|
| 259 |
return fig
|
| 260 |
+
|
| 261 |
+
def display_component_breakdown(self, calculation_results: Dict[str, Any]) -> None:
|
| 262 |
+
"""
|
| 263 |
+
Display component breakdown of calculation results.
|
| 264 |
+
|
| 265 |
+
Args:
|
| 266 |
+
calculation_results: Dictionary containing calculation results
|
| 267 |
+
"""
|
| 268 |
+
# Ensure calculation_results has the required structure
|
| 269 |
+
if not calculation_results or "components" not in calculation_results:
|
| 270 |
+
st.warning("No component data available for visualization.")
|
| 271 |
+
return
|
| 272 |
+
|
| 273 |
+
# Get components from calculation results
|
| 274 |
+
components = calculation_results.get("components", {})
|
| 275 |
+
|
| 276 |
+
# Create tabs for different visualizations
|
| 277 |
+
tab1, tab2, tab3, tab4 = st.tabs([
|
| 278 |
+
"Component Summary",
|
| 279 |
+
"Area Breakdown",
|
| 280 |
+
"Orientation Analysis",
|
| 281 |
+
"Heat Transfer Analysis"
|
| 282 |
+
])
|
| 283 |
+
|
| 284 |
+
with tab1:
|
| 285 |
+
# Display component summary table
|
| 286 |
+
st.subheader("Building Component Summary")
|
| 287 |
+
df = self.create_component_summary_table(components)
|
| 288 |
+
if not df.empty:
|
| 289 |
+
st.dataframe(df, use_container_width=True)
|
| 290 |
+
else:
|
| 291 |
+
st.info("No components added yet.")
|
| 292 |
+
|
| 293 |
+
with tab2:
|
| 294 |
+
# Display component area chart
|
| 295 |
+
st.subheader("Component Area Breakdown")
|
| 296 |
+
fig = self.create_component_area_chart(components)
|
| 297 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 298 |
+
|
| 299 |
+
# Display total area
|
| 300 |
+
total_area = sum(
|
| 301 |
+
sum(wall.area for wall in components.get("walls", [])) +
|
| 302 |
+
sum(roof.area for roof in components.get("roofs", [])) +
|
| 303 |
+
sum(floor.area for floor in components.get("floors", [])) +
|
| 304 |
+
sum(window.area for window in components.get("windows", [])) +
|
| 305 |
+
sum(door.area for door in components.get("doors", []))
|
| 306 |
+
)
|
| 307 |
+
st.metric("Total Building Envelope Area", f"{total_area:.2f} m²")
|
| 308 |
+
|
| 309 |
+
with tab3:
|
| 310 |
+
# Display orientation area chart
|
| 311 |
+
st.subheader("Component Orientation Analysis")
|
| 312 |
+
fig = self.create_orientation_area_chart(components)
|
| 313 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 314 |
+
|
| 315 |
+
with tab4:
|
| 316 |
+
# Display heat transfer chart
|
| 317 |
+
st.subheader("Heat Transfer Analysis")
|
| 318 |
+
fig = self.create_heat_transfer_chart(components)
|
| 319 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 320 |
+
|
| 321 |
+
# Display total heat transfer coefficient
|
| 322 |
+
total_heat_transfer = sum(
|
| 323 |
+
sum(wall.area * wall.u_value for wall in components.get("walls", [])) +
|
| 324 |
+
sum(roof.area * roof.u_value for roof in components.get("roofs", [])) +
|
| 325 |
+
sum(floor.area * floor.u_value for floor in components.get("floors", [])) +
|
| 326 |
+
sum(window.area * window.u_value for window in components.get("windows", [])) +
|
| 327 |
+
sum(door.area * door.u_value for door in components.get("doors", []))
|
| 328 |
+
)
|
| 329 |
+
st.metric("Total Heat Transfer Coefficient", f"{total_heat_transfer:.2f} W/K")
|
| 330 |
+
)
|
| 331 |
+
|
| 332 |
+
return fig
|
| 333 |
|
| 334 |
@staticmethod
|
| 335 |
def create_3d_building_model(components: Dict[str, List[Any]]) -> go.Figure:
|