Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -38,30 +38,6 @@ from app.materials_cost import display_materials_cost_page
|
|
38 |
from app.m_c_data import SAMPLE_MATERIALS, SAMPLE_FENESTRATIONS, DEFAULT_MATERIAL_PROPERTIES, DEFAULT_WINDOW_PROPERTIES, SAMPLE_CONSTRUCTIONS
|
39 |
|
40 |
class BuildSustain:
|
41 |
-
"""
|
42 |
-
Main class for the BuildSustain application.
|
43 |
-
Handles navigation, session state initialization, and module integration.
|
44 |
-
"""
|
45 |
-
|
46 |
-
def __init__(self):
|
47 |
-
"""
|
48 |
-
Initialize the BuildSustain application.
|
49 |
-
Sets up the page configuration and initializes session state if needed.
|
50 |
-
"""
|
51 |
-
# Configure the Streamlit page
|
52 |
-
st.set_page_config(
|
53 |
-
page_title="BuildSustain",
|
54 |
-
page_icon="🌡️",
|
55 |
-
layout="wide",
|
56 |
-
initial_sidebar_state="expanded"
|
57 |
-
)
|
58 |
-
|
59 |
-
# Initialize session state if it doesn't exist
|
60 |
-
self._initialize_session_state()
|
61 |
-
|
62 |
-
# Set up the application layout
|
63 |
-
self.setup_layout()
|
64 |
-
|
65 |
def _initialize_session_state(self):
|
66 |
"""
|
67 |
Initialize the session state structure if it doesn't exist.
|
@@ -71,7 +47,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")
|
@@ -121,7 +97,7 @@ class BuildSustain:
|
|
121 |
"epw_filename": "",
|
122 |
"typical_extreme_periods": {},
|
123 |
"ground_temperatures": {},
|
124 |
-
"ground_reflectivity": 0.2
|
125 |
},
|
126 |
"materials": {
|
127 |
"library": dict(SAMPLE_MATERIALS),
|
@@ -156,27 +132,24 @@ class BuildSustain:
|
|
156 |
"peak": 0,
|
157 |
"summary_tables": {},
|
158 |
"charts": {},
|
159 |
-
"breakdown": {}
|
160 |
},
|
161 |
"heating": {
|
162 |
"hourly": [],
|
163 |
"peak": 0,
|
164 |
"summary_tables": {},
|
165 |
"charts": {},
|
166 |
-
"breakdown": {}
|
167 |
}
|
168 |
},
|
169 |
-
"hvac_settings": { #
|
170 |
-
|
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": {
|
180 |
"type": "Fixed Setpoints",
|
181 |
"cooling_setpoint": {"temperature": 24.0, "rh": 50.0},
|
182 |
"heating_setpoint": {"temperature": 20.0, "rh": 50.0},
|
|
|
38 |
from app.m_c_data import SAMPLE_MATERIALS, SAMPLE_FENESTRATIONS, DEFAULT_MATERIAL_PROPERTIES, DEFAULT_WINDOW_PROPERTIES, SAMPLE_CONSTRUCTIONS
|
39 |
|
40 |
class BuildSustain:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
def _initialize_session_state(self):
|
42 |
"""
|
43 |
Initialize the session state structure if it doesn't exist.
|
|
|
47 |
if 'current_page' not in st.session_state:
|
48 |
st.session_state.current_page = "Intro"
|
49 |
|
50 |
+
# Initialize material library if not set
|
51 |
if 'material_library' not in st.session_state:
|
52 |
st.session_state.material_library = MaterialLibrary()
|
53 |
logger.info("Initialized MaterialLibrary in session state")
|
|
|
97 |
"epw_filename": "",
|
98 |
"typical_extreme_periods": {},
|
99 |
"ground_temperatures": {},
|
100 |
+
"ground_reflectivity": 0.2
|
101 |
},
|
102 |
"materials": {
|
103 |
"library": dict(SAMPLE_MATERIALS),
|
|
|
132 |
"peak": 0,
|
133 |
"summary_tables": {},
|
134 |
"charts": {},
|
135 |
+
"breakdown": {}
|
136 |
},
|
137 |
"heating": {
|
138 |
"hourly": [],
|
139 |
"peak": 0,
|
140 |
"summary_tables": {},
|
141 |
"charts": {},
|
142 |
+
"breakdown": {}
|
143 |
}
|
144 |
},
|
145 |
+
"hvac_settings": {}, # Removed operating_hours and system_type
|
146 |
+
"sim_period": {
|
|
|
|
|
|
|
147 |
"type": "Full Year",
|
148 |
"start_date": None,
|
149 |
"end_date": None,
|
150 |
"base_temp": 18.3
|
151 |
},
|
152 |
+
"indoor_conditions": {
|
153 |
"type": "Fixed Setpoints",
|
154 |
"cooling_setpoint": {"temperature": 24.0, "rh": 50.0},
|
155 |
"heating_setpoint": {"temperature": 20.0, "rh": 50.0},
|