diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index ee5f86f3..2e0f385f 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -264,7 +264,10 @@ class Building(CityObject): for internal_zone in self.internal_zones: self._average_storey_height += internal_zone.mean_height / len(self.internal_zones) else: - self._average_storey_height = self.internal_zones[0].thermal_archetype.average_storey_height + if self.internal_zones[0].thermal_archetype is None: + self._average_storey_height = None + else: + self._average_storey_height = self.internal_zones[0].thermal_archetype.average_storey_height return self._average_storey_height @average_storey_height.setter diff --git a/hub/city_model_structure/building_demand/thermal_boundary.py b/hub/city_model_structure/building_demand/thermal_boundary.py index c3ee0128..66746037 100644 --- a/hub/city_model_structure/building_demand/thermal_boundary.py +++ b/hub/city_model_structure/building_demand/thermal_boundary.py @@ -38,7 +38,7 @@ class ThermalBoundary: self._thickness = None self._internal_surface = None self._external_surface = None - self._window_ratio = None + self._window_ratio = 0 self._window_ratio_to_be_calculated = False if self._windows_areas is not None: self._window_ratio_to_be_calculated = True diff --git a/tests/test_construction_factory.py b/tests/test_construction_factory.py index 49d93d7e..710894bd 100644 --- a/tests/test_construction_factory.py +++ b/tests/test_construction_factory.py @@ -10,7 +10,6 @@ from unittest import TestCase from hub.imports.geometry_factory import GeometryFactory from hub.imports.construction_factory import ConstructionFactory from hub.helpers.dictionaries import Dictionaries -import hub.helpers.constants as cte class TestConstructionFactory(TestCase): @@ -139,10 +138,7 @@ class TestConstructionFactory(TestCase): self.assertIsNotNone(thermal_boundary.thickness, 'thermal_boundary thickness is none') self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none') self.assertIsNotNone(thermal_boundary.thermal_openings, 'thermal_openings is none') - if thermal_boundary.type in (cte.WALL, cte.ROOF): - self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none') - else: - self.assertIsNone(thermal_boundary.window_ratio, 'window_ratio is not none') + self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none') self.assertIsNone(thermal_boundary.windows_areas, 'windows_areas is not none') self.assertIsNotNone(thermal_boundary.u_value, 'u_value is none') self.assertIsNotNone(thermal_boundary.hi, 'hi is none') diff --git a/tests/test_custom_insel_block.py b/tests/test_custom_insel_block.py index 1b46995d..25a8f942 100644 --- a/tests/test_custom_insel_block.py +++ b/tests/test_custom_insel_block.py @@ -128,11 +128,12 @@ class TestExports(TestCase): for thermal_boundary in thermal_zone.thermal_boundaries: self.assertIsNotNone(thermal_boundary.type) self.assertIsNotNone(thermal_boundary.opaque_area) - self.assertIsNotNone(thermal_boundary.window_ratio) + if thermal_boundary.type in (cte.WALL, cte.ROOF): + self.assertIsNotNone(thermal_boundary.window_ratio) self.assertIsNotNone(thermal_boundary.u_value) self.assertIsNotNone(thermal_boundary.thermal_openings) if thermal_boundary.type is not cte.GROUND: - self.assertIsNotNone(thermal_boundary.parent_surface.short_wave_reflectance) + self.assertIsNotNone(thermal_boundary.external_surface.short_wave_reflectance) for usage in internal_zone.usages: self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none') diff --git a/tests/test_geometry_factory.py b/tests/test_geometry_factory.py index 73d815ff..3b5bd8f8 100644 --- a/tests/test_geometry_factory.py +++ b/tests/test_geometry_factory.py @@ -62,7 +62,7 @@ class TestGeometryFactory(TestCase): self.assertIsNotNone(building.internal_zones, 'building internal zones is none') for internal_zone in building.internal_zones: self.assertIsNone(internal_zone.usages, 'usage zones are defined') - self.assertIsNone(internal_zone.thermal_zones_from_internal_zones, 'thermal zones are defined') + self.assertIsNone(internal_zone.thermal_archetype, 'thermal archetype is defined') self.assertIsNone(building.basement_heated, 'building basement_heated is not none') self.assertIsNone(building.attic_heated, 'building attic_heated is not none') self.assertIsNone(building.terrains, 'building terrains is not none') diff --git a/tests/test_insel_exports.py b/tests/test_insel_exports.py index 57604b07..f4422363 100644 --- a/tests/test_insel_exports.py +++ b/tests/test_insel_exports.py @@ -132,7 +132,7 @@ class TestExports(TestCase): self.assertIsNotNone(thermal_boundary.u_value) self.assertIsNotNone(thermal_boundary.thermal_openings) if thermal_boundary.type is not cte.GROUND: - self.assertIsNotNone(thermal_boundary.parent_surface.short_wave_reflectance) + self.assertIsNotNone(thermal_boundary.external_surface.short_wave_reflectance) for usage in internal_zone.usages: self.assertIsNotNone(usage.percentage, f'usage zone {usage.name} percentage is none')