diff --git a/lca_carbon_workflow.py b/lca_carbon_workflow.py index 99c4376..35926a6 100644 --- a/lca_carbon_workflow.py +++ b/lca_carbon_workflow.py @@ -51,7 +51,7 @@ class LCACarbonWorkflow: print(f'city created from {self.file_path}') ConstructionFactory(self.handler, self.city).enrich() - def calculate_opening_emission(self, building): + def calculate_building_component_emission(self, building): surface_opening_emission = [] period_of_construction = self.nrcan_catalogs.year_to_period_of_construction(building.year_of_construction) print(period_of_construction) @@ -72,26 +72,32 @@ class LCACarbonWorkflow: # print('window = 0') else: print('window != 0') - for opening in boundary.thermal_openings: - transparent_surface_type = 'Window' - if building.year_of_construction >= 2020 and \ - surface.type == 'Roof': - transparent_surface_type = 'Skylight' - opening_emission.append(OpeningEmission( - self.nrcan_catalogs.search_transparent_surfaces( - transparent_surface_type, opaque_surface_code)['embodied_carbon'], - opening.area).calculate_opening_emission()) - print('\t\t\t', opening_emission) - print('opening_emission', opening_emission) + opening_emission = self._calculate_opening_emission( + building, surface, boundary, opaque_surface_code) if opening_emission: boundary_opening_emission += opening_emission print('boundary_opening_emission', boundary_opening_emission) if boundary_opening_emission: surface_opening_emission += boundary_opening_emission - print('surface_opening_emission', surface_opening_emission, '\n', sum(surface_opening_emission)) + building_opening_emission = sum(surface_opening_emission) + print(building_opening_emission) + + def _calculate_opening_emission( + self, building, surface, boundary, opaque_surface_code): + opening_emission = [] + for opening in boundary.thermal_openings: + transparent_surface_type = 'Window' + if building.year_of_construction >= 2020 and \ + surface.type == 'Roof': + transparent_surface_type = 'Skylight' + opening_emission.append(OpeningEmission( + self.nrcan_catalogs.search_transparent_surfaces( + transparent_surface_type, opaque_surface_code)['embodied_carbon'], + opening.area).calculate_opening_emission()) + return opening_emission def calculate_emission(self): emitted_carbon = [] opening_emission = [] for building in self.city.buildings: - self.calculate_opening_emission(building) + self.calculate_building_component_emission(building)