diff --git a/city_model_structure/city.py b/city_model_structure/city.py index ddccd9d0..4b9ea923 100644 --- a/city_model_structure/city.py +++ b/city_model_structure/city.py @@ -20,6 +20,7 @@ from city_model_structure.buildings_cluster import BuildingsCluster from city_model_structure.parts_consisting_building import PartsConsistingBuilding from city_model_structure.subway_entrance import SubwayEntrance from city_model_structure.fuel import Fuel +from city_model_structure.machine import Machine from helpers.geometry_helper import GeometryHelper from helpers.location import Location from city_model_structure.energy_system import EnergySystem @@ -52,6 +53,7 @@ class City: self._city_objects = None self._energy_systems = None self._fuels = None + self._machines = None self._stations = [] @property @@ -62,6 +64,14 @@ class City: def fuels(self, value): self._fuels = value + @property + def machines(self) -> [Machine]: + return self._machines + + @machines.setter + def machines(self, value): + self._machines = value + def _get_location(self) -> Location: if self._location is None: gps = pyproj.CRS('EPSG:4326') # LatLon with WGS84 datum used by GPS units and Google Earth diff --git a/imports/geometry/rhino.py b/imports/geometry/rhino.py index 3b2c283a..d5753d74 100644 --- a/imports/geometry/rhino.py +++ b/imports/geometry/rhino.py @@ -14,7 +14,7 @@ from city_model_structure.attributes.polygon import Polygon from city_model_structure.building import Building from city_model_structure.city import City from city_model_structure.building_demand.surface import Surface as LibsSurface -from helpers.constants import EPSILON +# from helpers.constants import EPSILON from imports.geometry.helpers.geometry_helper import GeometryHelper diff --git a/imports/life_cycle_assessment/lca_machine.py b/imports/life_cycle_assessment/lca_machine.py index 87c35c5c..0507f7dd 100644 --- a/imports/life_cycle_assessment/lca_machine.py +++ b/imports/life_cycle_assessment/lca_machine.py @@ -16,12 +16,16 @@ class LcaMachine: def enrich(self): self._city.machines = [] + # print(self._base_path) path = Path(self._base_path / 'lca_data.xml').resolve() + with open(path) as xml: self._lca = xmltodict.parse(xml.read()) - for machine in self._lca["library"]["machines"]['machine']: - self._city.machines.append(Machine(machine['@id'], machine['@name'], machine['work_efficiency']['#text'], - machine['work_efficiency']['@unit'], machine['energy_consumption_rate']['#text'], - machine['energy_consumption_rate']['@unit'], machine['carbon_emission_factor']['#text'], - machine['carbon_emission_factor']['@unit'])) + for machine in self._lca["library"]["machines"]['machine']: + self._city.machines.append(Machine(machine['@id'], machine['@name'], machine['work_efficiency']['#text'], + machine['work_efficiency']['@unit'], machine['energy_consumption_rate']['#text'], + machine['energy_consumption_rate']['@unit'], machine['carbon_emission_factor']['#text'], + machine['carbon_emission_factor']['@unit'])) + +