diff --git a/hub/imports/weather/epw_weather_parameters.py b/hub/imports/weather/epw_weather_parameters.py index 89315ab0..2c7de4e2 100644 --- a/hub/imports/weather/epw_weather_parameters.py +++ b/hub/imports/weather/epw_weather_parameters.py @@ -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