Finalize building component calculation

This commit is contained in:
Alireza Adli 2024-07-20 20:00:07 -04:00
parent 4882023561
commit 9fd50b00f3

View File

@ -54,6 +54,7 @@ class LCACarbonWorkflow:
ConstructionFactory(self.handler, self.city).enrich() ConstructionFactory(self.handler, self.city).enrich()
def calculate_building_component_emission(self, building): def calculate_building_component_emission(self, building):
surface_envelope_emission = []
surface_opening_emission = [] surface_opening_emission = []
period_of_construction = self.nrcan_catalogs.year_to_period_of_construction(building.year_of_construction) period_of_construction = self.nrcan_catalogs.year_to_period_of_construction(building.year_of_construction)
print(period_of_construction) print(period_of_construction)
@ -65,31 +66,38 @@ class LCACarbonWorkflow:
'6') '6')
for surface in building.surfaces: for surface in building.surfaces:
boundary_envelope_emission = []
boundary_opening_emission = [] boundary_opening_emission = []
for boundary in surface.associated_thermal_boundaries: for boundary in surface.associated_thermal_boundaries:
opening_emission = [] opening_emission = None
layer_emission = [] layer_emission = self._calculate_envelope_emission(boundary)
if boundary.window_ratio == 0: boundary_envelope_emission += layer_emission
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
else: if boundary.window_ratio:
opening_emission = self._calculate_opening_emission( opening_emission = self._calculate_opening_emission(
building, surface, boundary, opaque_surface_code) building, surface, boundary, opaque_surface_code)
if opening_emission: if opening_emission:
boundary_opening_emission += opening_emission boundary_opening_emission += opening_emission
print('boundary_opening_emission', boundary_opening_emission)
if boundary_opening_emission: if boundary_opening_emission:
surface_opening_emission += 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) 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( def _calculate_opening_emission(
self, building, surface, boundary, opaque_surface_code): self, building, surface, boundary, opaque_surface_code):
@ -105,9 +113,6 @@ class LCACarbonWorkflow:
opening.area).calculate_opening_emission()) opening.area).calculate_opening_emission())
return opening_emission return opening_emission
def _calculate_envelope_emission(self):
pass
def calculate_emission(self): def calculate_emission(self):
for building in self.city.buildings: for building in self.city.buildings:
self.calculate_building_component_emission(building) self.calculate_building_component_emission(building)