From 49b4ce5ef23fa572645845ef7dd277d23db41156 Mon Sep 17 00:00:00 2001 From: Pilar Date: Tue, 17 Jan 2023 06:34:00 -0500 Subject: [PATCH] added a post-process in idf to erase windows associated to adiabatic walls --- exports/building_energy/idf.py | 16 ++++++++++++++-- imports/geometry/gpandas.py | 2 +- unittests/test_city_layers.py | 3 --- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/exports/building_energy/idf.py b/exports/building_energy/idf.py index 2644d00d..d65bf796 100644 --- a/exports/building_energy/idf.py +++ b/exports/building_energy/idf.py @@ -32,7 +32,7 @@ class Idf: _MATERIAL_NOMASS = 'MATERIAL:NOMASS' _MATERIAL_ROOFVEGETATION = 'MATERIAL:ROOFVEGETATION' - _WINDOW = 'WINDOW' + _WINDOW = 'FENESTRATIONSURFACE:DETAILED' _WINDOW_MATERIAL_SIMPLE = 'WINDOWMATERIAL:SIMPLEGLAZINGSYSTEM' _ROUGHNESS = 'MediumRough' _INFILTRATION = 'ZONEINFILTRATION:DESIGNFLOWRATE' @@ -100,7 +100,6 @@ class Idf: self._adjacent_buildings = [] self._export() - @staticmethod def _matrix_to_list(points, lower_corner): lower_x = lower_corner[0] @@ -428,6 +427,19 @@ class Idf: except IndexError: # seems to be a bug from geomeppy when surfaces cannot be intersected pass + + # post-process to erase windows associated to adiabatic walls + windows_list = [] + for window in self._idf.idfobjects[self._WINDOW]: + found = False + for surface in self._idf.idfobjects[self._SURFACE]: + if window.Building_Surface_Name == surface.Name: + found = True + if not found: + windows_list.append(window) + for window in windows_list: + self._idf.removeidfobject(window) + self._idf.saveas(str(self._output_file)) return self._idf diff --git a/imports/geometry/gpandas.py b/imports/geometry/gpandas.py index 57d105f8..f953d74d 100644 --- a/imports/geometry/gpandas.py +++ b/imports/geometry/gpandas.py @@ -64,7 +64,7 @@ class GPandas: trimesh.repair.fill_holes(building_mesh) trimesh.repair.fix_winding(building_mesh) year_of_construction = int(bldg['year_built']) - name = str(scene_index) + name = bldg['name'] lod = 1 if year_of_construction > 2000: function = cte.RESIDENTIAL diff --git a/unittests/test_city_layers.py b/unittests/test_city_layers.py index 92f4d08b..153515fb 100644 --- a/unittests/test_city_layers.py +++ b/unittests/test_city_layers.py @@ -65,9 +65,6 @@ class CityLayerTest(TestCase): city = GeometryFactory('gpandas', data_frame=buildings_df).city ConstructionFactory('nrel', city).enrich() UsageFactory('comnet', city).enrich() - print(target_buildings, adjacent_buildings) - for building in city.buildings: - print(building.name) EnergyBuildingsExportsFactory('idf', city, output_path, target_buildings=target_buildings, adjacent_buildings=adjacent_buildings).export_debug() filepath = os.path.join(output_path, city.name + ".idf")