Compare commits

...

47 Commits

Author SHA1 Message Date
a9262b42e7 Merge branch 'main' into feature/lifecycle_emission_calculation 2024-10-28 05:45:34 +01:00
Alireza Adli
8e2e46e866 Correct description 2024-10-21 12:42:14 -04:00
Alireza Adli
625fa62930 Correct description 2024-10-18 10:19:25 -04:00
Alireza Adli
59776e5a6e Correct description 2024-10-18 10:11:41 -04:00
Alireza Adli
9cbc2bc634 Correct indentation 2024-10-14 10:52:33 -04:00
Alireza Adli
317a20917f Clean comments 2024-10-13 12:41:48 -04:00
Alireza Adli
38c468b29b Finalize comments 2024-10-13 12:40:24 -04:00
Alireza Adli
b50724690f Return to the original name 2024-10-13 12:36:10 -04:00
Alireza Adli
f142332cb9 Change search_materials name 2024-10-13 12:16:55 -04:00
Alireza Adli
3a1f418577 Add comments 2024-10-13 12:13:14 -04:00
Alireza Adli
79c27244e6 Correct the description 2024-09-19 13:27:24 -04:00
Alireza Adli
7c1028897a Change the email address 2024-09-19 13:18:56 -04:00
Alireza Adli
30bdd7bdd2 Change the email address 2024-09-19 12:12:56 -04:00
Alireza Adli
1934461364 Change the email address 2024-09-19 12:12:25 -04:00
Alireza Adli
017a8ce6a7 Delete comments 2024-09-19 12:01:26 -04:00
Alireza Adli
0b3518f5a3 Delete comments 2024-09-19 11:49:36 -04:00
Alireza Adli
dc4a82ce8a Edit description and edit indentation 2024-08-13 13:12:32 -04:00
Alireza Adli
8b4f89bbd6 Add description 2024-08-02 13:23:18 -04:00
Alireza Adli
b07b1c4bb7 Clean 2024-08-02 13:04:14 -04:00
Alireza Adli
ed4ee36dbf Replace all processes with the workload 2024-08-02 12:01:30 -04:00
Alireza Adli
b888e4a1f2 Add density to envelope emission calculation 2024-08-01 13:44:45 -04:00
Alireza Adli
8a92731359 Finalize end of life emission 2024-08-01 13:01:22 -04:00
Alireza Adli
5d9aaa63ad Add ratios 2024-08-01 09:36:58 -04:00
Alireza Adli
da8abcce33 Add machine emission to the constructor 2024-08-01 09:23:47 -04:00
Alireza Adli
0c17fa48b5 Write endoflife methods/delete building component 2024-07-25 15:00:04 -04:00
Alireza Adli
4f9e5157a1 Clean the code 2024-07-22 09:45:27 -04:00
Alireza Adli
a8a493f436 Edit gitignore 2024-07-20 14:15:07 -04:00
Alireza Adli
72a6ee9d87 Ignore the materials dictionary 2024-07-20 14:13:14 -04:00
Alireza Adli
9bc9ff25fc Add search material to the access/rename to calculate_envelope_emission 2024-07-20 12:13:33 -04:00
Alireza Adli
7d19d8ab14 Add materials attribute 2024-07-20 11:40:49 -04:00
Alireza Adli
d6677c7fdb Finalize minor improvements 2024-07-18 17:16:30 -04:00
Alireza Adli
98723af190 Break down the building component to three pluse one classes 2024-07-18 14:16:00 -04:00
Alireza Adli
0c0736bd9f Add search window 2024-07-18 13:47:25 -04:00
Alireza Adli
346bbf4bdf Add windows as an attribute 2024-07-18 12:02:10 -04:00
Alireza Adli
455db4c522 Add a dictionaries for windows 2024-07-18 11:55:24 -04:00
Alireza Adli
7943cd7fda Add hub to nrcan function 2024-07-18 09:32:40 -04:00
Alireza Adli
9dd816ceb0 Add year to period of construction 2024-07-18 08:05:14 -04:00
Alireza Adli
79388dcc91 Edit lining and indentations 2024-07-17 16:11:12 -04:00
Alireza Adli
8f9ea87f49 Add new construction catalog 2024-07-17 13:43:51 -04:00
Alireza Adli
61e8458a1b Update gitignore 2024-07-17 12:07:04 -04:00
Alireza Adli
6854b35647 Add setters for archetypes and constructions catalogues 2024-07-17 10:31:33 -04:00
Alireza Adli
d41ce5371e Modify machine and access 2024-07-17 09:39:58 -04:00
Alireza Adli
d52c8bf73a Add access_nrcan_catalogue 2024-07-17 09:32:26 -04:00
Alireza Adli
4b5e330632 Push to my branch on hub, first test 2024-07-16 16:22:56 -04:00
Alireza Adli
0329c3a9a2 Add formula for vehicle and machine classes 2024-06-26 15:16:54 -04:00
Alireza Adli
b5d8053deb Develop the Machine attribute getters property 2024-06-26 14:45:35 -04:00
Alireza Adli
e474541201 Add features to the Material 2024-06-19 15:51:05 -04:00
13 changed files with 1880 additions and 1 deletions

5
.gitignore vendored
View File

@ -10,3 +10,8 @@
**/__pycache__/ **/__pycache__/
**/.idea/ **/.idea/
cerc_hub.egg-info cerc_hub.egg-info
ali_*.py
mreza_*.json
*_cap_3.json

View File

@ -3,6 +3,8 @@ Construction catalog material
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Alireza Adli alireza.adli@concordia.ca
Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
""" """
@ -15,6 +17,13 @@ class Material:
solar_absorptance, solar_absorptance,
thermal_absorptance, thermal_absorptance,
visible_absorptance, visible_absorptance,
density_unit,
embodied_carbon,
embodied_carbon_unit,
recycling_ratio,
company_recycling_ratio,
onsite_recycling_ratio,
landfilling_ratio,
no_mass=False, no_mass=False,
thermal_resistance=None, thermal_resistance=None,
conductivity=None, conductivity=None,
@ -29,7 +38,14 @@ class Material:
self._thermal_resistance = thermal_resistance self._thermal_resistance = thermal_resistance
self._conductivity = conductivity self._conductivity = conductivity
self._density = density self._density = density
self._density_unit = density_unit
self._specific_heat = specific_heat self._specific_heat = specific_heat
self._recycling_ratio = recycling_ratio
self._onsite_recycling_ratio = onsite_recycling_ratio
self._company_recycling_ratio = company_recycling_ratio
self._landfilling_ratio = landfilling_ratio
self._embodied_carbon = embodied_carbon
self._embodied_carbon_unit = embodied_carbon_unit
@property @property
def id(self): def id(self):
@ -71,6 +87,14 @@ class Material:
""" """
return self._density return self._density
@property
def density_unit(self):
"""
Get material density unit in kg/m3
:return: str
"""
return self._density_unit
@property @property
def solar_absorptance(self): def solar_absorptance(self):
""" """
@ -111,18 +135,73 @@ class Material:
""" """
return self._thermal_resistance return self._thermal_resistance
@property
def recycling_ratio(self):
"""
Get recycling ratio in %
:return: float
"""
return self._recycling_ratio
@property
def onsite_recycling_ratio(self):
"""
Get onsite recycling ratio in %
:return: float
"""
return self._onsite_recycling_ratio
@property
def company_recycling_ratio(self):
"""
Get company recycling ratio in %
:return: float
"""
return self._company_recycling_ratio
@property
def landfilling_ratio(self):
"""
Get landfilling ratio in %
:return: float
"""
return self._landfilling_ratio
@property
def embodied_carbon(self):
"""
Get embodied carbon in kg
:return: float
"""
return self._embodied_carbon
@property
def embodied_carbon_unit(self):
"""
Get embodied carbon unit in kg_co2_eq/kg_material
:return: str
"""
return self._embodied_carbon_unit
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
content = {'Material': {'id': self.id, content = {'Material': {'id': self.id,
'name': self.name, 'name': self.name,
'is no-mass': self.no_mass, 'is no-mass': self.no_mass,
'density [kg/m3]': self.density, 'density [kg/m3]': self.density,
'density unit [kg/m3]': self.density_unit,
'specific heat [J/kgK]': self.specific_heat, 'specific heat [J/kgK]': self.specific_heat,
'conductivity [W/mK]': self.conductivity, 'conductivity [W/mK]': self.conductivity,
'thermal resistance [m2K/W]': self.thermal_resistance, 'thermal resistance [m2K/W]': self.thermal_resistance,
'solar absorptance': self.solar_absorptance, 'solar absorptance': self.solar_absorptance,
'thermal absorptance': self.thermal_absorptance, 'thermal absorptance': self.thermal_absorptance,
'visible absorptance': self.visible_absorptance 'visible absorptance': self.visible_absorptance,
'recycling ratio': self.recycling_ratio,
'onsite recycling ratio': self.onsite_recycling_ratio,
'company recycling ratio': self.company_recycling_ratio,
'landfilling ratio': self.landfilling_ratio,
'embodied carbon': self.embodied_carbon,
'embodied carbon unit': self.embodied_carbon_unit
} }
} }
return content return content

View File

@ -0,0 +1,179 @@
"""
access_nrcan_catalog module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2024 Concordia CERC group
Project developer: Alireza Adli alireza.adli@mail.concordia.ca
"""
import json
from pathlib import Path
from hub.helpers.data.hub_function_to_nrcan_construction_function \
import HubFunctionToNrcanConstructionFunction
class AccessNrcanCatalog:
def __init__(
self, path,
archetypes='nrcan_archetypes.json',
constructions='nrcan_constructions_cap_3.json',
materials='nrcan_materials_dictionaries.json',
transparent_surfaces='nrcan_transparent_surfaces_dictionaries.json'):
"""
AccessNrcanCatalog eases accessing the below json files.
- It converts year of construction to the period of construction.
- It searches a specific material or transparent surface.
- The class finds the opaque surface code based on three parameters.
:param path: path to the below files
:param archetypes: a json file (a list of dictionaries) with building
archetypes' data
:param constructions: a json file (a list of dictionaries) with
building data based on NRCan
:param materials: a json file (a dictornaty of
dictionares to speed up the search) with construction material info.
:param transparent_surfaces: a json file (a dictionary of
dictionaries) with windows and skylights data.
"""
self._path = Path(path)
self.archetypes = archetypes
self.constructions = constructions
self.materials = materials
self.transparent_surfaces = transparent_surfaces
self.hub_to_nrcan_dictionary = \
HubFunctionToNrcanConstructionFunction().dictionary
@property
def archetypes(self):
return self._archetypes
@archetypes.setter
def archetypes(self, archetypes):
archetypes_path = (self._path / archetypes).resolve()
self._archetypes = json.loads(archetypes_path.read_text())
@property
def constructions(self):
return self._constructions
@constructions.setter
def constructions(self, constructions):
constructions_path = (self._path / constructions).resolve()
self._constructions = json.loads(constructions_path.read_text())
@property
def materials(self):
return self._materials
@materials.setter
def materials(self, materials):
materials_path = (self._path / materials).resolve()
self._materials = json.loads(materials_path.read_text())
@property
def transparent_surfaces(self):
return self._transparent_surfaces
@transparent_surfaces.setter
def transparent_surfaces(self, transparent_surfaces):
transparent_surfaces_path = (self._path / transparent_surfaces).resolve()
self._transparent_surfaces = json.loads(
transparent_surfaces_path.read_text())
def hub_to_nrcan_function(self, hub_function):
return self.hub_to_nrcan_dictionary[hub_function]
@staticmethod
def year_to_period_of_construction(year_of_construction):
"""
Converts year of construction to the period of construction.
:param year_of_construction: <class 'int'>
:return: <class 'str'>
"""
period_of_construction = None
if 1000 <= year_of_construction <= 1900:
period_of_construction = '1000_1900'
elif 1901 <= year_of_construction <= 1910:
period_of_construction = '1901_1910'
elif 1911 <= year_of_construction <= 1920:
period_of_construction = '1911_1920'
elif 1921 <= year_of_construction <= 1930:
period_of_construction = '1921_1930'
elif 1931 <= year_of_construction <= 1940:
period_of_construction = '1931_1940'
elif 1941 <= year_of_construction <= 1950:
period_of_construction = '1941_1950'
elif 1951 <= year_of_construction <= 1960:
period_of_construction = '1951_1960'
elif 1961 <= year_of_construction <= 1970:
period_of_construction = '1961_1970'
elif 1971 <= year_of_construction <= 1980:
period_of_construction = '1971_1980'
elif 1981 <= year_of_construction <= 1990:
period_of_construction = '1981_1990'
elif 1991 <= year_of_construction <= 2000:
period_of_construction = '1991_2000'
elif 2001 <= year_of_construction <= 2010:
period_of_construction = '2001_2010'
elif 2011 <= year_of_construction <= 2016:
period_of_construction = '2011_2016'
elif 2017 <= year_of_construction <= 2019:
period_of_construction = '2017_2019'
elif 2020 <= year_of_construction <= 3000:
period_of_construction = '2020_3000'
return period_of_construction
def layers(self, opaque_surface_code, component_type):
"""
Returns the corresponding layers of a specific opaque surface
and the component type.
:param opaque_surface_code: <class 'str'>
:param component_type: <class 'str'>
:return: <class 'dict'>
"""
for opaque_surface in self.constructions['opaque_surfaces']:
opaque_surface_key = list(opaque_surface)[0]
if opaque_surface_key != opaque_surface_code:
continue
elif opaque_surface[opaque_surface_key]['type'] == component_type:
return opaque_surface[opaque_surface_key]['layers']
def search_material(self, material_name):
"""
Search materials and bring up the specific material data
based on the material's name
:param material_name: <class 'str'>
:return: <class 'dict'>
"""
return self.materials[f'{material_name}']
def search_transparent_surfaces(
self, surface_type, opaque_surface_code):
"""
Search transparent surfaces and bring up the specific surface data
based on its type and opaque surface code
:param surface_type: <class 'str'>
:param opaque_surface_code: <class 'str'>
:return: <class 'dict'>
"""
return self.transparent_surfaces[
f'{surface_type}_{opaque_surface_code}']
def find_opaque_surface(
self, function, period_of_construction, climate_zone):
"""
Returns the opaque_surface_name based on the below parameters.
:param function: <class 'str'>
:param period_of_construction: <class 'str'>
:param climate_zone: <class 'str'>
:return: <class 'str'>
"""
for archetype in self.archetypes['archetypes']:
if archetype['function'] != function:
continue
elif archetype['period_of_construction'] != period_of_construction:
continue
elif archetype['climate_zone'] != climate_zone:
continue
else:
return \
archetype['constructions']['OutdoorsWall']['opaque_surface_name']

View File

@ -0,0 +1,13 @@
"""
energy_systems_material_emission module
Returns the summarize of emission of energy systems material.
The returned value will be used to calculate the building component emission.
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class EnergySystemsMaterialEmission:
pass

View File

@ -0,0 +1,43 @@
"""
envelope_emission module
Returns the summarize of envelope's surfaces emissions
The returned value will be used to calculate the building component emission.
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class EnvelopeEmission:
def __init__(self,
envelope_material_emission,
envelope_thickness,
envelope_surface,
density):
self._envelope_material_emission = envelope_material_emission
self._envelope_thickness = envelope_thickness
self._envelope_surface = envelope_surface
self._density = density
@property
def envelope_material_emission(self):
return self._envelope_material_emission
@property
def envelope_thickness(self):
return self._envelope_thickness
@property
def envelope_surface(self):
return self._envelope_surface
@property
def density(self):
return self._density
def calculate_envelope_emission(self):
return self._envelope_material_emission * \
self._envelope_thickness * \
self._envelope_surface * \
self._density

View File

@ -0,0 +1,11 @@
"""
lca_embodied_carbon module
SPDX - License - Identifier: LGPL - 3.0
Copyright © 2022 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class Embodied:
pass

View File

@ -0,0 +1,61 @@
"""
lca_end_of_life_carbon module
Machine emission of different methods can be a default argument, because,
at this phase we use the average emission of different machines emission
for each part (demolition, onsite, recycling and landfilling).
If we are to use data for different processes, setters will be develop for
the machines of each process to replace the default arguments. In that sense,
a conditional will decide to use which value. The conditional will be defined
in the setters.
For next phases, we can use a Machine object to find the corresponding
emission.
SPDX - License - Identifier: LGPL - 3.0
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class EndOfLifeEmission:
def __init__(
self, recycling_ratio, onsite_recycling_ratio,
company_recycling_ratio, landfilling_ratio,
material_workload,
demolition_machine_emission=4.3577325,
onsite_machine_emission=2.0576313,
companies_recycling_machine_emission=0.6189555,
landfilling_machine_emission=15.7364044):
self.recycling_ratio = recycling_ratio
self.onsite_recycling_ratio = onsite_recycling_ratio
self.company_recycling_ratio = company_recycling_ratio
self.landfilling_ratio = landfilling_ratio
self.material_workload = material_workload
self.demolition_machine_emission = demolition_machine_emission
self.onsite_machine_emission = onsite_machine_emission
self.companies_recycling_machine_emission = \
companies_recycling_machine_emission
self.landfilling_machine_emission = landfilling_machine_emission
def demolition(self):
return self.demolition_machine_emission * self.material_workload
def onsite_recycling(self):
return self.recycling_ratio * (self.onsite_recycling_ratio *
self.onsite_machine_emission *
self.material_workload)
def companies_recycling(self):
return self.recycling_ratio * (self.company_recycling_ratio *
self.companies_recycling_machine_emission *
self.material_workload)
def landfilling(self):
return self.landfilling_ratio * \
self.landfilling_machine_emission * \
self.material_workload
def calculate_end_of_life_emission(self):
return self.demolition() + \
self.onsite_recycling() + \
self.companies_recycling() + \
self.landfilling()

View File

@ -0,0 +1,11 @@
"""
lca_operational_carbon module
SPDX - License - Identifier: LGPL - 3.0
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class Operational:
pass

View File

@ -0,0 +1,59 @@
"""
machine module
SPDX - License - Identifier: LGPL - 3.0
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class Machine:
def __init__(self, machine_id, name, work_efficiency_rate,
work_efficiency_unit, energy_consumption_rate,
energy_consumption_unit, emission_factor,
emission_unit):
self._machine_id = machine_id
self._name = name
self._work_efficiency_rate = work_efficiency_rate
self._work_efficiency_unit = work_efficiency_unit
self._energy_consumption_rate = energy_consumption_rate
self._energy_consumption_unit = energy_consumption_unit
self._emission_factor = emission_factor
self._emission_unit = emission_unit
@property
def id(self) -> int:
return self._machine_id
@property
def name(self):
return self._name
@property
def work_efficiency(self):
return self._work_efficiency_rate
@property
def work_efficiency_unit(self):
return self._work_efficiency_unit
@property
def energy_consumption_rate(self):
return self._energy_consumption_rate
@property
def energy_consumption_unit(self):
return self._energy_consumption_unit
@property
def emission_factor(self):
return self._emission_factor
@property
def emission_unit(self):
return self._emission_unit
def total_machine_emssion(self):
return self._work_efficiency_rate * \
self._energy_consumption_rate * \
self._emission_factor

View File

@ -0,0 +1,26 @@
"""
opening_emission module
Returns the summarize of all surfaces openings' emissions
The returned value will be used to calculate the building component emission.
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class OpeningEmission:
def __init__(self, opening_material_emission, opening_surface):
self._opening_material_emission = opening_material_emission
self._opening_surface = opening_surface
@property
def opening_material_emission(self):
return self._opening_material_emission
@property
def opening_surface(self):
return self._opening_surface
def calculate_opening_emission(self):
return self._opening_material_emission * self._opening_surface

View File

@ -0,0 +1,46 @@
"""
vehicle module
SPDX - License - Identifier: LGPL - 3.0
Copyright © 2024 Concordia CERC group
Project Developer: Alireza Adli alireza.adli@mail.concordia.ca
Theoritical Support: Mohammad Reza Seyedabadi mohammad.seyedabadi@mail.concordia.ca
"""
class Vehicle:
def __init__(self, vehicle_id, name, fuel_consumption_rate,
fuel_consumption_unit, carbon_emission_factor,
carbon_emission_unit):
self._vehicle_id = vehicle_id
self._name = name
self._fuel_consumption_rate = fuel_consumption_rate
self._fuel_consumption_unit = fuel_consumption_unit
self._carbon_emission_factor = carbon_emission_factor
self._carbon_emission_unit = carbon_emission_unit
@property
def id(self):
return self._vehicle_id
@property
def name(self):
return self._name
@property
def fuel_consumption_rate(self):
return self._fuel_consumption_rate
@property
def fuel_consumption_unit(self):
return self._fuel_consumption_unit
@property
def carbon_emission_factor(self):
return self._carbon_emission_factor
@property
def carbon_emission_unit(self):
return self._carbon_emission_unit
def total_vehicle_emission(self):
return self._fuel_consumption_rate * self._carbon_emission_factor

File diff suppressed because it is too large Load Diff