Spaces:
Sleeping
Sleeping
Update app/internal_loads.py
Browse files- app/internal_loads.py +8 -1
app/internal_loads.py
CHANGED
@@ -126,6 +126,13 @@ def display_people_tab():
|
|
126 |
if "people_action" not in st.session_state:
|
127 |
st.session_state.people_action = {"action": None, "id": None}
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
# Display the editor form
|
130 |
with st.form("people_editor_form", clear_on_submit=True):
|
131 |
editor_state = st.session_state.get("people_editor", {})
|
@@ -143,7 +150,7 @@ def display_people_tab():
|
|
143 |
"Number of People",
|
144 |
min_value=1,
|
145 |
max_value=1000,
|
146 |
-
value=int(editor_state.get("num_people",
|
147 |
help="Number of people in this group."
|
148 |
)
|
149 |
|
|
|
126 |
if "people_action" not in st.session_state:
|
127 |
st.session_state.people_action = {"action": None, "id": None}
|
128 |
|
129 |
+
# Get building type and floor area for default number of people
|
130 |
+
building_type = st.session_state.project_data["building_info"].get("building_type")
|
131 |
+
floor_area = st.session_state.project_data["building_info"].get("floor_area", 100.0)
|
132 |
+
schedule_type = DEFAULT_BUILDING_INTERNALS.get(building_type, DEFAULT_BUILDING_INTERNALS["Other"])["schedule_type"]
|
133 |
+
occupant_density = DEFAULT_OCCUPANT_DENSITY.get(schedule_type, 0.1) # Default to 0.1 if not found
|
134 |
+
default_num_people = int(np.ceil(occupant_density * floor_area))
|
135 |
+
|
136 |
# Display the editor form
|
137 |
with st.form("people_editor_form", clear_on_submit=True):
|
138 |
editor_state = st.session_state.get("people_editor", {})
|
|
|
150 |
"Number of People",
|
151 |
min_value=1,
|
152 |
max_value=1000,
|
153 |
+
value=int(editor_state.get("num_people", default_num_people)),
|
154 |
help="Number of people in this group."
|
155 |
)
|
156 |
|