Call window emissions/Track the bug prints

This commit is contained in:
Alireza Adli 2024-07-18 17:19:32 -04:00
parent cf1a4cbb5a
commit 9723bb0e86

View File

@ -14,8 +14,8 @@ from hub.imports.construction_factory import ConstructionFactory
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
from city_model_structure.life_cycle_assessment.access_nrcan_catalogue \ from city_model_structure.life_cycle_assessment.access_nrcan_catalogue \
import AccessNrcanCatalog import AccessNrcanCatalog
from city_model_structure.life_cycle_assessment.building_component \ from city_model_structure.life_cycle_assessment.opening_emission \
import BuildingComponent import OpeningEmission
class LCACarbonWorkflow: class LCACarbonWorkflow:
@ -52,26 +52,44 @@ class LCACarbonWorkflow:
ConstructionFactory(self.handler, self.city).enrich() ConstructionFactory(self.handler, self.city).enrich()
def calculate_opening_emission(self, building): def calculate_opening_emission(self, building):
surface_emission = [] surface_opening_emission = []
opaque_code = self.nrcan_catalogs.find_opaque_surface( period_of_construction = self.nrcan_catalogs.year_to_period_of_construction(building.year_of_construction)
building.function, building.year_of_construction, '6') print(period_of_construction)
print(building.function, building.year_of_construction) print(building.year_of_construction)
print(opaque_code) opaque_surface_code = self.nrcan_catalogs.find_opaque_surface(
self.nrcan_catalogs.hub_to_nrcan_function(building.function),
self.nrcan_catalogs.year_to_period_of_construction(
building.year_of_construction),
'6')
for surface in building.surfaces: for surface in building.surfaces:
boundary_opening_emission = []
for boundary in surface.associated_thermal_boundaries: for boundary in surface.associated_thermal_boundaries:
opening_emission = []
if boundary.window_ratio == 0: if boundary.window_ratio == 0:
opening_surface = 0 opening_surface = 0
opening_material_emission = 0 opening_material_emission = 0
# print('window = 0') # print('window = 0')
else: else:
opening_surface = 0 print('window != 0')
opening_material_emission = 0 for opening in boundary.thermal_openings:
# print('window != 0') transparent_surface_type = 'Window'
# for opening in surface.associated_thermal_boundaries.thermal_openings: if building.year_of_construction >= 2020 and \
# opening_surface += opening.area surface.type == 'Roof':
# opening_material_emission = 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)
boundary_opening_emission.append(opening_emission)
print('boundary_opening_emission', boundary_opening_emission)
surface_opening_emission.append(boundary_opening_emission)
print('surface_opening_emission', surface_opening_emission)
def calculate_emission(self): def calculate_emission(self):
emitted_carbon = [] emitted_carbon = []
opening_emission = []
for building in self.city.buildings: for building in self.city.buildings:
self.calculate_opening_emission(building) self.calculate_opening_emission(building)