fixed the tcold bug in weather importer

This commit is contained in:
Pilar Monsalvete 2023-03-22 15:13:44 -04:00
parent 81a59d4246
commit 559e56dd71

View File

@ -131,4 +131,26 @@ class EpwWeatherParameters:
if cte.YEAR not in building.cold_water_temperature:
building.cold_water_temperature[cte.YEAR] = wh().get_yearly_mean_values(
building.cold_water_temperature[cte.HOUR][['epw']])
# If the usage has already being imported, the domestic hot water missing values must be calculated here that
# the cold water temperature is finally known
cold_temperature = building.cold_water_temperature[cte.YEAR]['epw']
for internal_zone in building.internal_zones:
if internal_zone.usages is not None:
for usage in internal_zone.usages:
if usage.domestic_hot_water.peak_flow is None:
if usage.domestic_hot_water.density is None:
continue
peak_flow = 0
if (usage.domestic_hot_water.service_temperature - cold_temperature) > 0:
peak_flow = usage.domestic_hot_water.density / cte.WATER_DENSITY / cte.WATER_HEAT_CAPACITY \
/ (usage.domestic_hot_water.service_temperature - cold_temperature)
usage.domestic_hot_water.peak_flow = peak_flow
if usage.domestic_hot_water.density is None:
if usage.domestic_hot_water.peak_flow is None:
continue
density = usage.domestic_hot_water.peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY \
* (usage.domestic_hot_water.service_temperature - cold_temperature)
usage.domestic_hot_water.density = density
self._city.level_of_detail.weather = 2