Merge remote-tracking branch 'origin/master'

This commit is contained in:
atiya 2021-11-16 14:25:35 -05:00
commit 5246cb27ee
5 changed files with 20 additions and 6 deletions

View File

@ -50,6 +50,7 @@ class City:
self._parts_consisting_buildings = None
self._city_objects_clusters = None
self._city_objects = None
self._energy_systems = None
self._fuels = None
@property
@ -200,6 +201,10 @@ class City:
if self._subway_entrances is None:
self._subway_entrances = []
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:
raise NotImplementedError(new_city_object.type)
@ -341,6 +346,14 @@ class City:
"""
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
def city_objects_clusters(self) -> Union[List[CityObjectsCluster], None]:
"""

View File

@ -32,7 +32,7 @@ class YearlyFromDailySchedules:
values = []
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)
values.extend(weekly_schedules[week_day])
yearly_schedule.type = self._daily_schedules[0].type

View File

@ -21,8 +21,8 @@ class Obj:
with open(path, 'r') as file:
self._scene = trimesh.exchange.load.load(file, file_type='obj', force='scene')
self._corners = self._scene.bounds_corners
_bound_corner_min = []
_bound_corner_max = []
_bound_corner_min = None
_bound_corner_max = None
for corner in self._corners:
if _bound_corner_min is None:
_bound_corner_min = corner

View File

@ -45,7 +45,7 @@ class TestExports(TestCase):
else:
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
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()
SchedulesFactory('comnet', self._complete_city).enrich()
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'

View File

@ -8,6 +8,7 @@ from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.usage_factory import UsageFactory
from imports.construction_factory import ConstructionFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
@ -38,7 +39,7 @@ class TestUsageFactory(TestCase):
city = self._get_citygml(file)
for building in city.buildings:
building.function = GeometryHelper.pluto_to_function[building.function]
ConstructionFactory('nrel', city).enrich()
UsageFactory('hft', city).enrich()
for building in city.buildings:
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')
@ -61,7 +62,7 @@ class TestUsageFactory(TestCase):
# case 2: CA
file = 'one_building_in_kelowna.gml'
city = self._get_citygml(file)
ConstructionFactory('nrel', city).enrich()
UsageFactory('ca', city).enrich()
for building in city.buildings:
self.assertIsNot(len(building.usage_zones), 0, 'no building usage_zones defined')