forked from s_ranjbar/city_retrofit
modified the exports_factory.py and related files to add the building list to be calculated with SRA.
This commit is contained in:
parent
0b2a70f8ae
commit
c12643d1dd
|
@ -16,10 +16,11 @@ class ExportsFactory:
|
|||
"""
|
||||
Exports factory class
|
||||
"""
|
||||
def __init__(self, export_type, city, path):
|
||||
def __init__(self, export_type, city, path, target_buildings=None):
|
||||
self._city = city
|
||||
self._export_type = '_' + export_type.lower()
|
||||
self._path = path
|
||||
self._target_buildings = target_buildings
|
||||
|
||||
@property
|
||||
def _citygml(self):
|
||||
|
@ -65,7 +66,7 @@ class ExportsFactory:
|
|||
def _idf(self):
|
||||
"""
|
||||
Export the city to Energy+ idf format
|
||||
:return:
|
||||
:return: None
|
||||
"""
|
||||
idf_data_path = (Path(__file__).parent / './formats/idf_files/').resolve()
|
||||
# todo: create a get epw file function based on the city
|
||||
|
@ -74,7 +75,12 @@ class ExportsFactory:
|
|||
|
||||
@property
|
||||
def _sra(self):
|
||||
return SimplifiedRadiosityAlgorithm(self._city, (self._path / f'{self._city.name}_sra.xml'))
|
||||
"""
|
||||
Export the city to Simplified Radiosity Algorithm xml format
|
||||
:return: None
|
||||
"""
|
||||
return SimplifiedRadiosityAlgorithm(self._city, (self._path / f'{self._city.name}_sra.xml'),
|
||||
target_buildings=self._target_buildings)
|
||||
|
||||
def export(self):
|
||||
"""
|
||||
|
|
|
@ -10,13 +10,14 @@ class SimplifiedRadiosityAlgorithm:
|
|||
"""
|
||||
Export to SRA format
|
||||
"""
|
||||
def __init__(self, city, file_name, begin_month=1, begin_day=1, end_month=12, end_day=31):
|
||||
def __init__(self, city, file_name, target_buildings=None, begin_month=1, begin_day=1, end_month=12, end_day=31):
|
||||
self._file_name = file_name
|
||||
self._begin_month = begin_month
|
||||
self._begin_day = begin_day
|
||||
self._end_month = end_month
|
||||
self._end_day = end_day
|
||||
self._city = city
|
||||
self._target_buildings = target_buildings
|
||||
self._export()
|
||||
|
||||
def _correct_point(self, point):
|
||||
|
@ -26,15 +27,15 @@ class SimplifiedRadiosityAlgorithm:
|
|||
z = point[2] - self._city.lower_corner[2]
|
||||
return [x, y, z]
|
||||
|
||||
def _export(self, target_buildings_names=None):
|
||||
def _export(self):
|
||||
buildings = []
|
||||
for building_index, building in enumerate(self._city.buildings):
|
||||
if target_buildings_names is None:
|
||||
if self._target_buildings is None:
|
||||
simulate = 'true'
|
||||
else:
|
||||
simulate = 'false'
|
||||
for name in target_buildings_names:
|
||||
if building.name == name:
|
||||
for target_building in self._target_buildings:
|
||||
if building.name == target_building.name:
|
||||
simulate = 'true'
|
||||
building_dict = {
|
||||
'@Name': f'{building.name}',
|
||||
|
|
Loading…
Reference in New Issue
Block a user