Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -14,7 +14,6 @@ import logging
|
|
14 |
import os
|
15 |
import sys
|
16 |
from typing import Dict, List, Any, Optional, Tuple
|
17 |
-
from datetime import datetime
|
18 |
|
19 |
# Configure logging
|
20 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
@@ -27,7 +26,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
27 |
from app.intro import display_intro_page
|
28 |
from app.building_information import display_building_info_page
|
29 |
from app.climate_data import display_climate_page
|
30 |
-
from app.materials_library import display_materials_page, Material, GlazingMaterial, MaterialCategory, MaterialLibrary
|
31 |
from app.construction import display_construction_page, get_available_constructions
|
32 |
from app.components import display_components_page
|
33 |
from app.internal_loads import display_internal_loads_page
|
@@ -72,7 +71,7 @@ class BuildSustain:
|
|
72 |
if 'current_page' not in st.session_state:
|
73 |
st.session_state.current_page = "Intro"
|
74 |
|
75 |
-
# Initialize material library if not set
|
76 |
if 'material_library' not in st.session_state:
|
77 |
st.session_state.material_library = MaterialLibrary()
|
78 |
logger.info("Initialized MaterialLibrary in session state")
|
@@ -99,7 +98,11 @@ class BuildSustain:
|
|
99 |
"state_province": "",
|
100 |
"country": "",
|
101 |
"source": "",
|
102 |
-
"wmo": ""
|
|
|
|
|
|
|
|
|
103 |
},
|
104 |
"design_conditions": {
|
105 |
"winter_design_temp": 0.0,
|
@@ -118,7 +121,7 @@ class BuildSustain:
|
|
118 |
"epw_filename": "",
|
119 |
"typical_extreme_periods": {},
|
120 |
"ground_temperatures": {},
|
121 |
-
"ground_reflectivity": 0.2
|
122 |
},
|
123 |
"materials": {
|
124 |
"library": dict(SAMPLE_MATERIALS),
|
@@ -153,41 +156,30 @@ class BuildSustain:
|
|
153 |
"peak": 0,
|
154 |
"summary_tables": {},
|
155 |
"charts": {},
|
156 |
-
"breakdown": {
|
157 |
-
"conduction": 0.0,
|
158 |
-
"solar": 0.0,
|
159 |
-
"internal": 0.0,
|
160 |
-
"ventilation": 0.0,
|
161 |
-
"infiltration": 0.0
|
162 |
-
}
|
163 |
},
|
164 |
"heating": {
|
165 |
"hourly": [],
|
166 |
"peak": 0,
|
167 |
"summary_tables": {},
|
168 |
"charts": {},
|
169 |
-
"breakdown": {
|
170 |
-
"conduction": 0.0,
|
171 |
-
"ventilation": 0.0,
|
172 |
-
"infiltration": 0.0
|
173 |
-
}
|
174 |
}
|
175 |
},
|
176 |
-
"hvac_settings": {
|
177 |
"operating_hours": [{"start": 8, "end": 18}],
|
178 |
"system_type": "Default"
|
179 |
},
|
180 |
-
"sim_period": {
|
181 |
"type": "Full Year",
|
182 |
-
"start_date":
|
183 |
-
"end_date":
|
184 |
"base_temp": 18.3
|
185 |
},
|
186 |
-
"indoor_conditions": {
|
187 |
"type": "Fixed Setpoints",
|
188 |
"cooling_setpoint": {"temperature": 24.0, "rh": 50.0},
|
189 |
"heating_setpoint": {"temperature": 20.0, "rh": 50.0},
|
190 |
-
"adaptive_acceptability": "90",
|
191 |
"schedule": []
|
192 |
},
|
193 |
"building_energy": {
|
@@ -373,27 +365,9 @@ class BuildSustain:
|
|
373 |
if key in st.session_state:
|
374 |
st.session_state.pop(key, None)
|
375 |
|
376 |
-
# Clear HVAC-specific states when leaving the HVAC Loads page
|
377 |
if previous_page == "HVAC Loads":
|
378 |
keys_to_clear = [
|
379 |
-
"hvac_country",
|
380 |
-
"hvac_city",
|
381 |
-
"hvac_state_province",
|
382 |
-
"hvac_latitude",
|
383 |
-
"hvac_longitude",
|
384 |
-
"hvac_elevation",
|
385 |
-
"hvac_timezone",
|
386 |
-
"hvac_ground_reflectivity",
|
387 |
-
"hvac_sim_type",
|
388 |
-
"hvac_start_date",
|
389 |
-
"hvac_end_date",
|
390 |
-
"hvac_base_temp",
|
391 |
-
"hvac_indoor_type",
|
392 |
-
"hvac_cooling_temp",
|
393 |
-
"hvac_cooling_rh",
|
394 |
-
"hvac_heating_temp",
|
395 |
-
"hvac_heating_rh",
|
396 |
-
"adaptive_acceptability",
|
397 |
"hvac_loads_rerun_pending",
|
398 |
"hvac_loads_form_state",
|
399 |
"hvac_loads_editor",
|
|
|
14 |
import os
|
15 |
import sys
|
16 |
from typing import Dict, List, Any, Optional, Tuple
|
|
|
17 |
|
18 |
# Configure logging
|
19 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
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 # Added MaterialLibrary import
|
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 (Added to support hvac_loads.py)
|
75 |
if 'material_library' not in st.session_state:
|
76 |
st.session_state.material_library = MaterialLibrary()
|
77 |
logger.info("Initialized MaterialLibrary in session state")
|
|
|
98 |
"state_province": "",
|
99 |
"country": "",
|
100 |
"source": "",
|
101 |
+
"wmo": "",
|
102 |
+
"latitude": 0.0,
|
103 |
+
"longitude": 0.0,
|
104 |
+
"timezone": 0.0,
|
105 |
+
"elevation": 0.0
|
106 |
},
|
107 |
"design_conditions": {
|
108 |
"winter_design_temp": 0.0,
|
|
|
121 |
"epw_filename": "",
|
122 |
"typical_extreme_periods": {},
|
123 |
"ground_temperatures": {},
|
124 |
+
"ground_reflectivity": 0.2 # Added for hvac_loads.py solar calculations
|
125 |
},
|
126 |
"materials": {
|
127 |
"library": dict(SAMPLE_MATERIALS),
|
|
|
156 |
"peak": 0,
|
157 |
"summary_tables": {},
|
158 |
"charts": {},
|
159 |
+
"breakdown": {} # Added to store detailed load components (e.g., conduction, solar)
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
},
|
161 |
"heating": {
|
162 |
"hourly": [],
|
163 |
"peak": 0,
|
164 |
"summary_tables": {},
|
165 |
"charts": {},
|
166 |
+
"breakdown": {} # Added to store detailed load components
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
},
|
169 |
+
"hvac_settings": { # Added to support hvac_loads.py
|
170 |
"operating_hours": [{"start": 8, "end": 18}],
|
171 |
"system_type": "Default"
|
172 |
},
|
173 |
+
"sim_period": { # Added to support hvac_loads.py
|
174 |
"type": "Full Year",
|
175 |
+
"start_date": None,
|
176 |
+
"end_date": None,
|
177 |
"base_temp": 18.3
|
178 |
},
|
179 |
+
"indoor_conditions": { # Added to support hvac_loads.py
|
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 |
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 (Added to support hvac_loads.py)
|
369 |
if previous_page == "HVAC Loads":
|
370 |
keys_to_clear = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
"hvac_loads_rerun_pending",
|
372 |
"hvac_loads_form_state",
|
373 |
"hvac_loads_editor",
|