Spaces:
Sleeping
Sleeping
Update utils/cooling_load.py
Browse files- utils/cooling_load.py +19 -4
utils/cooling_load.py
CHANGED
|
@@ -15,6 +15,7 @@ from data.ashrae_tables import ASHRAETables
|
|
| 15 |
from utils.heat_transfer import HeatTransferCalculations
|
| 16 |
from utils.psychrometrics import Psychrometrics
|
| 17 |
from app.component_selection import Wall, Roof, Window, Door, Orientation
|
|
|
|
| 18 |
|
| 19 |
# Set up logging
|
| 20 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -496,7 +497,7 @@ class CoolingLoadCalculator:
|
|
| 496 |
month = self.validate_month(month)
|
| 497 |
hour = self.validate_hour(hour)
|
| 498 |
wall_group = str(wall.wall_group).upper() if hasattr(wall, 'wall_group') else 'A'
|
| 499 |
-
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'H'}
|
| 500 |
|
| 501 |
if wall_group in numeric_map:
|
| 502 |
wall_group = numeric_map[wall_group]
|
|
@@ -646,7 +647,7 @@ class CoolingLoadCalculator:
|
|
| 646 |
month: Design month
|
| 647 |
hour: Hour of the day
|
| 648 |
latitude: Latitude (e.g., '24N')
|
| 649 |
-
shading_coefficient:
|
| 650 |
|
| 651 |
Returns:
|
| 652 |
Dictionary with conduction, solar, and total loads in Watts
|
|
@@ -662,6 +663,20 @@ class CoolingLoadCalculator:
|
|
| 662 |
cltd = outdoor_temp - indoor_temp
|
| 663 |
conduction_load = window.u_value * window.area * cltd
|
| 664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 665 |
# Solar load
|
| 666 |
try:
|
| 667 |
scl = self.ashrae_tables.get_scl(
|
|
@@ -676,11 +691,11 @@ class CoolingLoadCalculator:
|
|
| 676 |
logger.warning("Using default SCL=100 W/m²")
|
| 677 |
scl = 100.0
|
| 678 |
|
| 679 |
-
solar_load = window.area * window.shgc *
|
| 680 |
|
| 681 |
total_load = conduction_load + solar_load
|
| 682 |
if self.debug_mode:
|
| 683 |
-
logger.debug(f"Window load: conduction={conduction_load}, solar={solar_load}, total={total_load}")
|
| 684 |
|
| 685 |
return {
|
| 686 |
'conduction': max(conduction_load, 0.0),
|
|
|
|
| 15 |
from utils.heat_transfer import HeatTransferCalculations
|
| 16 |
from utils.psychrometrics import Psychrometrics
|
| 17 |
from app.component_selection import Wall, Roof, Window, Door, Orientation
|
| 18 |
+
from drapery import Drapery
|
| 19 |
|
| 20 |
# Set up logging
|
| 21 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 497 |
month = self.validate_month(month)
|
| 498 |
hour = self.validate_hour(hour)
|
| 499 |
wall_group = str(wall.wall_group).upper() if hasattr(wall, 'wall_group') else 'A'
|
| 500 |
+
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': Jeanette 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'H'}
|
| 501 |
|
| 502 |
if wall_group in numeric_map:
|
| 503 |
wall_group = numeric_map[wall_group]
|
|
|
|
| 647 |
month: Design month
|
| 648 |
hour: Hour of the day
|
| 649 |
latitude: Latitude (e.g., '24N')
|
| 650 |
+
shading_coefficient: Default shading coefficient
|
| 651 |
|
| 652 |
Returns:
|
| 653 |
Dictionary with conduction, solar, and total loads in Watts
|
|
|
|
| 663 |
cltd = outdoor_temp - indoor_temp
|
| 664 |
conduction_load = window.u_value * window.area * cltd
|
| 665 |
|
| 666 |
+
# Determine shading coefficient
|
| 667 |
+
effective_shading_coefficient = shading_coefficient
|
| 668 |
+
if hasattr(window, 'drapery') and window.drapery and window.drapery.enabled:
|
| 669 |
+
try:
|
| 670 |
+
effective_shading_coefficient = window.drapery.get_shading_coefficient(window.shgc)
|
| 671 |
+
if self.debug_mode:
|
| 672 |
+
logger.debug(f"Using drapery shading coefficient: {effective_shading_coefficient}")
|
| 673 |
+
except Exception as e:
|
| 674 |
+
if self.debug_mode:
|
| 675 |
+
logger.warning(f"Error getting drapery shading coefficient: {str(e)}. Using default shading_coefficient={shading_coefficient}")
|
| 676 |
+
else:
|
| 677 |
+
if self.debug_mode:
|
| 678 |
+
logger.debug(f"No enabled drapery. Using default shading_coefficient={shading_coefficient}")
|
| 679 |
+
|
| 680 |
# Solar load
|
| 681 |
try:
|
| 682 |
scl = self.ashrae_tables.get_scl(
|
|
|
|
| 691 |
logger.warning("Using default SCL=100 W/m²")
|
| 692 |
scl = 100.0
|
| 693 |
|
| 694 |
+
solar_load = window.area * window.shgc * effective_shading_coefficient * scl
|
| 695 |
|
| 696 |
total_load = conduction_load + solar_load
|
| 697 |
if self.debug_mode:
|
| 698 |
+
logger.debug(f"Window load: conduction={conduction_load}, solar={solar_load}, total={total_load}, effective_shading_coefficient={effective_shading_coefficient}")
|
| 699 |
|
| 700 |
return {
|
| 701 |
'conduction': max(conduction_load, 0.0),
|