mabuseif commited on
Commit
79a702a
·
verified ·
1 Parent(s): 66402ef

Update data/ashrae_tables.py

Browse files
Files changed (1) hide show
  1. data/ashrae_tables.py +14 -2
data/ashrae_tables.py CHANGED
@@ -1167,16 +1167,28 @@ class ASHRAETables:
1167
  weight = (latitude - lat1) / (lat2 - lat1)
1168
  return scl1 + weight * (scl2 - scl1)
1169
 
1170
- def apply_cltd_corrections(self, cltd: float, lm: float, k: float, f: float) -> float:
1171
  """
1172
  Apply corrections to CLTD based on ASHRAE correction factors.
1173
  Args:
1174
  cltd: Base CLTD value.
1175
  lm: Latitude-month correction factor.
1176
- k: Color correction factor.
1177
  f: Fenestration correction factor.
1178
  Returns: Corrected CLTD value.
1179
  """
 
 
 
 
 
 
 
 
 
 
 
 
1180
  return cltd + lm + (k - 1) * cltd + (f - 1) * cltd
1181
 
1182
  def visualize_cltd(self, element_type: str, group: str, orientation: str, latitude: float):
 
1167
  weight = (latitude - lat1) / (lat2 - lat1)
1168
  return scl1 + weight * (scl2 - scl1)
1169
 
1170
+ def apply_cltd_corrections(self, cltd: float, lm: float, solar_absorptivity: float, f: float) -> float:
1171
  """
1172
  Apply corrections to CLTD based on ASHRAE correction factors.
1173
  Args:
1174
  cltd: Base CLTD value.
1175
  lm: Latitude-month correction factor.
1176
+ solar_absorptivity: Solar absorptivity of the surface (0.0 to 1.0).
1177
  f: Fenestration correction factor.
1178
  Returns: Corrected CLTD value.
1179
  """
1180
+ correction_factors = self._load_color_correction()
1181
+ absorptivities = sorted(correction_factors.keys())
1182
+ if solar_absorptivity in correction_factors:
1183
+ k = correction_factors[solar_absorptivity]
1184
+ else:
1185
+ low_a = max([a for a in absorptivities if a <= solar_absorptivity], default=absorptivities[0])
1186
+ high_a = min([a for a in absorptivities if a >= solar_absorptivity], default=absorptivities[-1])
1187
+ if low_a == high_a:
1188
+ k = correction_factors[low_a]
1189
+ else:
1190
+ weight = (solar_absorptivity - low_a) / (high_a - low_a)
1191
+ k = correction_factors[low_a] + weight * (correction_factors[high_a] - correction_factors[low_a])
1192
  return cltd + lm + (k - 1) * cltd + (f - 1) * cltd
1193
 
1194
  def visualize_cltd(self, element_type: str, group: str, orientation: str, latitude: float):