Upload 31 files
Browse files- app/building_info_form.py +32 -27
app/building_info_form.py
CHANGED
|
@@ -26,32 +26,6 @@ class BuildingInfoForm:
|
|
| 26 |
Display the building information form.
|
| 27 |
This method is called from main.py.
|
| 28 |
"""
|
| 29 |
-
# Initialize building info in session state if not exists
|
| 30 |
-
if "building_info" not in st.session_state:
|
| 31 |
-
st.session_state["building_info"] = {
|
| 32 |
-
"project_name": "",
|
| 33 |
-
"building_name": "",
|
| 34 |
-
"location": "",
|
| 35 |
-
"climate_zone": "",
|
| 36 |
-
"building_type": "",
|
| 37 |
-
"floor_area": 0.0,
|
| 38 |
-
"num_floors": 1,
|
| 39 |
-
"floor_height": 3.0,
|
| 40 |
-
"orientation": "NORTH",
|
| 41 |
-
"occupancy": 0,
|
| 42 |
-
"operating_hours": "8:00-18:00",
|
| 43 |
-
"design_conditions": {
|
| 44 |
-
"summer_outdoor_db": 35.0,
|
| 45 |
-
"summer_outdoor_wb": 25.0,
|
| 46 |
-
"summer_indoor_db": 24.0,
|
| 47 |
-
"summer_indoor_rh": 50.0,
|
| 48 |
-
"winter_outdoor_db": -5.0,
|
| 49 |
-
"winter_outdoor_rh": 80.0,
|
| 50 |
-
"winter_indoor_db": 21.0,
|
| 51 |
-
"winter_indoor_rh": 40.0
|
| 52 |
-
}
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
self.display_building_info_form(st.session_state)
|
| 56 |
|
| 57 |
@staticmethod
|
|
@@ -89,9 +63,40 @@ class BuildingInfoForm:
|
|
| 89 |
"winter_indoor_rh": 40.0
|
| 90 |
}
|
| 91 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
# Create form
|
| 94 |
-
with st.form(
|
| 95 |
st.subheader("Project Information")
|
| 96 |
|
| 97 |
col1, col2 = st.columns(2)
|
|
|
|
| 26 |
Display the building information form.
|
| 27 |
This method is called from main.py.
|
| 28 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
self.display_building_info_form(st.session_state)
|
| 30 |
|
| 31 |
@staticmethod
|
|
|
|
| 63 |
"winter_indoor_rh": 40.0
|
| 64 |
}
|
| 65 |
}
|
| 66 |
+
# Ensure design_conditions exists
|
| 67 |
+
elif "design_conditions" not in session_state["building_info"]:
|
| 68 |
+
session_state["building_info"]["design_conditions"] = {
|
| 69 |
+
"summer_outdoor_db": 35.0,
|
| 70 |
+
"summer_outdoor_wb": 25.0,
|
| 71 |
+
"summer_indoor_db": 24.0,
|
| 72 |
+
"summer_indoor_rh": 50.0,
|
| 73 |
+
"winter_outdoor_db": -5.0,
|
| 74 |
+
"winter_outdoor_rh": 80.0,
|
| 75 |
+
"winter_indoor_db": 21.0,
|
| 76 |
+
"winter_indoor_rh": 40.0
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
# Initialize missing fields with default values
|
| 80 |
+
default_values = {
|
| 81 |
+
"project_name": "",
|
| 82 |
+
"building_name": "",
|
| 83 |
+
"location": "",
|
| 84 |
+
"climate_zone": "",
|
| 85 |
+
"building_type": "",
|
| 86 |
+
"floor_area": 0.0,
|
| 87 |
+
"num_floors": 1,
|
| 88 |
+
"floor_height": 3.0,
|
| 89 |
+
"orientation": "NORTH",
|
| 90 |
+
"occupancy": 0,
|
| 91 |
+
"operating_hours": "8:00-18:00"
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
for key, default_value in default_values.items():
|
| 95 |
+
if key not in session_state["building_info"]:
|
| 96 |
+
session_state["building_info"][key] = default_value
|
| 97 |
|
| 98 |
# Create form
|
| 99 |
+
with st.form("building_info_form"):
|
| 100 |
st.subheader("Project Information")
|
| 101 |
|
| 102 |
col1, col2 = st.columns(2)
|