mabuseif commited on
Commit
f485cba
·
verified ·
1 Parent(s): de5d290

Update app/building_information.py

Browse files
Files changed (1) hide show
  1. app/building_information.py +85 -77
app/building_information.py CHANGED
@@ -3,7 +3,7 @@ BuildSustain - Building Information Module
3
 
4
  This module handles the building information input page of the BuildSustain application,
5
  allowing users to define basic building parameters such as project name, floor area, building height,
6
- indoor design conditions, orientation, and building type.
7
 
8
  Developed by: Dr Majed Abuseif, Deakin University
9
  © 2025
@@ -36,16 +36,15 @@ def display_building_info_page():
36
  current_values = st.session_state.project_data["building_info"]
37
 
38
  # Project Name
39
- project_name = st.text_input(
40
- "Project Name",
41
- value=current_values["project_name"],
42
- help="Enter a unique identifier for your project."
43
- )
44
-
45
- # Create two columns for layout
46
  col1, col2 = st.columns(2)
47
-
48
  with col1:
 
 
 
 
 
 
 
49
  # Floor Area
50
  floor_area = st.number_input(
51
  "Floor Area (square meters)",
@@ -56,7 +55,11 @@ def display_building_info_page():
56
  format="%.1f",
57
  help="Total conditioned floor area of the building in square meters."
58
  )
59
-
 
 
 
 
60
  # Building Height
61
  building_height = st.number_input(
62
  "Building Height (meters)",
@@ -73,41 +76,57 @@ def display_building_info_page():
73
  "Building Type",
74
  options=BUILDING_TYPES,
75
  index=BUILDING_TYPES.index(current_values["building_type"]) if current_values["building_type"] in BUILDING_TYPES else 0,
76
- help="Primary use of the building, which affects default internal loads and ventilation rates."
77
  )
78
 
79
  with col2:
80
- # Indoor Design Temperature
81
- indoor_design_temp = st.number_input(
82
- "Indoor Design Temperature (°C)",
83
  min_value=15.0,
84
  max_value=30.0,
85
- value=float(current_values["indoor_design_temp"]),
86
  step=0.5,
87
  format="%.1f",
88
- help="Target indoor temperature for cooling season comfort (15–30°C)."
89
  )
90
 
91
- # Indoor Design Relative Humidity
92
- indoor_design_rh = st.number_input(
93
- "Indoor Design Relative Humidity (%)",
94
  min_value=20.0,
95
  max_value=80.0,
96
- value=float(current_values["indoor_design_rh"]),
97
  step=5.0,
98
  format="%.1f",
99
- help="Target indoor relative humidity for comfort (20–80%)."
100
  )
101
-
102
- # Ventilation Rate
103
- ventilation_rate = st.number_input(
104
- "Ventilation Rate (L/s/m²)",
105
- min_value=0.0,
106
- max_value=10.0,
107
- value=float(current_values["ventilation_rate"]),
108
- step=0.1,
109
- format="%.2f",
110
- help="Fresh air ventilation rate in liters per second per square meter."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  )
112
 
113
  # Building Orientation
@@ -125,16 +144,6 @@ def display_building_info_page():
125
  help="Sets the building's rotation angle relative to north (0°). Component orientations are defined as A (North), B (South), C (East), D (West) at 0°. Adjusting this angle rotates all component orientations accordingly."
126
  )
127
 
128
- # Operation Hours
129
- operation_hours = st.slider(
130
- "Operation Hours (hours/day)",
131
- min_value=0,
132
- max_value=24,
133
- value=int(current_values["operation_hours"]),
134
- step=1,
135
- help="Daily hours the building is occupied or operational, affecting internal loads (0–24 hours)."
136
- )
137
-
138
  # Form submission button
139
  submit_button = st.form_submit_button("Save Building Information")
140
 
@@ -142,8 +151,9 @@ def display_building_info_page():
142
  # Validate inputs
