Spaces:
Sleeping
Sleeping
Update utils/cooling_load.py
Browse files- utils/cooling_load.py +17 -7
utils/cooling_load.py
CHANGED
|
@@ -37,7 +37,7 @@ class CoolingLoadCalculator:
|
|
| 37 |
self.hours = list(range(24))
|
| 38 |
self.valid_latitudes = ['24N', '32N', '40N', '48N', '56N']
|
| 39 |
self.valid_months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
|
| 40 |
-
self.valid_wall_groups = ['A', 'B', 'C', 'D']
|
| 41 |
self.valid_roof_groups = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
|
| 42 |
self.debug_mode = debug_mode
|
| 43 |
if debug_mode:
|
|
@@ -500,7 +500,7 @@ class CoolingLoadCalculator:
|
|
| 500 |
|
| 501 |
wall_group = str(wall.wall_group).upper()
|
| 502 |
if wall_group not in self.valid_wall_groups:
|
| 503 |
-
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D'}
|
| 504 |
if wall_group in numeric_map:
|
| 505 |
wall_group = numeric_map[wall_group]
|
| 506 |
if self.debug_mode:
|
|
@@ -511,8 +511,13 @@ class CoolingLoadCalculator:
|
|
| 511 |
wall_group = 'A'
|
| 512 |
|
| 513 |
try:
|
| 514 |
-
# Convert latitude string (e.g., '40N') to float (e.g., 40.0)
|
| 515 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 516 |
# Get CLTD in °F and convert to °C
|
| 517 |
cltd_f = self.ashrae_tables.get_cltd(
|
| 518 |
element_type='wall',
|
|
@@ -576,7 +581,7 @@ class CoolingLoadCalculator:
|
|
| 576 |
if roof_group not in self.valid_roof_groups:
|
| 577 |
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'G'}
|
| 578 |
if roof_group in numeric_map:
|
| 579 |
-
roof_group = numeric_map[
|
| 580 |
if self.debug_mode:
|
| 581 |
logger.info(f"Mapped roof_group {roof.roof_group} to {roof_group}")
|
| 582 |
else:
|
|
@@ -585,8 +590,13 @@ class CoolingLoadCalculator:
|
|
| 585 |
roof_group = 'A'
|
| 586 |
|
| 587 |
try:
|
| 588 |
-
# Convert latitude string (e.g., '40N') to float (e.g., 40.0)
|
| 589 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
# Get CLTD in °F and convert to °C
|
| 591 |
cltd_f = self.ashrae_tables.get_cltd(
|
| 592 |
element_type='roof',
|
|
|
|
| 37 |
self.hours = list(range(24))
|
| 38 |
self.valid_latitudes = ['24N', '32N', '40N', '48N', '56N']
|
| 39 |
self.valid_months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
|
| 40 |
+
self.valid_wall_groups = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
|
| 41 |
self.valid_roof_groups = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
|
| 42 |
self.debug_mode = debug_mode
|
| 43 |
if debug_mode:
|
|
|
|
| 500 |
|
| 501 |
wall_group = str(wall.wall_group).upper()
|
| 502 |
if wall_group not in self.valid_wall_groups:
|
| 503 |
+
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'H'}
|
| 504 |
if wall_group in numeric_map:
|
| 505 |
wall_group = numeric_map[wall_group]
|
| 506 |
if self.debug_mode:
|
|
|
|
| 511 |
wall_group = 'A'
|
| 512 |
|
| 513 |
try:
|
| 514 |
+
# Convert latitude string (e.g., '40N') to float (e.g., 40.0) for get_cltd
|
| 515 |
+
try:
|
| 516 |
+
lat_value = float(latitude.replace('N', ''))
|
| 517 |
+
except ValueError:
|
| 518 |
+
if self.debug_mode:
|
| 519 |
+
logger.error(f"Invalid latitude format: {latitude}. Defaulting to 32.0")
|
| 520 |
+
lat_value = 32.0
|
| 521 |
# Get CLTD in °F and convert to °C
|
| 522 |
cltd_f = self.ashrae_tables.get_cltd(
|
| 523 |
element_type='wall',
|
|
|
|
| 581 |
if roof_group not in self.valid_roof_groups:
|
| 582 |
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'G'}
|
| 583 |
if roof_group in numeric_map:
|
| 584 |
+
roof_group = numeric_map[wall_group]
|
| 585 |
if self.debug_mode:
|
| 586 |
logger.info(f"Mapped roof_group {roof.roof_group} to {roof_group}")
|
| 587 |
else:
|
|
|
|
| 590 |
roof_group = 'A'
|
| 591 |
|
| 592 |
try:
|
| 593 |
+
# Convert latitude string (e.g., '40N') to float (e.g., 40.0) for get_cltd
|
| 594 |
+
try:
|
| 595 |
+
lat_value = float(latitude.replace('N', ''))
|
| 596 |
+
except ValueError:
|
| 597 |
+
if self.debug_mode:
|
| 598 |
+
logger.error(f"Invalid latitude format: {latitude}. Defaulting to 32.0")
|
| 599 |
+
lat_value = 32.0
|
| 600 |
# Get CLTD in °F and convert to °C
|
| 601 |
cltd_f = self.ashrae_tables.get_cltd(
|
| 602 |
element_type='roof',
|