changed reading results to adapt to new results format

This commit is contained in:
Pilar Monsalvete 2023-03-23 13:49:41 -04:00
parent 813449799e
commit effdad4437
2 changed files with 14 additions and 7 deletions

View File

@ -14,8 +14,8 @@ class MonthlyEnergyBalanceEngine:
self._city = city self._city = city
self._file_path = file_path self._file_path = file_path
EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, self._file_path).export() EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, self._file_path).export()
ResultFactory('insel_meb', self._city, self._file_path).enrich()
self._run() self._run()
ResultFactory('insel_meb', self._city, self._file_path).enrich()
def _run(self): def _run(self):
""" """

View File

@ -12,16 +12,23 @@ class Results:
print_results = None print_results = None
file = 'city name: ' + self._city.name + '\n' file = 'city name: ' + self._city.name + '\n'
for building in self._city.buildings: for building in self._city.buildings:
heating_results = building.heating[cte.MONTH].rename(columns={'INSEL': f'{building.name} heating Wh'}) heating_results = building.heating[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
cooling_results = building.cooling[cte.MONTH].rename(columns={'INSEL': f'{building.name} cooling Wh'}) cooling_results = building.cooling[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
lighting_results = building.lighting_electrical_demand[cte.MONTH]\
.rename(columns={cte.INSEL_MEB: f'{building.name} lighting electrical demand Wh'})
appliances_results = building.appliances_electrical_demand[cte.MONTH]\
.rename(columns={cte.INSEL_MEB: f'{building.name} appliances electrical demand Wh'})
dhw_results = building.domestic_hot_water_heat_demand[cte.MONTH]\
.rename(columns={cte.INSEL_MEB: f'{building.name} domestic hot water demand Wh'})
if print_results is None: if print_results is None:
print_results = heating_results print_results = heating_results
else: else:
print_results = pd.concat([print_results, heating_results], axis='columns') print_results = pd.concat([print_results, heating_results], axis='columns')
print_results = pd.concat([print_results, cooling_results, print_results = pd.concat([print_results,
building.lighting_electrical_demand, cooling_results,
building.appliances_electrical_demand, lighting_results,
building.domestic_hot_water_heat_demand], axis='columns') appliances_results,
dhw_results], axis='columns')
file += '\n' file += '\n'
file += 'name: ' + building.name + '\n' file += 'name: ' + building.name + '\n'
file += 'year of construction: ' + str(building.year_of_construction) + '\n' file += 'year of construction: ' + str(building.year_of_construction) + '\n'