Add constructions and archetypes AND Add access to them from the constructor

This commit is contained in:
Alireza Adli 2024-07-17 16:08:40 -04:00
parent 2aaf66e884
commit 7a93c337de
3 changed files with 75683 additions and 13 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,23 +12,30 @@ from pathlib import Path
from hub.imports.geometry_factory import GeometryFactory from hub.imports.geometry_factory import GeometryFactory
from hub.imports.construction_factory import ConstructionFactory from hub.imports.construction_factory import ConstructionFactory
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
# from hub.city_model_structure.life_cycle_assessment.access_nrcan_catalogue \ from city_model_structure.life_cycle_assessment.access_nrcan_catalogue \
# import AccessNrcanCatalog import AccessNrcanCatalog
# from hub.city_model_structure.life_cycle_assessment.building_component \ from city_model_structure.life_cycle_assessment.building_component \
# import BuildingComponent import BuildingComponent
class LCACarbonWorkflow: class LCACarbonWorkflow:
def __init__( def __init__(
self, self,
city_path, city_path,
catalogue_path, archetypes_catalog_file_name,
catalogue='nrcan', constructions_catalog_file,
catalog='nrcan',
building_parameters=('height', 'year_of_construction', 'function')): building_parameters=('height', 'year_of_construction', 'function')):
self.file_path = (Path(__file__).parent / 'input_files' / city_path) self.file_path = (Path(__file__).parent / 'input_files' / city_path)
self.catalogue_path = (Path(__file__).parent / 'input_files' / catalogue_path) self.catalogs_path = (Path(__file__).parent / 'input_files')
self.archetypes_catalog_file_name = archetypes_catalog_file_name
self.constructions_catalog_file = constructions_catalog_file
self.nrcan_catalogs = AccessNrcanCatalog(
self.catalogs_path,
archetypes=self.archetypes_catalog_file_name,
constructions=self.constructions_catalog_file)
self.out_path = (Path(__file__).parent / 'out_files') self.out_path = (Path(__file__).parent / 'out_files')
self.handler = catalogue self.handler = catalog
self.height, self.year_of_construction, self.function = \ self.height, self.year_of_construction, self.function = \
building_parameters building_parameters
@ -44,19 +51,22 @@ 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()
@staticmethod def calculate_opening_emission(self, building):
def calculate_opening_emission(building):
surface_emission = [] surface_emission = []
opaque_code = self.nrcan_catalogs.find_opaque_surface(
building.function, building.year_of_construction, '6')
print(building.function, building.year_of_construction)
print(opaque_code)
for surface in building.surfaces: for surface in building.surfaces:
for boundary in surface.associated_thermal_boundaries: for boundary in surface.associated_thermal_boundaries:
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 opening_surface = 0
opening_material_emission = 0 opening_material_emission = 0
print('window != 0') # print('window != 0')
# for opening in surface.associated_thermal_boundaries.thermal_openings: # for opening in surface.associated_thermal_boundaries.thermal_openings:
# opening_surface += opening.area # opening_surface += opening.area
# opening_material_emission = # opening_material_emission =