Added LCA formulas

This commit is contained in:
atiya 2021-11-15 08:24:03 -05:00 committed by guille
parent cc56c19aa0
commit d76ea58b74
4 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,23 @@
"""
LifeCycleAssessment retrieve the specific Life Cycle Assessment module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Atiya
"""
from city_model_structure.machine import Machine
class LcaCalculations:
"""
LCA Calculations class
"""
def __init__(self):
print("lca calculations class")
def emission_disposal_machines(self, ):
return Machine.work_efficiency * Machine.energy_consumption_rate * Machine.carbon_emission_factor
def emission_transportation(self, weight, distance ):
return weight * distance * Machine.energy_consumption_rate * Machine.carbon_emission_factor

View File

@ -0,0 +1,118 @@
"""
LifeCycleAssessment retrieve the specific Life Cycle Assessment module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Atiya
"""
class Material:
"""
LCA Material class
"""
def __init__(self, material_name, material_id, type, density, density_unit, embodied_carbon, embodied_carbon_unit, recycling_ratio,
onsite_recycling_ratio, company_recycling_ratio, landfilling_ratio, cost, cost_unit):
self._material_name = material_name
self._material_id = material_id
self._type = type
self._density = density
self._density_unit = density_unit
self._embodied_carbon = embodied_carbon
self._embodied_carbon_unit = embodied_carbon_unit
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._cost = cost
self._cost_unit = cost_unit
@property
def material_name(self):
"""
Get material name
"""
return self._material_name
@property
def id(self):
"""
Get material id
"""
return self._material_id
@property
def type(self):
"""
Get material type
"""
return self._type
@property
def density(self):
"""
Get material density
"""
return self._density
@property
def density_unit(self):
"""
Get material density unit
"""
return self._density_unit
@property
def embodied_carbon(self):
"""
Get material embodied carbon
"""
return self._embodied_carbon
@property
def embodied_carbon_unit(self):
"""
Get material embodied carbon unit
"""
return self._embodied_carbon_unit
@property
def recycling_ratio(self):
"""
Get material recycling ratio
"""
return self._recycling_ratio
@property
def onsite_recycling_ratio(self):
"""
Get material onsite recycling ratio
"""
return self._onsite_recycling_ratio
@property
def company_recycling_ratio(self):
"""
Get material company recycling ratio
"""
return self._company_recycling_ratio
@property
def landfilling_ratio(self):
"""
Get material landfilling ratio
"""
return self._landfilling_ratio
@property
def cost(self):
"""
Get material cost
"""
return self._cost
@property
def cost_unit(self):
"""
Get material cost unit
"""
return self._cost_unit

View File

@ -8,6 +8,7 @@ from pathlib import Path
from imports.life_cycle_assessment.lca_fuel import LcaFuel
from imports.life_cycle_assessment.lca_vehicle import LcaVehicle
from imports.life_cycle_assessment.lca_machine import LcaMachine
from imports.life_cycle_assessment.lca_material import LcaMaterial
class LifeCycleAssessment:
@ -39,6 +40,12 @@ class LifeCycleAssessment:
"""
LcaMachine(self._city, self._base_path).enrich()
def _material(self):
"""
Enrich the city by adding the material carbon information
"""
LcaMaterial(self._city, self._base_path).enrich()
def enrich(self):
"""
Enrich the city given to the class using the class given handler

View File

@ -45,6 +45,14 @@ class TestLifeCycleAssessment(TestCase):
# print(machine.name)
self.assertTrue(len(city.machines) > 0)
def test_material(self):
city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('material', city).enrich()
for material in city.materials:
print(material.material_name)
self.assertTrue(len(city.materials) > 0)