From 6c4559b3d6c671cc2d99d15a139d0795006633eb Mon Sep 17 00:00:00 2001 From: jgavalda Date: Tue, 11 Jul 2023 14:45:23 -0400 Subject: [PATCH] Graphs prepared and ready for course and workshop --- results.py | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/results.py b/results.py index 793016b..dff7a52 100644 --- a/results.py +++ b/results.py @@ -151,7 +151,7 @@ class Results: with open(full_path_metadata, 'w') as metadata_file: metadata_file.write(file) - def outputsforgraph(self): + def outputsforgraph(self): file = 'city name: ' + self._city.name + '\n' array = [None] * 12 for building in self._city.buildings: @@ -262,36 +262,16 @@ class Results: columns=[ f'{building.name} electrical consumption for distribution Wh']) - if print_results is None: - print_results = heating_results - else: - print_results = pd.concat([print_results, heating_results], axis='columns') - print_results = pd.concat([print_results, - cooling_results, - lighting_results, - appliances_results, - dhw_results, - heating_consumption_results, - cooling_consumption_results, - dhw_consumption_results, - heating_peak_load_results, - cooling_peak_load_results, - electricity_peak_load_results, - onsite_electrical_production, - extra_electrical_consumption], axis='columns') - file += '\n' - file += f'name: {building.name}\n' - file += f'year of construction: {building.year_of_construction}\n' - file += f'function: {building.function}\n' - file += f'floor area: {building.floor_area}\n' - if building.average_storey_height is not None and building.eave_height is not None: - file += f'storeys: {int(building.eave_height / building.average_storey_height)}\n' - else: - file += f'storeys: n/a\n' - file += f'volume: {building.volume}\n' + listgraph = [lighting_results.values.sum(),appliances_results.values.sum(), + heating_consumption_results.values.sum(), + cooling_consumption_results.values.sum(), + dhw_consumption_results.values.sum(), + extra_electrical_consumption.values.sum() + ] + total_final_energy = (lighting_results.values.sum() + appliances_results.values.sum() + \ + heating_consumption_results.values.sum() + cooling_consumption_results.values.sum() + \ + dhw_consumption_results.values.sum() + extra_electrical_consumption.values.sum())/1000 + + return listgraph, total_final_energy + - full_path_results = Path(self._path / 'demand.csv').resolve() - print_results.to_csv(full_path_results, na_rep='null') - full_path_metadata = Path(self._path / 'metadata.csv').resolve() - with open(full_path_metadata, 'w') as metadata_file: - metadata_file.write(file)