forked from s_ranjbar/city_retrofit
Bug correction in the lca factory and lca_data.xml
This commit is contained in:
parent
4f624e1143
commit
d46576c890
File diff suppressed because it is too large
Load Diff
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user