2021-11-15 10:35:31 -05:00
|
|
|
"""
|
|
|
|
CityGml module parses citygml_classes files and import the geometry into the city model structure
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Atiya atiya.atiya@mail.concordia.ca
|
2021-11-15 10:35:31 -05:00
|
|
|
"""
|
|
|
|
import xmltodict
|
|
|
|
from pathlib import Path
|
2022-04-06 16:37:51 -04:00
|
|
|
from city_model_structure.lca_material import LcaMaterial as LMaterial
|
2022-03-02 12:13:11 -05:00
|
|
|
|
2021-11-15 10:35:31 -05:00
|
|
|
class LcaMaterial:
|
|
|
|
def __init__(self, city, base_path):
|
|
|
|
self._city = city
|
|
|
|
self._base_path = base_path
|
|
|
|
self._lca = None
|
|
|
|
|
|
|
|
def enrich(self):
|
2022-04-06 16:37:51 -04:00
|
|
|
self._city.lca_materials = []
|
2021-11-15 10:35:31 -05:00
|
|
|
path = Path(self._base_path / 'lca_data.xml').resolve()
|
|
|
|
|
|
|
|
with open(path) as xml:
|
|
|
|
self._lca = xmltodict.parse(xml.read())
|
|
|
|
|
2021-11-16 14:25:25 -05:00
|
|
|
for material in self._lca["library"]["building_materials"]['material']:
|
2022-04-06 16:37:51 -04:00
|
|
|
_material = LMaterial()
|
2022-03-08 19:19:52 -05:00
|
|
|
_material.type = material['@type']
|
|
|
|
_material.id = material['@id']
|
|
|
|
_material.name = material['@name']
|
|
|
|
_material.density=material['density']['#text']
|
|
|
|
_material.density_unit=material['density']['@unit']
|
|
|
|
_material.embodied_carbon=material['embodied_carbon']['#text']
|
|
|
|
_material.embodied_carbon_unit=material['embodied_carbon']['@unit']
|
|
|
|
_material.recycling_ratio=material['recycling_ratio']
|
|
|
|
_material.onsite_recycling_ratio=material['onsite_recycling_ratio']
|
|
|
|
_material.company_recycling_ratio=material['company_recycling_ratio']
|
|
|
|
_material.landfilling_ratio=material['landfilling_ratio']
|
|
|
|
_material.cost=material['cost']['#text']
|
|
|
|
_material._cost_unit=material['cost']['@unit']
|
|
|
|
|
2022-04-06 16:37:51 -04:00
|
|
|
self._city.lca_materials.append(_material)
|