Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- app/component_selection.py +6 -6
- app/main.py +1 -1
- data/building_components.py +2 -2
- utils/cooling_load.py +10 -3
app/component_selection.py
CHANGED
|
@@ -96,7 +96,7 @@ class Wall(BuildingComponent):
|
|
| 96 |
@dataclass
|
| 97 |
class Roof(BuildingComponent):
|
| 98 |
roof_type: str = "Concrete"
|
| 99 |
-
roof_group: str = "
|
| 100 |
slope: str = "Flat"
|
| 101 |
absorptivity: float = 0.6
|
| 102 |
|
|
@@ -108,10 +108,10 @@ class Roof(BuildingComponent):
|
|
| 108 |
if not 0 <= self.absorptivity <= 1:
|
| 109 |
raise ValueError("Absorptivity must be between 0 and 1")
|
| 110 |
# Validate roof_group
|
| 111 |
-
VALID_ROOF_GROUPS = {"
|
| 112 |
if self.roof_group not in VALID_ROOF_GROUPS:
|
| 113 |
-
st.warning(f"Invalid roof_group '{self.roof_group}' for roof '{self.name}'. Defaulting to '
|
| 114 |
-
self.roof_group = "
|
| 115 |
|
| 116 |
def to_dict(self) -> dict:
|
| 117 |
base_dict = super().to_dict()
|
|
@@ -207,8 +207,8 @@ class ReferenceData:
|
|
| 207 |
"Custom": {"u_value": 0.5, "absorptivity": 0.6, "wall_group": "A"}
|
| 208 |
},
|
| 209 |
"roof_types": {
|
| 210 |
-
"Concrete Roof": {"u_value": 0.3, "absorptivity": 0.6, "group": "
|
| 211 |
-
"Metal Roof": {"u_value": 1.0, "absorptivity": 0.75, "group": "
|
| 212 |
},
|
| 213 |
"roof_ventilation_methods": {
|
| 214 |
"No Ventilation": 0.0,
|
|
|
|
| 96 |
@dataclass
|
| 97 |
class Roof(BuildingComponent):
|
| 98 |
roof_type: str = "Concrete"
|
| 99 |
+
roof_group: str = "A" # Changed to letter-based ASHRAE group
|
| 100 |
slope: str = "Flat"
|
| 101 |
absorptivity: float = 0.6
|
| 102 |
|
|
|
|
| 108 |
if not 0 <= self.absorptivity <= 1:
|
| 109 |
raise ValueError("Absorptivity must be between 0 and 1")
|
| 110 |
# Validate roof_group
|
| 111 |
+
VALID_ROOF_GROUPS = {"A", "B", "C", "D", "E", "F", "G"}
|
| 112 |
if self.roof_group not in VALID_ROOF_GROUPS:
|
| 113 |
+
st.warning(f"Invalid roof_group '{self.roof_group}' for roof '{self.name}'. Defaulting to 'A'.")
|
| 114 |
+
self.roof_group = "A"
|
| 115 |
|
| 116 |
def to_dict(self) -> dict:
|
| 117 |
base_dict = super().to_dict()
|
|
|
|
| 207 |
"Custom": {"u_value": 0.5, "absorptivity": 0.6, "wall_group": "A"}
|
| 208 |
},
|
| 209 |
"roof_types": {
|
| 210 |
+
"Concrete Roof": {"u_value": 0.3, "absorptivity": 0.6, "group": "A"},
|
| 211 |
+
"Metal Roof": {"u_value": 1.0, "absorptivity": 0.75, "group": "B"}
|
| 212 |
},
|
| 213 |
"roof_ventilation_methods": {
|
| 214 |
"No Ventilation": 0.0,
|
app/main.py
CHANGED
|
@@ -452,7 +452,7 @@ class HVACCalculator:
|
|
| 452 |
'relative_humidity': location['monthly_humidity'].get('Jul', 50.0),
|
| 453 |
'ground_temperature': location['monthly_temps'].get('Jul', 20.0),
|
| 454 |
'month': 'Jul',
|
| 455 |
-
'latitude':
|
| 456 |
'wind_speed': building_info.get('wind_speed', 4.0),
|
| 457 |
'day_of_year': 204 # Approx. July 23
|
| 458 |
}
|
|
|
|
| 452 |
'relative_humidity': location['monthly_humidity'].get('Jul', 50.0),
|
| 453 |
'ground_temperature': location['monthly_temps'].get('Jul', 20.0),
|
| 454 |
'month': 'Jul',
|
| 455 |
+
'latitude': location['latitude'], # Pass raw latitude value, validation will happen in cooling_load.py
|
| 456 |
'wind_speed': building_info.get('wind_speed', 4.0),
|
| 457 |
'day_of_year': 204 # Approx. July 23
|
| 458 |
}
|
data/building_components.py
CHANGED
|
@@ -226,10 +226,10 @@ class Wall(BuildingComponent):
|
|
| 226 |
class Roof(BuildingComponent):
|
| 227 |
"""Class representing a roof component."""
|
| 228 |
|
| 229 |
-
VALID_ROOF_GROUPS = {"
|
| 230 |
|
| 231 |
roof_type: str = "Custom" # Flat, Pitched, etc.
|
| 232 |
-
roof_group: str = "
|
| 233 |
pitch: float = 0.0 # Roof pitch in degrees
|
| 234 |
has_suspended_ceiling: bool = False
|
| 235 |
ceiling_plenum_height: float = 0.0 # m
|
|
|
|
| 226 |
class Roof(BuildingComponent):
|
| 227 |
"""Class representing a roof component."""
|
| 228 |
|
| 229 |
+
VALID_ROOF_GROUPS = {"A", "B", "C", "D", "E", "F", "G"} # ASHRAE roof groups for CLTD
|
| 230 |
|
| 231 |
roof_type: str = "Custom" # Flat, Pitched, etc.
|
| 232 |
+
roof_group: str = "A" # ASHRAE roof group
|
| 233 |
pitch: float = 0.0 # Roof pitch in degrees
|
| 234 |
has_suspended_ceiling: bool = False
|
| 235 |
ceiling_plenum_height: float = 0.0 # m
|
utils/cooling_load.py
CHANGED
|
@@ -508,9 +508,16 @@ class CoolingLoadCalculator:
|
|
| 508 |
|
| 509 |
roof_group = str(roof.roof_group).upper()
|
| 510 |
if roof_group not in self.valid_roof_groups:
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
roof_group
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
|
| 515 |
try:
|
| 516 |
cltd = self.ashrae_tables.calculate_corrected_cltd_roof(
|
|
|
|
| 508 |
|
| 509 |
roof_group = str(roof.roof_group).upper()
|
| 510 |
if roof_group not in self.valid_roof_groups:
|
| 511 |
+
# Map numeric roof groups to letter groups
|
| 512 |
+
numeric_map = {'1': 'A', '2': 'B', '3': 'C', '4': 'D', '5': 'E', '6': 'F', '7': 'G', '8': 'G'}
|
| 513 |
+
if roof_group in numeric_map:
|
| 514 |
+
roof_group = numeric_map[roof_group]
|
| 515 |
+
if st.session_state.get('debug_mode', False):
|
| 516 |
+
logger.info(f"Mapped roof_group {roof.roof_group} to {roof_group}")
|
| 517 |
+
else:
|
| 518 |
+
if st.session_state.get('debug_mode', False):
|
| 519 |
+
logger.warning(f"Invalid roof group: {roof_group}. Defaulting to 'A'")
|
| 520 |
+
roof_group = 'A'
|
| 521 |
|
| 522 |
try:
|
| 523 |
cltd = self.ashrae_tables.calculate_corrected_cltd_roof(
|