Spaces:
Sleeping
Sleeping
Update utils/heating_load.py
Browse files- utils/heating_load.py +36 -11
utils/heating_load.py
CHANGED
@@ -271,33 +271,58 @@ class HeatingLoadCalculator:
|
|
271 |
return max(0, load)
|
272 |
|
273 |
# ENHANCEMENT: Added skylight heating load calculation
|
274 |
-
def calculate_skylight_heating_load(self, skylight: Skylight, outdoor_temp: float, indoor_temp: float) -> float:
|
275 |
"""
|
276 |
Calculate heating load for a skylight.
|
277 |
Reference: ASHRAE Handbook—Fundamentals (2017), Chapter 18, Equation 18.1.
|
278 |
-
|
279 |
Args:
|
280 |
skylight: Skylight component
|
281 |
outdoor_temp: Outdoor temperature in °C
|
282 |
indoor_temp: Indoor temperature in °C
|
283 |
-
|
|
|
284 |
Returns:
|
285 |
Heating load in W
|
286 |
"""
|
287 |
delta_t = indoor_temp - outdoor_temp
|
288 |
if delta_t <= 1:
|
289 |
return 0.0
|
290 |
-
|
291 |
-
#
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
load = self.heat_transfer.conduction_heat_transfer(adjusted_u_value, skylight.area, delta_t)
|
296 |
-
|
297 |
# Log detailed information in debug mode
|
298 |
if self.debug_mode:
|
299 |
-
logger.debug(f"Skylight {skylight.name} heating load: u_value={adjusted_u_value}, area={skylight.area}, delta_t={delta_t}, load={load:.2f} W")
|
300 |
-
|
301 |
return max(0, load)
|
302 |
|
303 |
def calculate_infiltration_heating_load(self, indoor_conditions: Dict[str, float],
|
|
|
271 |
return max(0, load)
|
272 |
|
273 |
# ENHANCEMENT: Added skylight heating load calculation
|
274 |
+
def calculate_skylight_heating_load(self, skylight: Skylight, outdoor_temp: float, indoor_temp: float, frame_type: Optional[str] = None) -> float:
|
275 |
"""
|
276 |
Calculate heating load for a skylight.
|
277 |
Reference: ASHRAE Handbook—Fundamentals (2017), Chapter 18, Equation 18.1.
|
278 |
+
|
279 |
Args:
|
280 |
skylight: Skylight component
|
281 |
outdoor_temp: Outdoor temperature in °C
|
282 |
indoor_temp: Indoor temperature in °C
|
283 |
+
frame_type: Type of skylight frame (optional, e.g., 'Aluminum without Thermal Break')
|
284 |
+
|
285 |
Returns:
|
286 |
Heating load in W
|
287 |
"""
|
288 |
delta_t = indoor_temp - outdoor_temp
|
289 |
if delta_t <= 1:
|
290 |
return 0.0
|
291 |
+
|
292 |
+
# Initialize adjusted U-value
|
293 |
+
adjusted_u_value = skylight.u_value
|
294 |
+
|
295 |
+
# Adjust U-value based on frame_type if provided
|
296 |
+
frame_adjustments = {
|
297 |
+
'Aluminum without Thermal Break': 1.0,
|
298 |
+
'Aluminum with Thermal Break': 0.8,
|
299 |
+
'Vinyl/Fiberglass': 0.6,
|
300 |
+
'Wood/Vinyl-Clad Wood': 0.5,
|
301 |
+
'Insulated': 0.4
|
302 |
+
}
|
303 |
+
if frame_type:
|
304 |
+
adjustment = frame_adjustments.get(frame_type, 1.0)
|
305 |
+
adjusted_u_value *= adjustment
|
306 |
+
elif hasattr(skylight, 'frame_type') and skylight.frame_type:
|
307 |
+
# Fallback to skylight.frame_type if frame_type not provided
|
308 |
+
adjustment = frame_adjustments.get(skylight.frame_type, 1.0)
|
309 |
+
adjusted_u_value *= adjustment
|
310 |
+
|
311 |
+
# Adjust U-value for drapery based on drapery_openness
|
312 |
+
if hasattr(skylight, 'drapery_openness') and skylight.drapery_openness != 'Open':
|
313 |
+
drapery_reduction = {
|
314 |
+
'Closed': 0.20,
|
315 |
+
'Semi-Open': 0.10,
|
316 |
+
'Open': 0.0
|
317 |
+
}.get(skylight.drapery_openness, 0.15)
|
318 |
+
adjusted_u_value *= (1 - drapery_reduction)
|
319 |
+
|
320 |
load = self.heat_transfer.conduction_heat_transfer(adjusted_u_value, skylight.area, delta_t)
|
321 |
+
|
322 |
# Log detailed information in debug mode
|
323 |
if self.debug_mode:
|
324 |
+
logger.debug(f"Skylight {skylight.name} heating load: u_value={adjusted_u_value}, area={skylight.area}, delta_t={delta_t}, frame_type={frame_type or skylight.frame_type}, load={load:.2f} W")
|
325 |
+
|
326 |
return max(0, load)
|
327 |
|
328 |
def calculate_infiltration_heating_load(self, indoor_conditions: Dict[str, float],
|