forked from s_ranjbar/city_retrofit
Machines added into City class
This commit is contained in:
parent
651151c6ac
commit
a40c1a0154
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@ 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']:
|
||||
|
@ -25,3 +27,5 @@ class LcaMachine:
|
|||
machine['work_efficiency']['@unit'], machine['energy_consumption_rate']['#text'],
|
||||
machine['energy_consumption_rate']['@unit'], machine['carbon_emission_factor']['#text'],
|
||||
machine['carbon_emission_factor']['@unit']))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user