2021-11-12 04:41:17 -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-12 04:41:17 -05:00
|
|
|
"""
|
|
|
|
import xmltodict
|
|
|
|
from pathlib import Path
|
2021-11-13 00:55:04 -05:00
|
|
|
from city_model_structure.vehicle import Vehicle
|
2021-11-12 04:41:17 -05:00
|
|
|
|
2022-03-02 12:13:11 -05:00
|
|
|
|
2021-11-13 00:55:04 -05:00
|
|
|
class LcaVehicle:
|
2021-11-12 04:41:17 -05:00
|
|
|
def __init__(self, city, base_path):
|
|
|
|
self._city = city
|
|
|
|
self._base_path = base_path
|
|
|
|
self._lca = None
|
|
|
|
|
|
|
|
def enrich(self):
|
2021-11-13 00:55:04 -05:00
|
|
|
self._city.vehicles = []
|
2021-11-12 04:41:17 -05:00
|
|
|
path = Path(self._base_path / 'lca_data.xml').resolve()
|
|
|
|
|
|
|
|
with open(path) as xml:
|
|
|
|
self._lca = xmltodict.parse(xml.read())
|
2021-11-13 00:55:04 -05:00
|
|
|
for vehicle in self._lca["library"]["vehicles"]['vehicle']:
|
|
|
|
self._city.vehicles.append(Vehicle(vehicle['@id'], vehicle['@name'], vehicle['fuel_consumption_rate']['#text'],
|
2022-03-02 12:13:11 -05:00
|
|
|
vehicle['fuel_consumption_rate']['@unit'],
|
|
|
|
vehicle['carbon_emission_factor']['#text'],
|
|
|
|
vehicle['carbon_emission_factor']['@unit']))
|
2022-03-23 14:40:49 -04:00
|
|
|
|