changed print results format

This commit is contained in:
Pilar Monsalvete 2023-03-24 14:59:27 -04:00
parent d3aef403b1
commit dbda4bae47

View File

@ -94,25 +94,32 @@ class PeakLoads:
self._results[building.name] = {'monthly heating peak load': monthly_heating_loads,
'monthly cooling peak load': monthly_cooling_loads}
print(self._results)
self._print_results()
def _print_results(self):
print_results = 'Peak loads in W'
for results in self._results:
print_results = f'Building name, monthly heating peak load W,,,,,,,,,,,, monthly cooling peak load W,,,,,,,,,,,'
for building in self._city.buildings:
results = self._results[building.name]
print_results += '\n'
print_results += f'{results[0]}, {results[1]}, {results[2]}\n'
print_results += f'{building.name}, '
for value in results["monthly heating peak load"]:
print_results += f'{value}, '
for value in results["monthly cooling peak load"]:
print_results += f'{value}, '
file = 'city name: ' + self._city.name + '\n'
for building in self._city.buildings:
file += '\n'
file += 'name: ' + building.name + '\n'
file += 'year of construction: ' + str(building.year_of_construction) + '\n'
file += 'function: ' + building.function + '\n'
file += 'floor area: ' + str(building.internal_zones[0].area) + '\n'
file += 'storeys: ' + str(building.storeys_above_ground) + '\n'
file += 'heated_volume: ' + str(0.85 * building.volume) + '\n'
file += 'volume: ' + str(building.volume) + '\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'heated_volume: {0.85 * building.volume}\n'
file += f'volume: {building.volume}\n'
full_path_results = Path(self._path / 'peak_loads.csv').resolve()
with open(full_path_results, 'w') as results_file: