Types of properties are added

This commit is contained in:
atiya 2021-11-15 10:35:31 -05:00
parent 9d2d115549
commit dbab2d2501
7 changed files with 149 additions and 81 deletions

View File

@ -12,28 +12,28 @@ class Fuel:
self._unit = unit
@property
def id(self):
def id(self) -> int:
"""
Get fuel id
"""
return self._fuel_id
@property
def name(self):
def name(self) -> str:
"""
Get fuel name
"""
return self._name
@property
def carbon_emission_factor(self):
def carbon_emission_factor(self) -> float:
"""
Get fuel carbon emission factor
"""
return self._carbon_emission_factor
@property
def unit(self):
def unit(self) -> str:
"""
Get fuel units
"""

View File

@ -21,56 +21,56 @@ class Machine:
self._carbon_emission_unit = carbon_emission_unit
@property
def id(self):
def id(self) -> int:
"""
Get machine id
"""
return self._machine_id
@property
def name(self):
def name(self) -> str:
"""
Get machine name
"""
return self._name
@property
def work_efficiency(self):
def work_efficiency(self) -> float:
"""
Get machine work efficiency
"""
return self._work_efficiency
@property
def work_efficiency_unit(self):
def work_efficiency_unit(self) -> str:
"""
Get machine work efficiency unit
"""
return self._work_efficiency_unit
@property
def energy_consumption_rate(self):
def energy_consumption_rate(self) -> float:
"""
Get energy consumption rate
"""
return self._energy_consumption_rate
@property
def energy_consumption_unit(self):
def energy_consumption_unit(self) -> str:
"""
Get energy consumption unit
"""
return self._energy_consumption_unit
@property
def carbon_emission_factor(self):
def carbon_emission_factor(self) -> float:
"""
Get carbon emission factor
"""
return self._carbon_emission_factor
@property
def carbon_emission_unit(self):
def carbon_emission_unit(self) -> str:
"""
Get carbon emission unit
"""

View File

@ -26,91 +26,91 @@ class Material:
self._cost_unit = cost_unit
@property
def material_name(self):
def material_name(self) -> str:
"""
Get material name
"""
return self._material_name
@property
def id(self):
def id(self) -> int:
"""
Get material id
"""
return self._material_id
@property
def type(self):
def type(self) -> str:
"""
Get material type
"""
return self._type
@property
def density(self):
def density(self) -> float:
"""
Get material density
"""
return self._density
@property
def density_unit(self):
def density_unit(self) -> str:
"""
Get material density unit
"""
return self._density_unit
@property
def embodied_carbon(self):
def embodied_carbon(self) -> float:
"""
Get material embodied carbon
"""
return self._embodied_carbon
@property
def embodied_carbon_unit(self):
def embodied_carbon_unit(self) -> str:
"""
Get material embodied carbon unit
"""
return self._embodied_carbon_unit
@property
def recycling_ratio(self):
def recycling_ratio(self) -> float:
"""
Get material recycling ratio
"""
return self._recycling_ratio
@property
def onsite_recycling_ratio(self):
def onsite_recycling_ratio(self) -> float:
"""
Get material onsite recycling ratio
"""
return self._onsite_recycling_ratio
@property
def company_recycling_ratio(self):
def company_recycling_ratio(self) -> float:
"""
Get material company recycling ratio
"""
return self._company_recycling_ratio
@property
def landfilling_ratio(self):
def landfilling_ratio(self) -> float:
"""
Get material landfilling ratio
"""
return self._landfilling_ratio
@property
def cost(self):
def cost(self) -> float:
"""
Get material cost
"""
return self._cost
@property
def cost_unit(self):
def cost_unit(self) -> str:
"""
Get material cost unit
"""

View File

@ -18,42 +18,42 @@ class Vehicle:
self._carbon_emission_factor_unit = carbon_emission_factor_unit
@property
def id(self):
def id(self) -> int:
"""
Get vehicle id
"""
return self._vehicle_id
@property
def name(self):
def name(self) -> str:
"""
Get vehicle name
"""
return self._name
@property
def fuel_consumption_rate(self):
def fuel_consumption_rate(self) -> float:
"""
Get vehicle fuel consumption rate
"""
return self._fuel_consumption_rate
@property
def fuel_consumption_unit(self):
def fuel_consumption_unit(self) -> str:
"""
Get fuel consumption unit
"""
return self._fuel_consumption_unit
@property
def carbon_emission_factor(self):
def carbon_emission_factor(self) -> float:
"""
Get vehicle carbon emission factor
"""
return self._carbon_emission_factor
@property
def carbon_emission_unit(self):
def carbon_emission_unit(self) -> str:
"""
Get carbon emission units
"""

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<library name="LCA">
<Fuels>
<fuels>
<fuel id="1" name= "Black_coal">
<carbon_emission_factor unit= "kgCO2/ kWh" > 0.32 </carbon_emission_factor>
</fuel>
@ -76,99 +76,99 @@
<fuel id="25" name= "Steam">
<carbon_emission_factor unit= "kgCO2/ kg"> 0.61 </carbon_emission_factor>
</fuel>
</Fuels>
<Machines>
<machine name= "Rock_drill">
</fuels>
<machines>
<machine id="1" name= "Rock_drill">
<work_efficiency unit= "h/m3"> 0.347 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 16.5 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Hydraulic_hammer">
<machine id="2" name= "Hydraulic_hammer">
<work_efficiency unit= "h/m3"> 0.033 </work_efficiency>
<energy_consumption_rate unit= "kg_fuel/h"> 25.2 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 4.16 </carbon_emission_factor>
</machine>
<machine name= "Crawler_bulldozer">
<machine id="3" name= "Crawler_bulldozer">
<work_efficiency unit= "h/m3"> 0.027 </work_efficiency>
<energy_consumption_rate unit= "kg_fuel/h3"> 16.8 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 2.239 </carbon_emission_factor>
</machine>
<machine name= "Crawler_excavator">
<machine id="4" name= "Crawler_excavator">
<work_efficiency unit= "h/m3"> 0.023 </work_efficiency>
<energy_consumption_rate unit= "kg_fuel/h"> 16.8 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 2.239 </carbon_emission_factor>
</machine>
<machine name= "Crawler_hydraulic_rock_crusher">
<machine id="5" name= "Crawler_hydraulic_rock_crusher">
<work_efficiency unit= "h/m3"> 0.109 </work_efficiency>
<energy_consumption_rate unit= "kg_fuel/h"> 25.2 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 2.239 </carbon_emission_factor>
</machine>
<machine name= "Mobile_recycling_equipment">
<machine id="6" name= "Mobile_recycling_equipment">
<work_efficiency unit= "h/ton"> 0.003 </work_efficiency>
<energy_consumption_rate unit= "kg_fuel/h"> 16.4 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 4.16 </carbon_emission_factor>
</machine>
<machine name= "Vibration_feeder">
<machine id="7" name= "Vibration_feeder">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 11 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Jaw_crusher">
<machine id="8" name= "Jaw_crusher">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 90 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Electromagnetic_separator">
<machine id="9" name= "Electromagnetic_separator">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 10 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Wind_sorting_machine">
<machine id="10" name= "Wind_sorting_machine">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 11 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Impact_crusher">
<machine id="11" name= "Impact_crusher">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 132 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Double_circular_vibrating_plug">
<machine id="12" name= "Double_circular_vibrating_plug">
<work_efficiency unit= " h/ton "> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 15 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kW"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Spiral_sand_washing_machine">
<machine id="13" name= "Spiral_sand_washing_machine">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 5.5 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
<machine name= "Conveyor_belts">
<machine id="14" name= "Conveyor_belts">
<work_efficiency unit= "h/ton"> 0.002 </work_efficiency>
<energy_consumption_rate unit= "kWh/h"> 22.5 </energy_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</machine>
</Machines>
<Vehicles>
<vehicle name= "Freight_lorry_18_ton">
</machines>
<vehicles>
<vehicle id="1" name= "Freight_lorry_18_ton">
<fuel_consumption_rate unit= "kg_fuel/ton.km"> 0.0123 </fuel_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kg_fuel"> 2.239 </carbon_emission_factor>
</vehicle>
<vehicle name= "Freight_train">
<vehicle id="2" name= "Freight_train">
<fuel_consumption_rate unit= "kWh/ton.km"> 0.042 </fuel_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 0.918 </carbon_emission_factor>
</vehicle>
<vehicle name= "Freight_ship">
<vehicle id="3" name= "Freight_ship">
<fuel_consumption_rate unit= "kWh/ton.km"> 0.01 </fuel_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 1.00000 </carbon_emission_factor>
</vehicle>
<vehicle name= "Freight_Air">
<vehicle id="4" name= "Freight_Air">
<fuel_consumption_rate unit= "kWh/ton.km"> 1.3 </fuel_consumption_rate>
<carbon_emission_factor unit= "kgCO2/kWh"> 1.00000 </carbon_emission_factor>
</vehicle>
</Vehicles>
<Building_materials>
<Bricks>
</vehicles>
<building_materials>
<bricks>
<brick id="1" type= "clay brick">
<density unit= "ton/m3"> 1.8 </density>
<embodied_carbon unit= "kgCO2/ton"> 560 </embodied_carbon>
@ -205,8 +205,8 @@
<landfilling_ratio> 0.2 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</brick>
</Bricks>
<Concretes>
</bricks>
<concretes>
<concrete id="1" type= "light weight expanded clay">
<density unit= "ton/m3"> 1.6 </density>
<embodied_carbon unit= "kgCO2/ton"> 900 </embodied_carbon>
@ -315,7 +315,7 @@
<landfilling_ratio> 0.2 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</concrete>
</Concretes>
</concretes>
<glasses>
<glass id="1" type= "flat glass, coated">
<density unit= "ton/m3"> 2.58 </density>
@ -336,8 +336,8 @@
<cost unit= "...."> .... </cost>
</glass>
</glasses>
<Insulations>
<Insulation id="1" type= "cellulose fibre">
<insulations>
<insulation id="1" type= "cellulose fibre">
<density unit= "ton/m3"> 0.06 </density>
<embodied_carbon unit= "kgCO2/ton"> 1760 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -345,8 +345,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="2" type= "cork slab">
</insulation>
<insulation id="2" type= "cork slab">
<density unit= "ton/m3"> 0.122 </density>
<embodied_carbon unit= "kgCO2/ton"> 3080 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -354,8 +354,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="3" type= "polystyren foam">
</insulation>
<insulation id="3" type= "polystyren foam">
<density unit= "ton/m3"> 0.028 </density>
<embodied_carbon unit= "kgCO2/ton"> 3180 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -363,8 +363,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="4" type= "polystyrene 10% recycled">
</insulation>
<insulation id="4" type= "polystyrene 10% recycled">
<density unit= "ton/m3"> 0.024 </density>
<embodied_carbon unit= "kgCO2/ton"> 5140 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -372,8 +372,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="5" type= "stone wool">
</insulation>
<insulation id="5" type= "stone wool">
<density unit= "ton/m3"> 0.1 </density>
<embodied_carbon unit= "kgCO2/ton"> 6040 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -381,8 +381,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="6" type= "foam glass">
</insulation>
<insulation id="6" type= "foam glass">
<density unit= "ton/m3"> 0.3 </density>
<embodied_carbon unit= "kgCO2/ton"> 5380 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -390,8 +390,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
<Insulation id="7" type= "glass wool mat">
</insulation>
<insulation id="7" type= "glass wool mat">
<density unit= "ton/m3"> 0.032 </density>
<embodied_carbon unit= "kgCO2/ton"> 2150 </embodied_carbon>
<recycling_ratio> 0.9 </recycling_ratio>
@ -399,8 +399,8 @@
<company_recycling_ratio> 1 </company_recycling_ratio>
<landfilling_ratio> 0.1 </landfilling_ratio>
<cost unit= "...."> .... </cost>
</Insulation>
</Insulations>
</insulation>
</insulations>
<woods>
<wood id="1" type= "fiberboard, hard">
<density unit= "ton/m3"> 0.9 </density>
@ -569,5 +569,5 @@
<cost unit= "...."> .... </cost>
</metal>
</metals>
</Building_materials>
</building_materials>
</library>

View File

@ -0,0 +1,72 @@
"""
CityGml module parses citygml_classes files and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Atiya
"""
import xmltodict
from pathlib import Path
from city_model_structure.material import Material
class LcaMaterial:
def __init__(self, city, base_path):
self._city = city
self._base_path = base_path
self._lca = None
def enrich(self):
self._city.materials = []
path = Path(self._base_path / 'lca_data.xml').resolve()
with open(path) as xml:
self._lca = xmltodict.parse(xml.read())
# for vehicle in self._lca["library"]["vehicles"]['vehicle']:
# self._city.vehicles.append(Vehicle(vehicle['@id'], vehicle['@name'], vehicle['fuel_consumption_rate']['#text'],
# vehicle['fuel_consumption_rate']['@unit'], vehicle['carbon_emission_factor']['#text'],
# vehicle['carbon_emission_factor']['@unit']))
for brick in self._lca["library"]["building_materials"]['bricks']['brick']:
material_name = "brick"
self._city.materials.append(Material(material_name, brick['@id'], brick['@type'], brick['density']['#text'], brick['density']['@unit'],
brick['embodied_carbon']['#text'], brick['embodied_carbon']['@unit'], brick['recycling_ratio'],
brick['onsite_recycling_ratio'], brick['company_recycling_ratio'], brick['landfilling_ratio'],
brick['cost']['#text'], brick['cost']['@unit']))
for concrete in self._lca["library"]["building_materials"]['concretes']['concrete']:
material_name = "concrete"
self._city.materials.append(Material(material_name, concrete['@id'], brick['@type'], concrete['density']['#text'], concrete['density']['@unit'],
concrete['embodied_carbon']['#text'], concrete['embodied_carbon']['@unit'], concrete['recycling_ratio'],
concrete['onsite_recycling_ratio'], concrete['company_recycling_ratio'], concrete['landfilling_ratio'],
concrete['cost']['#text'], concrete['cost']['@unit']))
for glass in self._lca["library"]["building_materials"]['glasses']['glass']:
material_name = "glass"
self._city.materials.append(Material(material_name, glass['@id'], brick['@type'], glass['density']['#text'], glass['density']['@unit'],
glass['embodied_carbon']['#text'], glass['embodied_carbon']['@unit'], glass['recycling_ratio'],
glass['onsite_recycling_ratio'], glass['company_recycling_ratio'], glass['landfilling_ratio'],
glass['cost']['#text'], glass['cost']['@unit']))
for insulation in self._lca["library"]["building_materials"]['insulations']['insulation']:
material_name = "insulation"
self._city.materials.append(Material(material_name, insulation['@id'], brick['@type'], insulation['density']['#text'], insulation['density']['@unit'],
insulation['embodied_carbon']['#text'], insulation['embodied_carbon']['@unit'], insulation['recycling_ratio'],
insulation['onsite_recycling_ratio'], insulation['company_recycling_ratio'], insulation['landfilling_ratio'],
insulation['cost']['#text'], insulation['cost']['@unit']))
for wood in self._lca["library"]["building_materials"]['woods']['wood']:
material_name = "wood"
self._city.materials.append(Material(material_name, wood['@id'], brick['@type'], wood['density']['#text'], wood['density']['@unit'],
wood['embodied_carbon']['#text'], wood['embodied_carbon']['@unit'], wood['recycling_ratio'],
wood['onsite_recycling_ratio'], wood['company_recycling_ratio'], wood['landfilling_ratio'],
wood['cost']['#text'], wood['cost']['@unit']))
for covering in self._lca["library"]["building_materials"]['coverings']['covering']:
material_name = "covering"
self._city.materials.append(Material(material_name, covering['@id'], brick['@type'], covering['density']['#text'], covering['density']['@unit'],
covering['embodied_carbon']['#text'], covering['embodied_carbon']['@unit'], covering['recycling_ratio'],
covering['onsite_recycling_ratio'], covering['company_recycling_ratio'], covering['landfilling_ratio'],
covering['cost']['#text'], covering['cost']['@unit']))
for metal in self._lca["library"]["building_materials"]['metals']['metal']:
material_name = "metal"
self._city.materials.append(Material(material_name, metal['@id'], brick['@type'], metal['density']['#text'], metal['density']['@unit'],
metal['embodied_carbon']['#text'], metal['embodied_carbon']['@unit'], metal['recycling_ratio'],
metal['onsite_recycling_ratio'], metal['company_recycling_ratio'], metal['landfilling_ratio'],
metal['cost']['#text'], metal['cost']['@unit']))

View File

@ -26,7 +26,6 @@ class TestLifeCycleAssessment(TestCase):
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('fuel', city).enrich()
for fuel in city.fuels:
# print(fuel.name)
self.assertTrue(len(city.fuels) > 0)
def test_vehicle(self):
@ -34,7 +33,6 @@ class TestLifeCycleAssessment(TestCase):
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('vehicle', city).enrich()
for vehicle in city.vehicles:
# print(vehicle.name)
self.assertTrue(len(city.vehicles) > 0)
def test_machine(self):
@ -42,7 +40,6 @@ class TestLifeCycleAssessment(TestCase):
city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('machine', city).enrich()
for machine in city.machines:
# print(machine.name)
self.assertTrue(len(city.machines) > 0)
def test_material(self):
@ -50,7 +47,6 @@ class TestLifeCycleAssessment(TestCase):
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)