Spaces:
Sleeping
Sleeping
Update utils/cooling_load.py
Browse files- utils/cooling_load.py +18 -12
utils/cooling_load.py
CHANGED
|
@@ -253,7 +253,8 @@ class CoolingLoadCalculator:
|
|
| 253 |
indoor_temp=indoor_conditions['temperature'],
|
| 254 |
month=month,
|
| 255 |
hour=hour,
|
| 256 |
-
latitude=latitude
|
|
|
|
| 257 |
)
|
| 258 |
hourly_loads['walls'][hour + 1] += load
|
| 259 |
|
|
@@ -266,7 +267,8 @@ class CoolingLoadCalculator:
|
|
| 266 |
indoor_temp=indoor_conditions['temperature'],
|
| 267 |
month=month,
|
| 268 |
hour=hour,
|
| 269 |
-
latitude=latitude
|
|
|
|
| 270 |
)
|
| 271 |
hourly_loads['roofs'][hour + 1] += load
|
| 272 |
|
|
@@ -470,7 +472,8 @@ class CoolingLoadCalculator:
|
|
| 470 |
indoor_temp: float,
|
| 471 |
month: str,
|
| 472 |
hour: int,
|
| 473 |
-
latitude: str
|
|
|
|
| 474 |
) -> float:
|
| 475 |
"""
|
| 476 |
Calculate cooling load for a wall using CLTD method.
|
|
@@ -483,6 +486,7 @@ class CoolingLoadCalculator:
|
|
| 483 |
month: Design month
|
| 484 |
hour: Hour of the day
|
| 485 |
latitude: Latitude (e.g., '24N')
|
|
|
|
| 486 |
|
| 487 |
Returns:
|
| 488 |
Cooling load in Watts
|
|
@@ -492,7 +496,7 @@ class CoolingLoadCalculator:
|
|
| 492 |
month = self.validate_month(month)
|
| 493 |
hour = self.validate_hour(hour)
|
| 494 |
if self.debug_mode:
|
| 495 |
-
logger.debug(f"calculate_wall_cooling_load: latitude={latitude}, month={month}, hour={hour}, wall_group={wall.wall_group}, orientation={wall.orientation.value}")
|
| 496 |
|
| 497 |
wall_group = str(wall.wall_group).upper()
|
| 498 |
if wall_group not in self.valid_wall_groups:
|
|
@@ -511,11 +515,11 @@ class CoolingLoadCalculator:
|
|
| 511 |
wall_group=wall_group,
|
| 512 |
orientation=wall.orientation.value,
|
| 513 |
hour=hour,
|
| 514 |
-
color='Dark',
|
| 515 |
month=month,
|
| 516 |
latitude=latitude,
|
| 517 |
indoor_temp=indoor_temp,
|
| 518 |
-
outdoor_temp=outdoor_temp
|
|
|
|
| 519 |
)
|
| 520 |
except Exception as e:
|
| 521 |
if self.debug_mode:
|
|
@@ -540,7 +544,8 @@ class CoolingLoadCalculator:
|
|
| 540 |
indoor_temp: float,
|
| 541 |
month: str,
|
| 542 |
hour: int,
|
| 543 |
-
latitude: str
|
|
|
|
| 544 |
) -> float:
|
| 545 |
"""
|
| 546 |
Calculate cooling load for a roof using CLTD method.
|
|
@@ -553,6 +558,7 @@ class CoolingLoadCalculator:
|
|
| 553 |
month: Design month
|
| 554 |
hour: Hour of the day
|
| 555 |
latitude: Latitude (e.g., '24N')
|
|
|
|
| 556 |
|
| 557 |
Returns:
|
| 558 |
Cooling load in Watts
|
|
@@ -562,7 +568,7 @@ class CoolingLoadCalculator:
|
|
| 562 |
month = self.validate_month(month)
|
| 563 |
hour = self.validate_hour(hour)
|
| 564 |
if self.debug_mode:
|
| 565 |
-
logger.debug(f"calculate_roof_cooling_load: latitude={latitude}, month={month}, hour={hour}, roof_group={roof.roof_group}")
|
| 566 |
|
| 567 |
roof_group = str(roof.roof_group).upper()
|
| 568 |
if roof_group not in self.valid_roof_groups:
|
|
@@ -580,11 +586,11 @@ class CoolingLoadCalculator:
|
|
| 580 |
cltd = self.ashrae_tables.calculate_corrected_cltd_roof(
|
| 581 |
roof_group=roof_group,
|
| 582 |
hour=hour,
|
| 583 |
-
color='Dark',
|
| 584 |
month=month,
|
| 585 |
latitude=latitude,
|
| 586 |
indoor_temp=indoor_temp,
|
| 587 |
-
outdoor_temp=outdoor_temp
|
|
|
|
| 588 |
)
|
| 589 |
except Exception as e:
|
| 590 |
if self.debug_mode:
|
|
@@ -995,8 +1001,8 @@ if __name__ == "__main__":
|
|
| 995 |
|
| 996 |
# Example inputs
|
| 997 |
components = {
|
| 998 |
-
'walls': [Wall(id="w1", name="North Wall", area=20.0, u_value=0.5, orientation=Orientation.NORTH, wall_group='A')],
|
| 999 |
-
'roofs': [Roof(id="r1", name="Main Roof", area=100.0, u_value=0.3, orientation=Orientation.HORIZONTAL, roof_group='A')],
|
| 1000 |
'windows': [Window(id="win1", name="South Window", area=10.0, u_value=2.8, orientation=Orientation.SOUTH, shgc=0.7, shading_coefficient=0.8)],
|
| 1001 |
'doors': [Door(id="d1", name="Main Door", area=2.0, u_value=2.0, orientation=Orientation.NORTH)]
|
| 1002 |
}
|
|
|
|
| 253 |
indoor_temp=indoor_conditions['temperature'],
|
| 254 |
month=month,
|
| 255 |
hour=hour,
|
| 256 |
+
latitude=latitude,
|
| 257 |
+
solar_absorptivity=wall.solar_absorptivity
|
| 258 |
)
|
| 259 |
hourly_loads['walls'][hour + 1] += load
|
| 260 |
|
|
|
|
| 267 |
indoor_temp=indoor_conditions['temperature'],
|
| 268 |
month=month,
|
| 269 |
hour=hour,
|
| 270 |
+
latitude=latitude,
|
| 271 |
+
solar_absorptivity=roof.solar_absorptivity
|
| 272 |
)
|
| 273 |
hourly_loads['roofs'][hour + 1] += load
|
| 274 |
|
|
|
|
| 472 |
indoor_temp: float,
|
| 473 |
month: str,
|
| 474 |
hour: int,
|
| 475 |
+
latitude: str,
|
| 476 |
+
solar_absorptivity: float
|
| 477 |
) -> float:
|
| 478 |
"""
|
| 479 |
Calculate cooling load for a wall using CLTD method.
|
|
|
|
| 486 |
month: Design month
|
| 487 |
hour: Hour of the day
|
| 488 |
latitude: Latitude (e.g., '24N')
|
| 489 |
+
solar_absorptivity: Solar absorptivity of the wall surface (0.0 to 1.0)
|
| 490 |
|
| 491 |
Returns:
|
| 492 |
Cooling load in Watts
|
|
|
|
| 496 |
month = self.validate_month(month)
|
| 497 |
hour = self.validate_hour(hour)
|
| 498 |
if self.debug_mode:
|
| 499 |
+
logger.debug(f"calculate_wall_cooling_load: latitude={latitude}, month={month}, hour={hour}, wall_group={wall.wall_group}, orientation={wall.orientation.value}, solar_absorptivity={solar_absorptivity}")
|
| 500 |
|
| 501 |
wall_group = str(wall.wall_group).upper()
|
| 502 |
if wall_group not in self.valid_wall_groups:
|
|
|
|
| 515 |
wall_group=wall_group,
|
| 516 |
orientation=wall.orientation.value,
|
| 517 |
hour=hour,
|
|
|
|
| 518 |
month=month,
|
| 519 |
latitude=latitude,
|
| 520 |
indoor_temp=indoor_temp,
|
| 521 |
+
outdoor_temp=outdoor_temp,
|
| 522 |
+
solar_absorptivity=solar_absorptivity
|
| 523 |
)
|
| 524 |
except Exception as e:
|
| 525 |
if self.debug_mode:
|
|
|
|
| 544 |
indoor_temp: float,
|
| 545 |
month: str,
|
| 546 |
hour: int,
|
| 547 |
+
latitude: str,
|
| 548 |
+
solar_absorptivity: float
|
| 549 |
) -> float:
|
| 550 |
"""
|
| 551 |
Calculate cooling load for a roof using CLTD method.
|
|
|
|
| 558 |
month: Design month
|
| 559 |
hour: Hour of the day
|
| 560 |
latitude: Latitude (e.g., '24N')
|
| 561 |
+
solar_absorptivity: Solar absorptivity of the roof surface (0.0 to 1.0)
|
| 562 |
|
| 563 |
Returns:
|
| 564 |
Cooling load in Watts
|
|
|
|
| 568 |
month = self.validate_month(month)
|
| 569 |
hour = self.validate_hour(hour)
|
| 570 |
if self.debug_mode:
|
| 571 |
+
logger.debug(f"calculate_roof_cooling_load: latitude={latitude}, month={month}, hour={hour}, roof_group={roof.roof_group}, solar_absorptivity={solar_absorptivity}")
|
| 572 |
|
| 573 |
roof_group = str(roof.roof_group).upper()
|
| 574 |
if roof_group not in self.valid_roof_groups:
|
|
|
|
| 586 |
cltd = self.ashrae_tables.calculate_corrected_cltd_roof(
|
| 587 |
roof_group=roof_group,
|
| 588 |
hour=hour,
|
|
|
|
| 589 |
month=month,
|
| 590 |
latitude=latitude,
|
| 591 |
indoor_temp=indoor_temp,
|
| 592 |
+
outdoor_temp=outdoor_temp,
|
| 593 |
+
solar_absorptivity=solar_absorptivity
|
| 594 |
)
|
| 595 |
except Exception as e:
|
| 596 |
if self.debug_mode:
|
|
|
|
| 1001 |
|
| 1002 |
# Example inputs
|
| 1003 |
components = {
|
| 1004 |
+
'walls': [Wall(id="w1", name="North Wall", area=20.0, u_value=0.5, orientation=Orientation.NORTH, wall_group='A', solar_absorptivity=0.6)],
|
| 1005 |
+
'roofs': [Roof(id="r1", name="Main Roof", area=100.0, u_value=0.3, orientation=Orientation.HORIZONTAL, roof_group='A', solar_absorptivity=0.6)],
|
| 1006 |
'windows': [Window(id="win1", name="South Window", area=10.0, u_value=2.8, orientation=Orientation.SOUTH, shgc=0.7, shading_coefficient=0.8)],
|
| 1007 |
'doors': [Door(id="d1", name="Main Door", area=2.0, u_value=2.0, orientation=Orientation.NORTH)]
|
| 1008 |
}
|