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
|
|
|
|
Copyright © 2020 Project Author Atiya
|
|
|
|
"""
|
|
|
|
import xmltodict
|
|
|
|
from pathlib import Path
|
|
|
|
from city_model_structure.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.materials = []
|
|
|
|
path = Path(self._base_path / 'lca_data.xml').resolve()
|
|
|
|
|
|
|
|
with open(path) as xml:
|
|
|
|
self._lca = xmltodict.parse(xml.read())
|
|
|
|
|
|
|
|
# for vehicle in self._lca["library"]["vehicles"]['vehicle']:
|
|
|
|
# self._city.vehicles.append(Vehicle(vehicle['@id'], vehicle['@name'], vehicle['fuel_consumption_rate']['#text'],
|
|
|
|
# vehicle['fuel_consumption_rate']['@unit'], vehicle['carbon_emission_factor']['#text'],
|
|
|
|
# vehicle['carbon_emission_factor']['@unit']))
|
2021-11-16 14:25:25 -05:00
|
|
|
for material in self._lca["library"]["building_materials"]['material']:
|
|
|
|
material_name = "material"
|
|
|
|
self._city.materials.append(Material(material['@type'], material['@id'], material['@name'], material['density']['#text'], material['density']['@unit'],
|
|
|
|
material['embodied_carbon']['#text'], material['embodied_carbon']['@unit'], material['recycling_ratio'],
|
|
|
|
material['onsite_recycling_ratio'], material['company_recycling_ratio'], material['landfilling_ratio'],
|
|
|
|
material['cost']['#text'], material['cost']['@unit']))
|
|
|
|
# for concrete in self._lca["library"]["building_materials"]['concretes']['concrete']:
|
|
|
|
# material_name = "concrete"
|
|
|
|
# self._city.materials.append(Material(material_name, concrete['@id'], material['@type'], concrete['density']['#text'], concrete['density']['@unit'],
|
|
|
|
# concrete['embodied_carbon']['#text'], concrete['embodied_carbon']['@unit'], concrete['recycling_ratio'],
|
|
|
|
# concrete['onsite_recycling_ratio'], concrete['company_recycling_ratio'], concrete['landfilling_ratio'],
|
|
|
|
# concrete['cost']['#text'], concrete['cost']['@unit']))
|
|
|
|
# for glass in self._lca["library"]["building_materials"]['glasses']['glass']:
|
|
|
|
# material_name = "glass"
|
|
|
|
# self._city.materials.append(Material(material_name, glass['@id'], material['@type'], glass['density']['#text'], glass['density']['@unit'],
|
|
|
|
# glass['embodied_carbon']['#text'], glass['embodied_carbon']['@unit'], glass['recycling_ratio'],
|
|
|
|
# glass['onsite_recycling_ratio'], glass['company_recycling_ratio'], glass['landfilling_ratio'],
|
|
|
|
# glass['cost']['#text'], glass['cost']['@unit']))
|
|
|
|
#
|
|
|
|
# for insulation in self._lca["library"]["building_materials"]['insulations']['insulation']:
|
|
|
|
# material_name = "insulation"
|
|
|
|
# self._city.materials.append(Material(material_name, insulation['@id'], material['@type'], insulation['density']['#text'], insulation['density']['@unit'],
|
|
|
|
# insulation['embodied_carbon']['#text'], insulation['embodied_carbon']['@unit'], insulation['recycling_ratio'],
|
|
|
|
# insulation['onsite_recycling_ratio'], insulation['company_recycling_ratio'], insulation['landfilling_ratio'],
|
|
|
|
# insulation['cost']['#text'], insulation['cost']['@unit']))
|
|
|
|
#
|
|
|
|
# for wood in self._lca["library"]["building_materials"]['woods']['wood']:
|
|
|
|
# material_name = "wood"
|
|
|
|
# self._city.materials.append(Material(material_name, wood['@id'], material['@type'], wood['density']['#text'], wood['density']['@unit'],
|
|
|
|
# wood['embodied_carbon']['#text'], wood['embodied_carbon']['@unit'], wood['recycling_ratio'],
|
|
|
|
# wood['onsite_recycling_ratio'], wood['company_recycling_ratio'], wood['landfilling_ratio'],
|
|
|
|
# wood['cost']['#text'], wood['cost']['@unit']))
|
|
|
|
#
|
|
|
|
# for covering in self._lca["library"]["building_materials"]['coverings']['covering']:
|
|
|
|
# material_name = "covering"
|
|
|
|
# self._city.materials.append(Material(material_name, covering['@id'], material['@type'], covering['density']['#text'], covering['density']['@unit'],
|
|
|
|
# covering['embodied_carbon']['#text'], covering['embodied_carbon']['@unit'], covering['recycling_ratio'],
|
|
|
|
# covering['onsite_recycling_ratio'], covering['company_recycling_ratio'], covering['landfilling_ratio'],
|
|
|
|
# covering['cost']['#text'], covering['cost']['@unit']))
|
|
|
|
#
|
|
|
|
# for metal in self._lca["library"]["building_materials"]['metals']['metal']:
|
|
|
|
# material_name = "metal"
|
|
|
|
# self._city.materials.append(Material(material_name, metal['@id'], material['@type'], metal['density']['#text'], metal['density']['@unit'],
|
|
|
|
# metal['embodied_carbon']['#text'], metal['embodied_carbon']['@unit'], metal['recycling_ratio'],
|
|
|
|
# metal['onsite_recycling_ratio'], metal['company_recycling_ratio'], metal['landfilling_ratio'],
|
|
|
|
# metal['cost']['#text'], metal['cost']['@unit']))
|