diff --git a/monthly_energy_balance.py b/monthly_energy_balance.py index 52c1bd2..622a8f9 100644 --- a/monthly_energy_balance.py +++ b/monthly_energy_balance.py @@ -87,8 +87,10 @@ class MonthlyEnergyBalance: print_results = heating_results else: print_results = pd.concat([print_results, heating_results], axis='columns') - print_results = pd.concat([print_results, cooling_results, building.lighting_electrical_demand, - building.appliances_electrical_demand], axis='columns') + print_results = pd.concat([print_results, cooling_results, + building.lighting_electrical_demand, + building.appliances_electrical_demand, + building.domestic_hot_water_heat_demand], axis='columns') file += '\n' file += 'name: ' + building.name + '\n' file += 'year of construction: ' + str(building.year_of_construction) + '\n' @@ -106,7 +108,31 @@ class MonthlyEnergyBalance: def _dhw_demand(self): for building in self._city.buildings: - domestic_hot_water_demand = 0 + domestic_hot_water_demand = [] + if building.internal_zones[0].thermal_zones is None: + domestic_hot_water_demand = [0] * 12 + else: + thermal_zone = building.internal_zones[0].thermal_zones[0] + area = thermal_zone.total_floor_area + cold_water = building.cold_water_temperature[cte.MONTH]['epw'] + for month in range(0, 12): + total_dhw_demand = 0 + for schedule in thermal_zone.domestic_hot_water.schedules: + total_day = 0 + for value in schedule.values: + total_day += value + for day_type in schedule.day_types: + print('day_type', month, day_type) + print(_DAYS_A_MONTH[day_type][month]) + demand = thermal_zone.domestic_hot_water.peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY \ + * (thermal_zone.domestic_hot_water.service_temperature - cold_water[month]) + total_dhw_demand += total_day * _DAYS_A_MONTH[day_type][month] * demand + print('demand', total_day, demand, cold_water[month]) + print(area) + domestic_hot_water_demand.append(total_dhw_demand * area) + + building.domestic_hot_water_heat_demand = \ + pd.DataFrame(domestic_hot_water_demand, columns=[f'{building.name} domestic hot water demand Wh']) def _electrical_demand(self): for building in self._city.buildings: