diff --git a/city_model_structure/city.py b/city_model_structure/city.py
index d6537265..e6a80d17 100644
--- a/city_model_structure/city.py
+++ b/city_model_structure/city.py
@@ -18,6 +18,7 @@ from city_model_structure.city_objects_cluster import CityObjectsCluster
from city_model_structure.buildings_cluster import BuildingsCluster
from city_model_structure.parts_consisting_building import PartsConsistingBuilding
from city_model_structure.subway_entrance import SubwayEntrance
+from city_model_structure.fuel import Fuel
from helpers.geometry_helper import GeometryHelper
from helpers.location import Location
@@ -47,6 +48,15 @@ class City:
self._parts_consisting_buildings = None
self._city_objects_clusters = None
self._city_objects = None
+ self._fuels = None
+
+ @property
+ def fuels(self) -> [Fuel]:
+ return self._fuels
+
+ @fuels.setter
+ def fuels(self, value):
+ self._fuels = value
def _get_location(self) -> Location:
if self._location is None:
diff --git a/city_model_structure/fuel.py b/city_model_structure/fuel.py
new file mode 100644
index 00000000..e78a9f76
--- /dev/null
+++ b/city_model_structure/fuel.py
@@ -0,0 +1,41 @@
+"""
+ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
+SPDX - License - Identifier: LGPL - 3.0 - or -later
+Copyright © 2020 Project Author Atiya
+"""
+
+class Fuel:
+ def __init__(self, fuel_id, name, carbon_emission_factor, unit):
+ self._fuel_id = fuel_id
+ self._name = name
+ self._carbon_emission_factor = carbon_emission_factor
+ self._unit = unit
+
+ @property
+ def id(self):
+ """
+ Get fuel id
+ """
+ return self._fuel_id
+
+ @property
+ def name(self):
+ """
+ Get fuel name
+ """
+ return self._name
+
+ @property
+ def carbon_emission_factor(self):
+ """
+ Get fuel carbon emission factor
+ """
+ return self._carbon_emission_factor
+
+ @property
+ def unit(self):
+ """
+ Get fuel units
+ """
+ return self._unit
+
diff --git a/data/life_cicle_analize/lca_data.xml b/data/life_cicle_analize/lca_data.xml
new file mode 100644
index 00000000..bc3ab8ee
--- /dev/null
+++ b/data/life_cicle_analize/lca_data.xml
@@ -0,0 +1,573 @@
+
+
+
+
+ 0.32
+
+
+ 0.4
+
+
+ 0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0
+ 0
+ 0
+ 1
+ ....
+
+
+ 1.43
+ 240
+ 0
+ 0
+ 0
+ 1
+ ....
+
+
+ 1.43
+ 430
+ 0
+ 0
+ 0
+ 1
+ ....
+
+
+ 1.43
+ 340
+ 0
+ 0
+ 0
+ 1
+ ....
+
+
+ 1.2
+ 440
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+ 2.1
+ 1410
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+ 1.43
+ 250
+ 0
+ 0
+ 0
+ 1
+ ....
+
+
+ 1.44
+ 1480
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+ 1.44
+ 2220
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+ 1.27
+ 3960
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+ 1.15
+ 760
+ 0.8
+ 0
+ 1
+ 0.2
+ ....
+
+
+
+
+ 8
+ 3160
+ 0.98
+ 0
+ 1
+ 0.02
+ ....
+
+
+ 2.7
+ 5370
+ 0.98
+ 0
+ 1
+ 0.02
+ ....
+
+
+ 7.85
+ 3910
+ 0.98
+ 0
+ 1
+ 0.02
+ ....
+
+
+
+
\ No newline at end of file
diff --git a/imports/life_cicle_analize/lca_fuel.py b/imports/life_cicle_analize/lca_fuel.py
new file mode 100644
index 00000000..c35e0749
--- /dev/null
+++ b/imports/life_cicle_analize/lca_fuel.py
@@ -0,0 +1,24 @@
+"""
+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.fuel import Fuel
+
+class LcaFuel:
+ def __init__(self, city, base_path):
+ self._city = city
+ self._base_path = base_path
+ self._lca = None
+
+ def enrich(self):
+ self._city.fuels = []
+ path = Path(self._base_path / 'lca_data.xml').resolve()
+
+ with open(path) as xml:
+ self._lca = xmltodict.parse(xml.read())
+ for fuel in self._lca["library"]["Fuels"]['fuel']:
+ self._city.fuels.append(Fuel(fuel['@id'], fuel['@name'], fuel['carbon_emission_factor']['#text'],
+ fuel['carbon_emission_factor']['@unit']))
diff --git a/imports/life_cicle_analyze_factory.py b/imports/life_cicle_analyze_factory.py
new file mode 100644
index 00000000..7a09097a
--- /dev/null
+++ b/imports/life_cicle_analyze_factory.py
@@ -0,0 +1,33 @@
+"""
+ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
+SPDX - License - Identifier: LGPL - 3.0 - or -later
+Copyright © 2020 Project Author Atiya
+"""
+
+from pathlib import Path
+from imports.life_cicle_analize.lca_fuel import LcaFuel
+
+
+class LifeCicleAnalizeFactory:
+ """
+ Life cicle analize factory class
+ """
+ def __init__(self, handler, city, base_path=None):
+ if base_path is None:
+ base_path = Path(Path(__file__).parent.parent / 'data/construction')
+ self._handler = '_' + handler.lower().replace(' ', '_')
+ self._city = city
+ self._base_path = base_path
+
+ def _fuel(self):
+ """
+ Enrich the city by adding the fuel carbon information
+ """
+ LcaFuel(self._city, self._base_path).enrich()
+
+ def enrich(self):
+ """
+ Enrich the city given to the class using the class given handler
+ :return: None
+ """
+ getattr(self, self._handler, lambda: None)()
diff --git a/unittests/tests_data/lca_data.xml b/unittests/tests_data/lca_data.xml
new file mode 100644
index 00000000..bc3ab8ee
--- /dev/null
+++ b/unittests/tests_data/lca_data.xml
@@ -0,0 +1,573 @@
+
+
+
+
+ 0.32
+
+
+ 0.4
+
+
+ 0.4
+
+
+ 0.5
+
+
+ 0.18
+
+
+ 0.39
+
+
+ 0.27
+
+
+ 4.16
+
+
+ 2.24
+
+
+ 0.2
+
+
+ 3.19
+
+
+ 3.53
+
+
+ 0.27
+
+
+ 0.21
+
+
+ 1.69
+
+
+ 0.21
+
+
+ 0.35
+
+
+ 0.18
+
+
+ 0.81
+
+
+ 1.21
+
+
+ 1.61
+
+
+ 0.11
+
+
+ 0.3
+
+
+ 1.16
+
+
+ 0.61
+
+
+
+
+ 0.347
+ 16.5
+ 0.918
+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