143
  validation_errors = validate_building_info(
144
  project_name, floor_area, building_height, building_type,
145
- indoor_design_temp, indoor_design_rh, ventilation_rate,
146
- orientation_angle, operation_hours
 
147
  )
148
 
149
  if validation_errors:
@@ -158,11 +168,11 @@ def display_building_info_page():
158
  "floor_area": floor_area,
159
  "building_height": building_height,
160
  "building_type": building_type,
161
- "indoor_design_temp": indoor_design_temp,
162
- "indoor_design_rh": indoor_design_rh,
163
- "ventilation_rate": ventilation_rate,
164
- "orientation_angle": float(orientation_angle),
165
- "operation_hours": operation_hours
166
  })
167
 
168
  # Log the update
@@ -193,11 +203,11 @@ def validate_building_info(
193
  floor_area: float,
194
  building_height: float,
195
  building_type: str,
196
- indoor_design_temp: float,
197
- indoor_design_rh: float,
198
- ventilation_rate: float,
199
- orientation_angle: int,
200
- operation_hours: int
201
  ) -> List[str]:
202
  """
203
  Validate building information inputs.
@@ -207,11 +217,11 @@ def validate_building_info(
207
  floor_area: Floor area in square meters
208
  building_height: Building height in meters
209
  building_type: Building type
210
- indoor_design_temp: Indoor design temperature in °C
211
- indoor_design_rh: Indoor design relative humidity in %
212
- ventilation_rate: Ventilation rate in L/s/m²
 
213
  orientation_angle: Building orientation angle in degrees
214
- operation_hours: Building operation hours per day
215
 
216
  Returns:
217
  List of validation error messages, empty if all inputs are valid
@@ -238,28 +248,26 @@ def validate_building_info(
238
  if building_type not in BUILDING_TYPES:
239
  errors.append("Please select a valid building type.")
240
 
241
- # Validate indoor design temperature
242
- if indoor_design_temp < 15.0 or indoor_design_temp > 30.0:
243
- errors.append("Indoor design temperature must be between 15°C and 30°C.")
244
 
245
- # Validate indoor design relative humidity
246
- if indoor_design_rh < 20.0 or indoor_design_rh > 80.0:
247
- errors.append("Indoor design relative humidity must be between 20% and 80%.")
248
 
249
- # Validate ventilation rate
250
- if ventilation_rate < 0.0:
251
- errors.append("Ventilation rate cannot be negative.")
252
- elif ventilation_rate > 10.0:
253
- errors.append("Ventilation rate exceeds maximum value (10 L/s/m²).")
 
 
254
 
255
  # Validate orientation angle
256
  if orientation_angle < -180 or orientation_angle > 180:
257
  errors.append("Orientation angle must be between -180° and 180°.")
258
 
259
- # Validate operation hours
260
- if operation_hours < 0 or operation_hours > 24:
261
- errors.append("Operation hours must be between 0 and 24.")
262
-
263
  return errors
264
 
265
  def display_building_info_help():
@@ -274,12 +282,12 @@ def display_building_info_help():
274
  * **Project Name**: A unique identifier for your project.
275
  * **Floor Area**: The total conditioned floor area of the building in square meters.
276
  * **Building Height**: The average ceiling height of the building in meters.
277
- * **Building Type**: The primary use of the building, which affects default internal loads and ventilation rates.
278
- * **Indoor Design Temperature**: The target indoor temperature for cooling season comfort (typically 22-26°C).
279
- * **Indoor Design Relative Humidity**: The target indoor relative humidity for comfort (typically 40-60%).
280
- * **Ventilation Rate**: The fresh air ventilation rate in liters per second per square meter.
 
281
  * **Orientation Angle**: The building's rotation angle relative to north (0°).
282
- * **Operation Hours**: Daily hours the building is occupied or operational, affecting internal loads.
283
 
284
  **Building Orientation:**
285
 
 
3
 
4
  This module handles the building information input page of the BuildSustain application,
5
  allowing users to define basic building parameters such as project name, floor area, building height,
6
+ indoor design conditions for winter and summer, orientation, and building type.
7
 
8
  Developed by: Dr Majed Abuseif, Deakin University
9
  © 2025
 
36
  current_values = st.session_state.project_data["building_info"]
37
 
38
  # Project Name
 
 
 
 
 
 
 
39
  col1, col2 = st.columns(2)
 
40
  with col1:
41
+ project_name = st.text_input(
42
+ "Project Name",
43
+ value=current_values["project_name"],
44
+ help="Enter a unique identifier for your project."
45
+ )
46
+
47
+ with col2:
48
  # Floor Area
49
  floor_area = st.number_input(
50
  "Floor Area (square meters)",
 
55
  format="%.1f",
56
  help="Total conditioned floor area of the building in square meters."
57
  )
58
+
59
+ # Create two columns for layout
60
+ col1, col2 = st.columns(2)
61
+
62
+ with col1:
63
  # Building Height
64
  building_height = st.number_input(
65
  "Building Height (meters)",
 
76
  "Building Type",
77
  options=BUILDING_TYPES,
78
  index=BUILDING_TYPES.index(current_values["building_type"]) if current_values["building_type"] in BUILDING_TYPES else 0,
79
+ help="Primary use of the building, which affects default internal loads."
80
  )
81
 
82
  with col2:
83
+ # Winter Indoor Design Temperature
84
+ winter_indoor_design_temp = st.number_input(
85
+ "Winter Indoor Design Temperature (°C)",
86
  min_value=15.0,
87
  max_value=30.0,
88
+ value=float(current_values.get("winter_indoor_design_temp", current_values.get("indoor_design_temp", 20.0))),
89
  step=0.5,
90
  format="%.1f",
91
+ help="Target indoor temperature for winter season comfort (15–30°C)."
92
  )
93
 
94
+ # Winter Indoor Design Relative Humidity
95
+ winter_indoor_design_rh = st.number_input(
96
+ "Winter Indoor Design Relative Humidity (%)",
97
  min_value=20.0,
98
  max_value=80.0,
99
+ value=float(current_values.get("winter_indoor_design_rh", current_values.get("indoor_design_rh", 50.0))),
100
  step=5.0,
101
  format="%.1f",
102
+ help="Target indoor relative humidity for winter season comfort (20–80%)."
103
  )
104
+
105
+ # Summer Indoor Design Conditions
106
+ col1, col2 = st.columns(2)
107
+
108
+ with col1:
109
+ # Summer Indoor Design Temperature
110
+ summer_indoor_design_temp = st.number_input(
111
+ "Summer Indoor Design Temperature (°C)",
112
+ min_value=15.0,
113
+ max_value=30.0,
114
+ value=float(current_values.get("summer_indoor_design_temp", current_values.get("indoor_design_temp", 24.0))),
115
+ step=0.5,
116
+ format="%.1f",
117
+ help="Target indoor temperature for summer season comfort (15–30°C)."
118
+ )
119
+
120
+ with col2:
121
+ # Summer Indoor Design Relative Humidity
122
+ summer_indoor_design_rh = st.number_input(
123
+ "Summer Indoor Design Relative Humidity (%)",
124
+ min_value=20.0,
125
+ max_value=80.0,
126
+ value=float(current_values.get("summer_indoor_design_rh", current_values.get("indoor_design_rh", 50.0))),
127
+ step=5.0,
128
+ format="%.1f",
129
+ help="Target indoor relative humidity for summer season comfort (20–80%)."
130
  )
131
 
132
  # Building Orientation
 
144
  help="Sets the building's rotation angle relative to north (0°). Component orientations are defined as A (North), B (South), C (East), D (West) at 0°. Adjusting this angle rotates all component orientations accordingly."
145
  )
146
 
 
 
 
 
 
 
 
 
 
 
147
  # Form submission button
148
  submit_button = st.form_submit_button("Save Building Information")
149
 
 
151
  # Validate inputs
152
  validation_errors = validate_building_info(
153
  project_name, floor_area, building_height, building_type,
154
+ winter_indoor_design_temp, winter_indoor_design_rh,
155
+ summer_indoor_design_temp, summer_indoor_design_rh,
156
+ orientation_angle
157
  )
158
 
159
  if validation_errors:
 
168
  "floor_area": floor_area,
169
  "building_height": building_height,
170
  "building_type": building_type,
171
+ "winter_indoor_design_temp": winter_indoor_design_temp,
172
+ "winter_indoor_design_rh": winter_indoor_design_rh,
173
+ "summer_indoor_design_temp": summer_indoor_design_temp,
174
+ "summer_indoor_design_rh": summer_indoor_design_rh,
175
+ "orientation_angle": float(orientation_angle)
176
  })
177
 
178
  # Log the update
 
203
  floor_area: float,
204
  building_height: float,
205
  building_type: str,
206
+ winter_indoor_design_temp: float,
207
+ winter_indoor_design_rh: float,
208
+ summer_indoor_design_temp: float,
209
+ summer_indoor_design_rh: float,
210
+ orientation_angle: int
211
  ) -> List[str]:
212
  """
