forked from s_ranjbar/city_retrofit
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3284215b5b
|
@ -442,3 +442,9 @@ class City:
|
|||
Get a copy of the current city
|
||||
"""
|
||||
return copy.deepcopy(self)
|
||||
|
||||
def merge(self, city) -> City:
|
||||
_merge_city = self.copy
|
||||
for city_object in city.city_objects:
|
||||
_merge_city.add_city_object(city_object)
|
||||
return _merge_city
|
||||
|
|
|
@ -157,6 +157,9 @@ class Idf:
|
|||
)
|
||||
|
||||
def _add_standard_compact_hourly_schedule(self, usage, schedule_type, schedules):
|
||||
for schedule in self._idf.idfobjects[self._COMPACT_SCHEDULE]:
|
||||
if schedule.Name == f'{schedule_type} schedules {usage}':
|
||||
return
|
||||
_kwargs = {'Name': f'{schedule_type} schedules {usage}',
|
||||
'Schedule_Type_Limits_Name': self.idf_type_limits[schedules[0].data_type],
|
||||
'Field_1': 'Through: 12/31'}
|
||||
|
@ -222,7 +225,7 @@ class Idf:
|
|||
else:
|
||||
_total_heat = (_occ.sensible_convective_internal_gain + _occ.sensible_radiative_internal_gain
|
||||
+ _occ.latent_internal_gain) / _occ.occupancy_density
|
||||
for schedule in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
|
||||
for schedule in self._idf.idfobjects[self._COMPACT_SCHEDULE]:
|
||||
if schedule.Name == f'Activity Level schedules {thermal_zone.usage}':
|
||||
return
|
||||
_kwargs = {'Name': f'Activity Level schedules {thermal_zone.usage}',
|
||||
|
|
36
unittests/test_city_merge.py
Normal file
36
unittests/test_city_merge.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
TestCityMerge test and validate the merge of several cities into one
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
|
||||
|
||||
class TestCityMerge(TestCase):
|
||||
"""
|
||||
Functional TestCityMerge
|
||||
"""
|
||||
def setUp(self) -> None:
|
||||
"""
|
||||
Test setup
|
||||
:return: None
|
||||
"""
|
||||
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
|
||||
|
||||
def _get_citygml(self, file):
|
||||
file_path = (self._example_path / file).resolve()
|
||||
city = GeometryFactory('citygml', file_path).city
|
||||
self.assertIsNotNone(city, 'city is none')
|
||||
return city
|
||||
|
||||
def test_merge(self):
|
||||
city_1 = self._get_citygml('one_building_in_kelowna.gml')
|
||||
city_2 = self._get_citygml('pluto_building.gml')
|
||||
city = city_1.merge(city_2)
|
||||
self.assertEqual(len(city_1.city_objects), 1, 'Wrong amount of city_objects found in city_1')
|
||||
self.assertEqual(len(city_2.city_objects), 1, 'Wrong amount of city_objects found in city_2')
|
||||
self.assertEqual(len(city.city_objects), 2, 'Wrong amount of city_objects found in city')
|
|
@ -47,8 +47,8 @@ class TestGeometryFactory(TestCase):
|
|||
for internal_zone in building.internal_zones:
|
||||
self.assertIsNotNone(internal_zone.usage_zones, 'usage zones are not defined')
|
||||
self.assertIsNotNone(internal_zone.thermal_zones, 'thermal zones are not defined')
|
||||
#self.assertIsNotNone(building.basement_heated, 'building basement_heated is none')
|
||||
#self.assertIsNotNone(building.attic_heated, 'building attic_heated is none')
|
||||
self.assertIsNotNone(building.basement_heated, 'building basement_heated is none')
|
||||
self.assertIsNotNone(building.attic_heated, 'building attic_heated is none')
|
||||
self.assertIsNotNone(building.average_storey_height, 'building average_storey_height is none')
|
||||
self.assertIsNotNone(building.storeys_above_ground, 'building storeys_above_ground is none')
|
||||
self.assertTrue(building.is_conditioned, 'building is_conditioned is not conditioned')
|
||||
|
|
Loading…
Reference in New Issue
Block a user