Spaces:
Sleeping
Sleeping
Update utils/heating_load.py
Browse files- utils/heating_load.py +31 -12
utils/heating_load.py
CHANGED
|
@@ -175,29 +175,48 @@ class HeatingLoadCalculator:
|
|
| 175 |
|
| 176 |
return max(0, load)
|
| 177 |
|
| 178 |
-
def calculate_window_heating_load(self, window: Window, outdoor_temp: float, indoor_temp: float) -> float:
|
| 179 |
"""
|
| 180 |
Calculate heating load for a window.
|
| 181 |
Reference: ASHRAE Handbook—Fundamentals (2017), Chapter 18, Equation 18.1.
|
| 182 |
-
|
| 183 |
Args:
|
| 184 |
window: Window component
|
| 185 |
outdoor_temp: Outdoor temperature in °C
|
| 186 |
indoor_temp: Indoor temperature in °C
|
| 187 |
-
|
|
|
|
| 188 |
Returns:
|
| 189 |
Heating load in W
|
| 190 |
"""
|
| 191 |
delta_t = indoor_temp - outdoor_temp
|
| 192 |
if delta_t <= 1:
|
| 193 |
return 0.0
|
| 194 |
-
|
| 195 |
-
#
|
| 196 |
adjusted_u_value = window.u_value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
if hasattr(window, 'has_drapery') and window.has_drapery:
|
| 198 |
# Simple U-value adjustment for drapery (typically reduces U-value by 10-20%)
|
| 199 |
drapery_reduction = 0.15 # 15% reduction as a default
|
| 200 |
-
|
| 201 |
# More detailed adjustment if drapery properties are available
|
| 202 |
if hasattr(window, 'drapery_type'):
|
| 203 |
drapery_reductions = {
|
|
@@ -209,15 +228,15 @@ class HeatingLoadCalculator:
|
|
| 209 |
'Blackout': 0.25
|
| 210 |
}
|
| 211 |
drapery_reduction = drapery_reductions.get(window.drapery_type, 0.15)
|
| 212 |
-
|
| 213 |
-
adjusted_u_value = window.u_value * (1 - drapery_reduction)
|
| 214 |
|
|
|
|
|
|
|
| 215 |
load = self.heat_transfer.conduction_heat_transfer(adjusted_u_value, window.area, delta_t)
|
| 216 |
-
|
| 217 |
-
#
|
| 218 |
if self.debug_mode:
|
| 219 |
-
logger.debug(f"Window {window.name} heating load: u_value={adjusted_u_value}, area={window.area}, delta_t={delta_t}, load={load:.2f} W")
|
| 220 |
-
|
| 221 |
return max(0, load)
|
| 222 |
|
| 223 |
def calculate_door_heating_load(self, door: Door, outdoor_temp: float, indoor_temp: float) -> float:
|
|
|
|
| 175 |
|
| 176 |
return max(0, load)
|
| 177 |
|
| 178 |
+
def calculate_window_heating_load(self, window: Window, outdoor_temp: float, indoor_temp: float, frame_type: Optional[str] = None) -> float:
|
| 179 |
"""
|
| 180 |
Calculate heating load for a window.
|
| 181 |
Reference: ASHRAE Handbook—Fundamentals (2017), Chapter 18, Equation 18.1.
|
| 182 |
+
|
| 183 |
Args:
|
| 184 |
window: Window component
|
| 185 |
outdoor_temp: Outdoor temperature in °C
|
| 186 |
indoor_temp: Indoor temperature in °C
|
| 187 |
+
frame_type: Type of window frame (optional, e.g., 'Aluminum without Thermal Break')
|
| 188 |
+
|
| 189 |
Returns:
|
| 190 |
Heating load in W
|
| 191 |
"""
|
| 192 |
delta_t = indoor_temp - outdoor_temp
|
| 193 |
if delta_t <= 1:
|
| 194 |
return 0.0
|
| 195 |
+
|
| 196 |
+
# Initialize adjusted U-value
|
| 197 |
adjusted_u_value = window.u_value
|
| 198 |
+
|
| 199 |
+
# Adjust U-value based on frame_type if provided
|
| 200 |
+
frame_adjustments = {
|
| 201 |
+
'Aluminum without Thermal Break': 1.0,
|
| 202 |
+
'Aluminum with Thermal Break': 0.8,
|
| 203 |
+
'Vinyl/Fiberglass': 0.6,
|
| 204 |
+
'Wood/Vinyl-Clad Wood': 0.5,
|
| 205 |
+
'Insulated': 0.4
|
| 206 |
+
}
|
| 207 |
+
if frame_type:
|
| 208 |
+
adjustment = frame_adjustments.get(frame_type, 1.0)
|
| 209 |
+
adjusted_u_value *= adjustment
|
| 210 |
+
elif hasattr(window, 'frame_type') and window.frame_type:
|
| 211 |
+
# Fallback to window.frame_type if frame_type not provided
|
| 212 |
+
adjustment = frame_adjustments.get(window.frame_type, 1.0)
|
| 213 |
+
adjusted_u_value *= adjustment
|
| 214 |
+
|
| 215 |
+
# Adjust U-value if window has drapery
|
| 216 |
if hasattr(window, 'has_drapery') and window.has_drapery:
|
| 217 |
# Simple U-value adjustment for drapery (typically reduces U-value by 10-20%)
|
| 218 |
drapery_reduction = 0.15 # 15% reduction as a default
|
| 219 |
+
|
| 220 |
# More detailed adjustment if drapery properties are available
|
| 221 |
if hasattr(window, 'drapery_type'):
|
| 222 |
drapery_reductions = {
|
|
|
|
| 228 |
'Blackout': 0.25
|
| 229 |
}
|
| 230 |
drapery_reduction = drapery_reductions.get(window.drapery_type, 0.15)
|
|
|
|
|
|
|
| 231 |
|
| 232 |
+
adjusted_u_value *= (1 - drapery_reduction)
|
| 233 |
+
|
| 234 |
load = self.heat_transfer.conduction_heat_transfer(adjusted_u_value, window.area, delta_t)
|
| 235 |
+
|
| 236 |
+
# Log detailed information in debug mode
|
| 237 |
if self.debug_mode:
|
| 238 |
+
logger.debug(f"Window {window.name} heating load: u_value={adjusted_u_value}, area={window.area}, delta_t={delta_t}, frame_type={frame_type or window.frame_type}, load={load:.2f} W")
|
| 239 |
+
|
| 240 |
return max(0, load)
|
| 241 |
|
| 242 |
def calculate_door_heating_load(self, door: Door, outdoor_temp: float, indoor_temp: float) -> float:
|