Return different component emission

This commit is contained in:
Alireza Adli 2024-07-21 10:35:42 -04:00
parent 9fd50b00f3
commit 3e9790b060

View File

@ -53,12 +53,14 @@ class LCACarbonWorkflow:
print(f'city created from {self.file_path}') print(f'city created from {self.file_path}')
ConstructionFactory(self.handler, self.city).enrich() ConstructionFactory(self.handler, self.city).enrich()
self.building_envelope_emission = []
self.building_opening_emission = []
self.building_component_emission = []
def calculate_building_component_emission(self, building): def calculate_building_component_emission(self, building):
surface_envelope_emission = [] 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(building.year_of_construction)
opaque_surface_code = self.nrcan_catalogs.find_opaque_surface( opaque_surface_code = self.nrcan_catalogs.find_opaque_surface(
self.nrcan_catalogs.hub_to_nrcan_function(building.function), self.nrcan_catalogs.hub_to_nrcan_function(building.function),
self.nrcan_catalogs.year_to_period_of_construction( self.nrcan_catalogs.year_to_period_of_construction(
@ -84,10 +86,9 @@ class LCACarbonWorkflow:
building_envelope_emission = sum(surface_envelope_emission) building_envelope_emission = sum(surface_envelope_emission)
building_opening_emission = sum(surface_opening_emission) building_opening_emission = sum(surface_opening_emission)
building_component_emission = \ building_component_emission = \
building_envelope_emission + building_opening_emission building_envelope_emission + building_opening_emission
print('\t\t\tbuilding_envelope_emission', building_envelope_emission) return building_envelope_emission, building_opening_emission, \
print('\t\t\tbuilding_opening_emission', building_opening_emission) building_component_emission
print('\t\t\t\tbuilding_component_emission', building_component_emission)
def _calculate_envelope_emission(self, boundary): def _calculate_envelope_emission(self, boundary):
layer_emission = [] layer_emission = []
@ -115,4 +116,8 @@ class LCACarbonWorkflow:
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) envelope, opening, building_component = \
self.calculate_building_component_emission(building)
self.building_envelope_emission.append(envelope)
self.building_opening_emission.append(opening)
self.building_component_emission.append(building_component)