diff --git a/lca_carbon_workflow.py b/lca_carbon_workflow.py index 0b7e934..c51f270 100644 --- a/lca_carbon_workflow.py +++ b/lca_carbon_workflow.py @@ -54,6 +54,7 @@ class LCACarbonWorkflow: ConstructionFactory(self.handler, self.city).enrich() def calculate_building_component_emission(self, building): + surface_envelope_emission = [] surface_opening_emission = [] period_of_construction = self.nrcan_catalogs.year_to_period_of_construction(building.year_of_construction) print(period_of_construction) @@ -65,31 +66,38 @@ class LCACarbonWorkflow: '6') for surface in building.surfaces: + boundary_envelope_emission = [] boundary_opening_emission = [] for boundary in surface.associated_thermal_boundaries: - opening_emission = [] - layer_emission = [] - if boundary.window_ratio == 0: - opening_surface = 0 - opening_material_emission = 0 - for layer in boundary.layers: - layer_emission.append(EnvelopeEmission( - self.nrcan_catalogs.search_materials( - layer.material_name)['embodied_carbon'], - boundary.opaque_area, - layer.thickness).calculate_envelope_emission()) -# continue from here, but remember, since the area of windows and opaque is at hand, we may not need a conditional for window_ratio + opening_emission = None + layer_emission = self._calculate_envelope_emission(boundary) + boundary_envelope_emission += layer_emission - else: + if boundary.window_ratio: 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 + surface_envelope_emission += boundary_envelope_emission + building_envelope_emission = sum(surface_envelope_emission) building_opening_emission = sum(surface_opening_emission) - # print(building_opening_emission) + building_component_emission = \ + building_envelope_emission + building_opening_emission + print('\t\t\tbuilding_envelope_emission', building_envelope_emission) + print('\t\t\tbuilding_opening_emission', building_opening_emission) + print('\t\t\t\tbuilding_component_emission', building_component_emission) + + def _calculate_envelope_emission(self, boundary): + layer_emission = [] + for layer in boundary.layers: + if not layer.no_mass: + layer_emission.append(EnvelopeEmission( + self.nrcan_catalogs.search_materials( + layer.material_name)['embodied_carbon'], + boundary.opaque_area, layer.thickness).calculate_envelope_emission()) + return layer_emission def _calculate_opening_emission( self, building, surface, boundary, opaque_surface_code): @@ -105,9 +113,6 @@ class LCACarbonWorkflow: opening.area).calculate_opening_emission()) return opening_emission - def _calculate_envelope_emission(self): - pass - def calculate_emission(self): for building in self.city.buildings: self.calculate_building_component_emission(building)