41 lines
1.7 KiB
Python
41 lines
1.7 KiB
Python
"""
|
|
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 atiya.atiya@mail.concordia.ca
|
|
Contributor Mohammad Reza mohammad.seyedabadi@mail.concordia.ca
|
|
"""
|
|
import xmltodict
|
|
from pathlib import Path
|
|
from city_model_structure.building_demand.material import Material
|
|
|
|
|
|
class LcaMaterial:
|
|
def __init__(self, city, base_path):
|
|
self._city = city
|
|
self._base_path = base_path
|
|
self._lca = None
|
|
|
|
def enrich(self):
|
|
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']:
|
|
_lca_material = LcaMaterial()
|
|
_lca_material.type = material['@type']
|
|
_lca_material.id = material['@id']
|
|
_lca_material.name = material['@name']
|
|
_lca_material.density = material['density']['#text']
|
|
_lca_material.density_unit = material['density']['@unit']
|
|
_lca_material.embodied_carbon = material['embodied_carbon']['#text']
|
|
_lca_material.embodied_carbon_unit = material['embodied_carbon']['@unit']
|
|
_lca_material.recycling_ratio = material['recycling_ratio']
|
|
_lca_material.onsite_recycling_ratio = material['onsite_recycling_ratio']
|
|
_lca_material.company_recycling_ratio = material['company_recycling_ratio']
|
|
_lca_material.landfilling_ratio = material['landfilling_ratio']
|
|
_lca_material.cost = material['cost']['#text']
|
|
_lca_material._cost_unit = material['cost']['@unit']
|
|
self._city.lca_materials.append(_lca_material)
|