mabuseif commited on
Commit
d6ed840
·
verified ·
1 Parent(s): 1072206

Update app/components.py

Browse files
Files changed (1) hide show
  1. app/components.py +40 -0
app/components.py CHANGED
@@ -114,6 +114,46 @@ def display_component_tab(comp_type: str):
114
  display_roof_skylight_table(comp_type, components)
115
  elif comp_type == "floors":
116
  display_floor_table(comp_type, components)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  else:
118
  st.write(f"No {comp_type} defined.")
119
 
 
114
  display_roof_skylight_table(comp_type, components)
115
  elif comp_type == "floors":
116
  display_floor_table(comp_type, components)
117
+
118
+ # Display DataFrame of all components and their properties
119
+ st.subheader(f"{comp_type.capitalize()} Properties")
120
+ if comp_type in ["walls", "roofs"]:
121
+ df_data = [{
122
+ "Name": comp["name"],
123
+ "U-Value": f"{comp.get('u_value', 0.0):.3f}",
124
+ "Area (m²)": f"{comp['area']:.2f}",
125
+ "Surface Azimuth (°)": f"{comp.get('surface_azimuth', 0.0):.0f}",
126
+ "Tilt (°)": f"{comp.get('tilt', 90.0 if comp_type == 'walls' else 0.0):.0f}",
127
+ "Construction": comp.get("construction", ""),
128
+ "Absorptivity": f"{comp.get('absorptivity', 0.7):.2f}",
129
+ "Emissivity": f"{comp.get('emissivity', 0.9):.2f}"
130
+ } for comp in components]
131
+ elif comp_type == "floors":
132
+ df_data = [{
133
+ "Name": comp["name"],
134
+ "U-Value": f"{comp.get('u_value', 0.0):.3f}",
135
+ "Area (m²)": f"{comp['area']:.2f}",
136
+ "Contact with Ground (%)": f"{comp.get('contact_with_ground_percentage', 0.0):.0f}",
137
+ "Construction": comp.get("construction", ""),
138
+ "Absorptivity": f"{comp.get('absorptivity', 0.7):.2f}",
139
+ "Emissivity": f"{comp.get('emissivity', 0.9):.2f}"
140
+ } for comp in components]
141
+ else: # windows, skylights
142
+ df_data = [{
143
+ "Name": comp["name"],
144
+ "U-Value": f"{comp.get('u_value', 0.0):.3f}",
145
+ "Area (m²)": f"{comp['area']:.2f}",
146
+ "Surface Azimuth (°)": f"{comp.get('surface_azimuth', 0.0):.0f}",
147
+ "Tilt (°)": f"{comp.get('tilt', 90.0 if comp_type == 'windows' else 0.0):.0f}",
148
+ "Fenestration": comp.get("fenestration", ""),
149
+ "Parent Component": comp.get("parent_component", ""),
150
+ "SHGC": f"{comp.get('shgc', 0.7):.2f}",
151
+ "Visible Transmittance": f"{comp.get('visible_transmittance', 0.7):.2f}",
152
+ "Shading Coefficient": f"{comp.get('shading_coefficient', 1.0):.2f}"
153
+ } for comp in components]
154
+
155
+ df = pd.DataFrame(df_data)
156
+ st.dataframe(df, use_container_width=True)
157
  else:
158
  st.write(f"No {comp_type} defined.")
159