Correct errors in simplified radiosity algorithm export

This commit is contained in:
Guille Gutierrez 2021-04-14 10:22:29 -04:00
parent 146162165f
commit 35667ab083
4 changed files with 20 additions and 12 deletions

View File

@ -19,6 +19,7 @@ class Surface:
self._type = surface_type self._type = surface_type
self._swr = swr self._swr = swr
self._name = None self._name = None
self._id = None
self._azimuth = None self._azimuth = None
self._inclination = None self._inclination = None
self._area_above_ground = None self._area_above_ground = None
@ -39,7 +40,7 @@ class Surface:
:return: str :return: str
""" """
if self._name is None: if self._name is None:
self._name = uuid.uuid4() self._name = str(uuid.uuid4())
return self._name return self._name
@property @property
@ -48,7 +49,11 @@ class Surface:
Surface id Surface id
:return str :return str
""" """
return str(self.name)[:8] if self._id is None:
self._id = self.name.replace('-', '').replace('a', '').replace('b', '').replace('c', '').replace('d', '')
self._id = self._id.replace('e', '').replace('f', '')
print(self._id)
return self._id
@property @property
def swr(self): def swr(self):

View File

@ -41,19 +41,18 @@ class SimplifiedRadiosityAlgorithm:
'@ShortWaveReflectance': f'{surface.swr}' '@ShortWaveReflectance': f'{surface.swr}'
} }
for point_index, point in enumerate(surface.perimeter_polygon.points): for point_index, point in enumerate(surface.perimeter_polygon.points):
# todo: check corrected points
point = self._correct_point(point) point = self._correct_point(point)
surface_dict[f'V{point_index}'] = { surface_dict[f'V{point_index}'] = {
'@x': f'{point[0]}', '@x': f'{point[0]}',
'@y': f'{point[1]}', '@y': f'{point[1]}',
'@z': f'{point[2]}' '@z': f'{point[2]}'
} }
if surface.type == 'Wall': if surface.type == 'Wall':
walls.append(surface_dict) walls.append(surface_dict)
elif surface.type == 'Roof': elif surface.type == 'Roof':
roofs.append(surface_dict) roofs.append(surface_dict)
else: else:
floors.append(surface_dict) floors.append(surface_dict)
building_dict['Wall'] = walls building_dict['Wall'] = walls
building_dict['Roof'] = roofs building_dict['Roof'] = roofs
building_dict['Floor'] = floors building_dict['Floor'] = floors

View File

@ -9,3 +9,6 @@ geomeppy~=0.11.8
open3d~=0.12.0 open3d~=0.12.0
pathlib~=1.0.1 pathlib~=1.0.1
PyWavefront~=1.3.3 PyWavefront~=1.3.3
xlrd~=2.0.1
openpyxl~=3.0.7
networkx~=2.5.1

View File

@ -38,9 +38,10 @@ class TestExports(TestCase):
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli' cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
self._city_gml.climate_file = Path(cli) self._city_gml.climate_file = Path(cli)
self._city_gml.climate_reference_city = 'Summerland' self._city_gml.climate_reference_city = 'Summerland'
dummy_measures = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
for building in self._city_gml.buildings: for building in self._city_gml.buildings:
building.heating['month'] = pd.DataFrame({'INSEL': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}) building.heating['month'] = pd.DataFrame({'INSEL': dummy_measures})
building.cooling['month'] = pd.DataFrame({'INSEL': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}) building.cooling['month'] = pd.DataFrame({'INSEL': dummy_measures})
building.heating['year'] = pd.DataFrame({'INSEL': [0.0]}) building.heating['year'] = pd.DataFrame({'INSEL': [0.0]})
building.cooling['year'] = pd.DataFrame({'INSEL': [0.0]}) building.cooling['year'] = pd.DataFrame({'INSEL': [0.0]})
return self._city_gml return self._city_gml