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
|
import xmltodict
|
||||||
from pathlib import Path
|
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:
|
class LcaMaterial:
|
||||||
def __init__(self, city, base_path):
|
def __init__(self, city, base_path):
|
||||||
|
@ -15,14 +15,14 @@ class LcaMaterial:
|
||||||
self._lca = None
|
self._lca = None
|
||||||
|
|
||||||
def enrich(self):
|
def enrich(self):
|
||||||
self._city.materials = []
|
self._city.lca_materials = []
|
||||||
path = Path(self._base_path / 'lca_data.xml').resolve()
|
path = Path(self._base_path / 'lca_data.xml').resolve()
|
||||||
|
|
||||||
with open(path) as xml:
|
with open(path) as xml:
|
||||||
self._lca = xmltodict.parse(xml.read())
|
self._lca = xmltodict.parse(xml.read())
|
||||||
|
|
||||||
for material in self._lca["library"]["building_materials"]['material']:
|
for material in self._lca["library"]["building_materials"]['material']:
|
||||||
_material = Material()
|
_material = LMaterial()
|
||||||
_material.type = material['@type']
|
_material.type = material['@type']
|
||||||
_material.id = material['@id']
|
_material.id = material['@id']
|
||||||
_material.name = material['@name']
|
_material.name = material['@name']
|
||||||
|
@ -37,4 +37,4 @@ class LcaMaterial:
|
||||||
_material.cost=material['cost']['#text']
|
_material.cost=material['cost']['#text']
|
||||||
_material._cost_unit=material['cost']['@unit']
|
_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