From 915170e60f6fbb36e39ae1bdb0eb4831370f3191 Mon Sep 17 00:00:00 2001 From: guille Date: Thu, 27 Jun 2024 16:22:57 +0200 Subject: [PATCH] Bugfix: now surfaces has associated thermal boundaries after construction factory --- hub/city_model_structure/building_demand/surface.py | 2 +- hub/imports/construction_factory.py | 2 ++ tests/test_exports.py | 2 +- tests/test_geometry_factory.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hub/city_model_structure/building_demand/surface.py b/hub/city_model_structure/building_demand/surface.py index 2cd42755..ab27ffe8 100644 --- a/hub/city_model_structure/building_demand/surface.py +++ b/hub/city_model_structure/building_demand/surface.py @@ -42,7 +42,7 @@ class Surface: self._short_wave_reflectance = None self._long_wave_emittance = None self._inverse = None - self._associated_thermal_boundaries = [] + self._associated_thermal_boundaries = None self._vegetation = None self._percentage_shared = None self._solar_collectors_area_reduction_factor = None diff --git a/hub/imports/construction_factory.py b/hub/imports/construction_factory.py index 38019b66..dcf8b054 100644 --- a/hub/imports/construction_factory.py +++ b/hub/imports/construction_factory.py @@ -54,3 +54,5 @@ class ConstructionFactory: :return: None """ getattr(self, self._handler, lambda: None)() + for building in self._city.buildings: + _ = building.thermal_zones_from_internal_zones # ensure internal zones initialization diff --git a/tests/test_exports.py b/tests/test_exports.py index 8f5204a9..ab3943f7 100644 --- a/tests/test_exports.py +++ b/tests/test_exports.py @@ -144,6 +144,6 @@ class TestExports(TestCase): UsageFactory('nrcan', city).enrich() WeatherFactory('epw', city).enrich() try: - EnergyBuildingsExportsFactory('idf', city, self._output_path).export() + EnergyBuildingsExportsFactory('idf', city, self._output_path, target_buildings=[1]).export() except Exception: self.fail("Idf ExportsFactory raised ExceptionType unexpectedly!") diff --git a/tests/test_geometry_factory.py b/tests/test_geometry_factory.py index 3b5bd8f8..d436851c 100644 --- a/tests/test_geometry_factory.py +++ b/tests/test_geometry_factory.py @@ -93,7 +93,7 @@ class TestGeometryFactory(TestCase): self.assertIsNone(surface.short_wave_reflectance, 'surface short_wave_reflectance is not none') self.assertIsNone(surface.long_wave_emittance, 'surface long_wave_emittance is not none') self.assertIsNotNone(surface.inverse, 'surface inverse is none') - self.assertEqual(len(surface.associated_thermal_boundaries), 0, 'associated_thermal_boundaries are assigned') + self.assertIsNone(surface.associated_thermal_boundaries, 'associated_thermal_boundaries are assigned') self.assertIsNone(surface.vegetation, 'surface vegetation is not none') # citygml_classes