Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -26,7 +26,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
26 |
from app.intro import display_intro_page
|
27 |
from app.building_information import display_building_info_page
|
28 |
from app.climate_data import display_climate_page
|
29 |
-
from app.materials_library import display_materials_page, Material, GlazingMaterial, MaterialCategory, MaterialLibrary
|
30 |
from app.construction import display_construction_page, get_available_constructions
|
31 |
from app.components import display_components_page
|
32 |
from app.internal_loads import display_internal_loads_page
|
@@ -71,7 +71,7 @@ class BuildSustain:
|
|
71 |
if 'current_page' not in st.session_state:
|
72 |
st.session_state.current_page = "Intro"
|
73 |
|
74 |
-
# Initialize material library if not set
|
75 |
if 'material_library' not in st.session_state:
|
76 |
st.session_state.material_library = MaterialLibrary()
|
77 |
logger.info("Initialized MaterialLibrary in session state")
|
@@ -120,8 +120,10 @@ class BuildSustain:
|
|
120 |
"hourly_data": [],
|
121 |
"epw_filename": "",
|
122 |
"typical_extreme_periods": {},
|
123 |
-
"ground_temperatures": {
|
124 |
-
|
|
|
|
|
125 |
},
|
126 |
"materials": {
|
127 |
"library": dict(SAMPLE_MATERIALS),
|
@@ -155,31 +157,49 @@ class BuildSustain:
|
|
155 |
"hourly": [],
|
156 |
"peak": 0,
|
157 |
"summary_tables": {},
|
158 |
-
"charts": {
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
},
|
161 |
"heating": {
|
162 |
"hourly": [],
|
163 |
"peak": 0,
|
164 |
"summary_tables": {},
|
165 |
-
"charts": {
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
},
|
169 |
-
"hvac_settings": {
|
170 |
"operating_hours": [{"start": 8, "end": 18}],
|
171 |
"system_type": "Default"
|
172 |
},
|
173 |
-
"sim_period": {
|
174 |
"type": "Full Year",
|
175 |
"start_date": None,
|
176 |
"end_date": None,
|
177 |
"base_temp": 18.3
|
178 |
},
|
179 |
-
"indoor_conditions": {
|
180 |
"type": "Fixed Setpoints",
|
181 |
"cooling_setpoint": {"temperature": 24.0, "rh": 50.0},
|
182 |
"heating_setpoint": {"temperature": 20.0, "rh": 50.0},
|
|
|
183 |
"schedule": []
|
184 |
},
|
185 |
"building_energy": {
|
@@ -365,13 +385,31 @@ class BuildSustain:
|
|
365 |
if key in st.session_state:
|
366 |
st.session_state.pop(key, None)
|
367 |
|
368 |
-
# Clear HVAC-specific states when leaving the HVAC Loads page
|
369 |
if previous_page == "HVAC Loads":
|
370 |
keys_to_clear = [
|
371 |
"hvac_loads_rerun_pending",
|
372 |
"hvac_loads_form_state",
|
373 |
"hvac_loads_editor",
|
374 |
-
"rerun_trigger"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
]
|
376 |
for key in keys_to_clear:
|
377 |
if key in st.session_state:
|
|
|
26 |
from app.intro import display_intro_page
|
27 |
from app.building_information import display_building_info_page
|
28 |
from app.climate_data import display_climate_page
|
29 |
+
from app.materials_library import display_materials_page, Material, GlazingMaterial, MaterialCategory, MaterialLibrary
|
30 |
from app.construction import display_construction_page, get_available_constructions
|
31 |
from app.components import display_components_page
|
32 |
from app.internal_loads import display_internal_loads_page
|
|
|
71 |
if 'current_page' not in st.session_state:
|
72 |
st.session_state.current_page = "Intro"
|
73 |
|
74 |
+
# Initialize material library if not set
|
75 |
if 'material_library' not in st.session_state:
|
76 |
st.session_state.material_library = MaterialLibrary()
|
77 |
logger.info("Initialized MaterialLibrary in session state")
|
|
|
120 |
"hourly_data": [],
|
121 |
"epw_filename": "",
|
122 |
"typical_extreme_periods": {},
|
123 |
+
"ground_temperatures": {
|
124 |
+
"0.5": [20.0] * 12 # Added default monthly ground temperatures for 0.5m depth
|
125 |
+
},
|
126 |
+
"ground_reflectivity": 0.2
|
127 |
},
|
128 |
"materials": {
|
129 |
"library": dict(SAMPLE_MATERIALS),
|
|
|
157 |
"hourly": [],
|
158 |
"peak": 0,
|
159 |
"summary_tables": {},
|
160 |
+
"charts": {
|
161 |
+
"pie_by_component": {},
|
162 |
+
"pie_by_orientation": {}
|
163 |
+
},
|
164 |
+
"breakdown": {
|
165 |
+
"conduction": 0.0,
|
166 |
+
"solar": 0.0,
|
167 |
+
"internal": 0.0,
|
168 |
+
"ventilation": 0.0,
|
169 |
+
"infiltration": 0.0
|
170 |
+
}
|
171 |
},
|
172 |
"heating": {
|
173 |
"hourly": [],
|
174 |
"peak": 0,
|
175 |
"summary_tables": {},
|
176 |
+
"charts": {
|
177 |
+
"pie_by_component": {},
|
178 |
+
"pie_by_orientation": {}
|
179 |
+
},
|
180 |
+
"breakdown": {
|
181 |
+
"conduction": 0.0,
|
182 |
+
"ventilation": 0.0,
|
183 |
+
"infiltration": 0.0
|
184 |
+
}
|
185 |
+
},
|
186 |
+
"monthly_summary": {}
|
187 |
},
|
188 |
+
"hvac_settings": {
|
189 |
"operating_hours": [{"start": 8, "end": 18}],
|
190 |
"system_type": "Default"
|
191 |
},
|
192 |
+
"sim_period": {
|
193 |
"type": "Full Year",
|
194 |
"start_date": None,
|
195 |
"end_date": None,
|
196 |
"base_temp": 18.3
|
197 |
},
|
198 |
+
"indoor_conditions": {
|
199 |
"type": "Fixed Setpoints",
|
200 |
"cooling_setpoint": {"temperature": 24.0, "rh": 50.0},
|
201 |
"heating_setpoint": {"temperature": 20.0, "rh": 50.0},
|
202 |
+
"adaptive_acceptability": "90",
|
203 |
"schedule": []
|
204 |
},
|
205 |
"building_energy": {
|
|
|
385 |
if key in st.session_state:
|
386 |
st.session_state.pop(key, None)
|
387 |
|
388 |
+
# Clear HVAC-specific states when leaving the HVAC Loads page
|
389 |
if previous_page == "HVAC Loads":
|
390 |
keys_to_clear = [
|
391 |
"hvac_loads_rerun_pending",
|
392 |
"hvac_loads_form_state",
|
393 |
"hvac_loads_editor",
|
394 |
+
"rerun_trigger",
|
395 |
+
"hvac_country",
|
396 |
+
"hvac_city",
|
397 |
+
"hvac_state_province",
|
398 |
+
"hvac_latitude",
|
399 |
+
"hvac_longitude",
|
400 |
+
"hvac_elevation",
|
401 |
+
"hvac_timezone",
|
402 |
+
"hvac_ground_reflectivity",
|
403 |
+
"hvac_sim_type",
|
404 |
+
"hvac_start_date",
|
405 |
+
"hvac_end_date",
|
406 |
+
"hvac_base_temp",
|
407 |
+
"hvac_indoor_type",
|
408 |
+
"hvac_cooling_temp",
|
409 |
+
"hvac_cooling_rh",
|
410 |
+
"hvac_heating_temp",
|
411 |
+
"hvac_heating_rh",
|
412 |
+
"adaptive_acceptability"
|
413 |
]
|
414 |
for key in keys_to_clear:
|
415 |
if key in st.session_state:
|