forked from s_ranjbar/city_retrofit
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5246cb27ee
|
@ -50,6 +50,7 @@ class City:
|
||||||
self._parts_consisting_buildings = None
|
self._parts_consisting_buildings = None
|
||||||
self._city_objects_clusters = None
|
self._city_objects_clusters = None
|
||||||
self._city_objects = None
|
self._city_objects = None
|
||||||
|
self._energy_systems = None
|
||||||
self._fuels = None
|
self._fuels = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -200,6 +201,10 @@ class City:
|
||||||
if self._subway_entrances is None:
|
if self._subway_entrances is None:
|
||||||
self._subway_entrances = []
|
self._subway_entrances = []
|
||||||
self._subway_entrances.append(new_city_object)
|
self._subway_entrances.append(new_city_object)
|
||||||
|
elif new_city_object.type == 'energy_system':
|
||||||
|
if self._energy_systems is None:
|
||||||
|
self._energy_systems = []
|
||||||
|
self._energy_systems.append(new_city_object)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(new_city_object.type)
|
raise NotImplementedError(new_city_object.type)
|
||||||
|
|
||||||
|
@ -341,6 +346,14 @@ class City:
|
||||||
"""
|
"""
|
||||||
return self._parts_consisting_buildings
|
return self._parts_consisting_buildings
|
||||||
|
|
||||||
|
@property
|
||||||
|
def energy_systems(self) -> Union[List[EnergySystem], None]:
|
||||||
|
"""
|
||||||
|
Get energy systems belonging to the city
|
||||||
|
:return: None or [EnergySystem]
|
||||||
|
"""
|
||||||
|
return self._energy_systems
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def city_objects_clusters(self) -> Union[List[CityObjectsCluster], None]:
|
def city_objects_clusters(self) -> Union[List[CityObjectsCluster], None]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,7 +32,7 @@ class YearlyFromDailySchedules:
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
for month in range(1, 13):
|
for month in range(1, 13):
|
||||||
for day in range(1, cal.monthlen(self._year, month)+1):
|
for day in range(1, cal._monthlen(self._year, month)+1):
|
||||||
week_day = cal.weekday(self._year, month, day)
|
week_day = cal.weekday(self._year, month, day)
|
||||||
values.extend(weekly_schedules[week_day])
|
values.extend(weekly_schedules[week_day])
|
||||||
yearly_schedule.type = self._daily_schedules[0].type
|
yearly_schedule.type = self._daily_schedules[0].type
|
||||||
|
|
|
@ -21,8 +21,8 @@ class Obj:
|
||||||
with open(path, 'r') as file:
|
with open(path, 'r') as file:
|
||||||
self._scene = trimesh.exchange.load.load(file, file_type='obj', force='scene')
|
self._scene = trimesh.exchange.load.load(file, file_type='obj', force='scene')
|
||||||
self._corners = self._scene.bounds_corners
|
self._corners = self._scene.bounds_corners
|
||||||
_bound_corner_min = []
|
_bound_corner_min = None
|
||||||
_bound_corner_max = []
|
_bound_corner_max = None
|
||||||
for corner in self._corners:
|
for corner in self._corners:
|
||||||
if _bound_corner_min is None:
|
if _bound_corner_min is None:
|
||||||
_bound_corner_min = corner
|
_bound_corner_min = corner
|
||||||
|
|
|
@ -45,7 +45,7 @@ class TestExports(TestCase):
|
||||||
else:
|
else:
|
||||||
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
|
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
|
||||||
self._complete_city = self._get_citygml(file_path)
|
self._complete_city = self._get_citygml(file_path)
|
||||||
ConstructionFactory('ca', self._complete_city).enrich()
|
ConstructionFactory('nrel', self._complete_city).enrich()
|
||||||
UsageFactory('ca', self._complete_city).enrich()
|
UsageFactory('ca', self._complete_city).enrich()
|
||||||
SchedulesFactory('comnet', self._complete_city).enrich()
|
SchedulesFactory('comnet', self._complete_city).enrich()
|
||||||
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
|
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
|
||||||
|
|
|
@ -8,6 +8,7 @@ from unittest import TestCase
|
||||||
|
|
||||||
from imports.geometry_factory import GeometryFactory
|
from imports.geometry_factory import GeometryFactory
|
||||||
from imports.usage_factory import UsageFactory
|
from imports.usage_factory import UsageFactory
|
||||||
|
from imports.construction_factory import ConstructionFactory
|
||||||
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ class TestUsageFactory(TestCase):
|
||||||
city = self._get_citygml(file)
|
city = self._get_citygml(file)
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
building.function = GeometryHelper.pluto_to_function[building.function]
|
building.function = GeometryHelper.pluto_to_function[building.function]
|
||||||
|
ConstructionFactory('nrel', city).enrich()
|
||||||
UsageFactory('hft', city).enrich()
|
UsageFactory('hft', city).enrich()
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
||||||
|
@ -61,7 +62,7 @@ class TestUsageFactory(TestCase):
|
||||||
# case 2: CA
|
# case 2: CA
|
||||||
file = 'one_building_in_kelowna.gml'
|
file = 'one_building_in_kelowna.gml'
|
||||||
city = self._get_citygml(file)
|
city = self._get_citygml(file)
|
||||||
|
ConstructionFactory('nrel', city).enrich()
|
||||||
UsageFactory('ca', city).enrich()
|
UsageFactory('ca', city).enrich()
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user