Spaces:
Sleeping
Sleeping
Update utils/cooling_load.py
Browse files- utils/cooling_load.py +25 -9
utils/cooling_load.py
CHANGED
|
@@ -436,8 +436,6 @@ class CoolingLoadCalculator:
|
|
| 436 |
conduction_load = window.u_value * window.area * delta_t
|
| 437 |
|
| 438 |
# Solar load
|
| 439 |
-
# Note: Solar altitude is not computed directly, as ASHRAE SCL tables (via get_scl)
|
| 440 |
-
# account for solar geometry effects based on month, orientation, hour, and latitude.
|
| 441 |
logger.debug(f"Calling get_scl with month={month_upper}, orientation={window.orientation.value}, hour={hour}, latitude={scl_latitude}")
|
| 442 |
|
| 443 |
# Try different month formats to handle potential get_scl issues
|
|
@@ -453,10 +451,10 @@ class CoolingLoadCalculator:
|
|
| 453 |
try:
|
| 454 |
logger.debug(f"Trying get_scl with month format '{format_name}': month={month_value}")
|
| 455 |
scl = self.ashrae_tables.get_scl(
|
|
|
|
| 456 |
month=month_value,
|
| 457 |
orientation=window.orientation.value,
|
| 458 |
-
hour=hour
|
| 459 |
-
latitude=scl_latitude
|
| 460 |
)
|
| 461 |
logger.debug(f"Success with month format '{format_name}'")
|
| 462 |
break
|
|
@@ -468,10 +466,10 @@ class CoolingLoadCalculator:
|
|
| 468 |
if scl is None:
|
| 469 |
logger.warning(f"All month formats failed. Retrying with fallback latitude='24N', month='JUL'")
|
| 470 |
scl = self.ashrae_tables.get_scl(
|
|
|
|
| 471 |
month='JUL',
|
| 472 |
orientation=window.orientation.value,
|
| 473 |
-
hour=hour
|
| 474 |
-
latitude='24N'
|
| 475 |
)
|
| 476 |
|
| 477 |
solar_load = window.area * window.shgc * scl * shading_coefficient
|
|
@@ -542,7 +540,13 @@ class CoolingLoadCalculator:
|
|
| 542 |
'Heavy Work': 180
|
| 543 |
}.get(activity_level, 45)
|
| 544 |
|
| 545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
|
| 547 |
sensible_load = num_people * sensible_gain * clf
|
| 548 |
latent_load = num_people * latent_gain
|
|
@@ -576,7 +580,13 @@ class CoolingLoadCalculator:
|
|
| 576 |
Cooling load in Watts
|
| 577 |
"""
|
| 578 |
try:
|
| 579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
load = power * use_factor * special_allowance * clf
|
| 581 |
return max(load, 0.0)
|
| 582 |
|
|
@@ -603,7 +613,13 @@ class CoolingLoadCalculator:
|
|
| 603 |
Dictionary with sensible and latent loads in Watts
|
| 604 |
"""
|
| 605 |
try:
|
| 606 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
sensible_load = power * use_factor * radiation_factor * clf
|
| 608 |
latent_load = power * use_factor * (1 - radiation_factor)
|
| 609 |
|
|
|
|
| 436 |
conduction_load = window.u_value * window.area * delta_t
|
| 437 |
|
| 438 |
# Solar load
|
|
|
|
|
|
|
| 439 |
logger.debug(f"Calling get_scl with month={month_upper}, orientation={window.orientation.value}, hour={hour}, latitude={scl_latitude}")
|
| 440 |
|
| 441 |
# Try different month formats to handle potential get_scl issues
|
|
|
|
| 451 |
try:
|
| 452 |
logger.debug(f"Trying get_scl with month format '{format_name}': month={month_value}")
|
| 453 |
scl = self.ashrae_tables.get_scl(
|
| 454 |
+
latitude=scl_latitude,
|
| 455 |
month=month_value,
|
| 456 |
orientation=window.orientation.value,
|
| 457 |
+
hour=hour
|
|
|
|
| 458 |
)
|
| 459 |
logger.debug(f"Success with month format '{format_name}'")
|
| 460 |
break
|
|
|
|
| 466 |
if scl is None:
|
| 467 |
logger.warning(f"All month formats failed. Retrying with fallback latitude='24N', month='JUL'")
|
| 468 |
scl = self.ashrae_tables.get_scl(
|
| 469 |
+
latitude='24N',
|
| 470 |
month='JUL',
|
| 471 |
orientation=window.orientation.value,
|
| 472 |
+
hour=hour
|
|
|
|
| 473 |
)
|
| 474 |
|
| 475 |
solar_load = window.area * window.shgc * scl * shading_coefficient
|
|
|
|
| 540 |
'Heavy Work': 180
|
| 541 |
}.get(activity_level, 45)
|
| 542 |
|
| 543 |
+
logger.debug(f"Calling get_clf_people with zone_type='A', hours_occupied='6h', hour={hour}")
|
| 544 |
+
try:
|
| 545 |
+
clf = self.ashrae_tables.get_clf_people('A', '6h', hour)
|
| 546 |
+
except Exception as e:
|
| 547 |
+
logger.error(f"get_clf_people('A', '6h', {hour}) failed: {str(e)}")
|
| 548 |
+
logger.warning("Using default CLF=1.0 for people")
|
| 549 |
+
clf = 1.0
|
| 550 |
|
| 551 |
sensible_load = num_people * sensible_gain * clf
|
| 552 |
latent_load = num_people * latent_gain
|
|
|
|
| 580 |
Cooling load in Watts
|
| 581 |
"""
|
| 582 |
try:
|
| 583 |
+
logger.debug(f"Calling get_clf_lights with zone_type='A', hours_on='8h', hour={hour}")
|
| 584 |
+
try:
|
| 585 |
+
clf = self.ashrae_tables.get_clf_lights('A', '8h', hour)
|
| 586 |
+
except Exception as e:
|
| 587 |
+
logger.error(f"get_clf_lights('A', '8h', {hour}) failed: {str(e)}")
|
| 588 |
+
logger.warning("Using default CLF=1.0 for lights")
|
| 589 |
+
clf = 1.0
|
| 590 |
load = power * use_factor * special_allowance * clf
|
| 591 |
return max(load, 0.0)
|
| 592 |
|
|
|
|
| 613 |
Dictionary with sensible and latent loads in Watts
|
| 614 |
"""
|
| 615 |
try:
|
| 616 |
+
logger.debug(f"Calling get_clf_equipment with zone_type='A', hours_operated='6h', hour={hour}")
|
| 617 |
+
try:
|
| 618 |
+
clf = self.ashrae_tables.get_clf_equipment('A', '6h', hour)
|
| 619 |
+
except Exception as e:
|
| 620 |
+
logger.error(f"get_clf_equipment('A', '6h', {hour}) failed: {str(e)}")
|
| 621 |
+
logger.warning("Using default CLF=1.0 for equipment")
|
| 622 |
+
clf = 1.0
|
| 623 |
sensible_load = power * use_factor * radiation_factor * clf
|
| 624 |
latent_load = power * use_factor * (1 - radiation_factor)
|
| 625 |
|