Bug correction in the lca factory and lca_data.xml

This commit is contained in:
Guille Gutierrez 2022-04-06 16:37:51 -04:00
parent 4f624e1143
commit d46576c890
2 changed files with 495 additions and 495 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ Contributor Mohammad Reza mohammad.seyedabadi@mail.concordia.ca
"""
import xmltodict
from pathlib import Path
from city_model_structure.building_demand.material import Material
from city_model_structure.lca_material import LcaMaterial as LMaterial
class LcaMaterial:
def __init__(self, city, base_path):
@ -15,14 +15,14 @@ class LcaMaterial:
self._lca = None
def enrich(self):
self._city.materials = []
self._city.lca_materials = []
path = Path(self._base_path / 'lca_data.xml').resolve()
with open(path) as xml:
self._lca = xmltodict.parse(xml.read())
for material in self._lca["library"]["building_materials"]['material']:
_material = Material()
_material = LMaterial()
_material.type = material['@type']
_material.id = material['@id']
_material.name = material['@name']
@ -37,4 +37,4 @@ class LcaMaterial:
_material.cost=material['cost']['#text']
_material._cost_unit=material['cost']['@unit']
self._city.materials.append(_material)
self._city.lca_materials.append(_material)