213
  Validate building information inputs.
 
217
  floor_area: Floor area in square meters
218
  building_height: Building height in meters
219
  building_type: Building type
220
+ winter_indoor_design_temp: Winter indoor design temperature in °C
221
+ winter_indoor_design_rh: Winter indoor design relative humidity in %
222
+ summer_indoor_design_temp: Summer indoor design temperature in °C
223
+ summer_indoor_design_rh: Summer indoor design relative humidity in %
224
  orientation_angle: Building orientation angle in degrees
 
225
 
226
  Returns:
227
  List of validation error messages, empty if all inputs are valid
 
248
  if building_type not in BUILDING_TYPES:
249
  errors.append("Please select a valid building type.")
250
 
251
+ # Validate winter indoor design temperature
252
+ if winter_indoor_design_temp < 15.0 or winter_indoor_design_temp > 30.0:
253
+ errors.append("Winter indoor design temperature must be between 15°C and 30°C.")
254
 
255
+ # Validate winter indoor design relative humidity
256
+ if winter_indoor_design_rh < 20.0 or winter_indoor_design_rh > 80.0:
257
+ errors.append("Winter indoor design relative humidity must be between 20% and 80%.")
258
 
259
+ # Validate summer indoor design temperature
260
+ if summer_indoor_design_temp < 15.0 or summer_indoor_design_temp > 30.0:
261
+ errors.append("Summer indoor design temperature must be between 15°C and 30°C.")
262
+
263
+ # Validate summer indoor design relative humidity
264
+ if summer_indoor_design_rh < 20.0 or summer_indoor_design_rh > 80.0:
265
+ errors.append("Summer indoor design relative humidity must be between 20% and 80%.")
266
 
267
  # Validate orientation angle
268
  if orientation_angle < -180 or orientation_angle > 180:
269
  errors.append("Orientation angle must be between -180° and 180°.")
270
 
 
 
 
 
271
  return errors
272
 
273
  def display_building_info_help():
 
282
  * **Project Name**: A unique identifier for your project.
283
  * **Floor Area**: The total conditioned floor area of the building in square meters.
284
  * **Building Height**: The average ceiling height of the building in meters.
285
+ * **Building Type**: The primary use of the building, which affects default internal loads.
286
+ * **Winter Indoor Design Temperature**: The target indoor temperature for winter season comfort (typically 20-24°C).
287
+ * **Winter Indoor Design Relative Humidity**: The target indoor relative humidity for winter season comfort (typically 30-50%).
288
+ * **Summer Indoor Design Temperature**: The target indoor temperature for summer season comfort (typically 22-26°C).
289
+ * **Summer Indoor Design Relative Humidity**: The target indoor relative humidity for summer season comfort (typically 40-60%).
290
  * **Orientation Angle**: The building's rotation angle relative to north (0°).
 
291
 
292
  **Building Orientation:**
293