From 1d9498cf26f52566ae204e7b4c1292ba7e6d58c7 Mon Sep 17 00:00:00 2001 From: atiya Date: Mon, 15 Nov 2021 08:24:03 -0500 Subject: [PATCH] Added LCA formulas --- imports/life_cycle_assessment_factory.py | 7 +++++++ unittests/test_life_cycle_assessment_factory.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/imports/life_cycle_assessment_factory.py b/imports/life_cycle_assessment_factory.py index 3aff1fe4..cb99b981 100644 --- a/imports/life_cycle_assessment_factory.py +++ b/imports/life_cycle_assessment_factory.py @@ -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 diff --git a/unittests/test_life_cycle_assessment_factory.py b/unittests/test_life_cycle_assessment_factory.py index 32e3453e..3245d56b 100644 --- a/unittests/test_life_cycle_assessment_factory.py +++ b/unittests/test_life_cycle_assessment_factory.py @@ -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) +