From d5565530c1a157eb8ac2eb813e9e4ea49d947096 Mon Sep 17 00:00:00 2001 From: guille Date: Tue, 26 Apr 2022 19:41:00 -0400 Subject: [PATCH] Merge initial version for Catalogs as factories data sources --- .../construction/construction_helpers.py | 3 ++- catalog_factories/construction/nrel_catalog.py | 2 -- .../data_models/construction/archetype.py | 10 ---------- data/construction/us_archetypes.xml | 18 +++++++----------- data/construction/us_constructions.xml | 4 ++-- imports/geometry/helpers/geometry_helper.py | 3 ++- unittests/test_doe_idf.py | 4 ++-- unittests/test_schedules_factory.py | 1 + 8 files changed, 16 insertions(+), 29 deletions(-) diff --git a/catalog_factories/construction/construction_helpers.py b/catalog_factories/construction/construction_helpers.py index 805772c8..b19cfc3d 100644 --- a/catalog_factories/construction/construction_helpers.py +++ b/catalog_factories/construction/construction_helpers.py @@ -18,7 +18,8 @@ nrel_to_function = { 'quick service restaurant': cte.QUICK_SERVICE_RESTAURANT, 'full service restaurant': cte.FULL_SERVICE_RESTAURANT, 'small hotel': cte.SMALL_HOTEL, - 'large hotel': cte.LARGE_HOTEL + 'large hotel': cte.LARGE_HOTEL, + 'industry': cte.INDUSTRY } nrcan_to_function = { diff --git a/catalog_factories/construction/nrel_catalog.py b/catalog_factories/construction/nrel_catalog.py index 72939b4f..99752162 100644 --- a/catalog_factories/construction/nrel_catalog.py +++ b/catalog_factories/construction/nrel_catalog.py @@ -116,7 +116,6 @@ class NrelCatalog(Catalog): climate_zone = archetype['@climate_zone'] construction_period = reference_standard_to_construction_period[archetype['@reference_standard']] average_storey_height = archetype['average_storey_height']['#text'] - number_of_storeys = archetype['number_of_storeys']['#text'] thermal_capacity = archetype['thermal_capacity']['#text'] extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_to_thermal_bridges']['#text'] indirect_heated_ratio = archetype['indirect_heated_ratio']['#text'] @@ -151,7 +150,6 @@ class NrelCatalog(Catalog): construction_period, archetype_constructions, average_storey_height, - number_of_storeys, thermal_capacity, extra_loses_due_to_thermal_bridges, indirect_heated_ratio, diff --git a/catalog_factories/data_models/construction/archetype.py b/catalog_factories/data_models/construction/archetype.py index 3468864c..7249c075 100644 --- a/catalog_factories/data_models/construction/archetype.py +++ b/catalog_factories/data_models/construction/archetype.py @@ -16,7 +16,6 @@ class Archetype: construction_period, constructions, average_storey_height, - number_of_storeys, thermal_capacity, extra_loses_due_to_thermal_bridges, indirect_heated_ratio, @@ -29,7 +28,6 @@ class Archetype: self._construction_period = construction_period self._constructions = constructions self._average_storey_height = average_storey_height - self._number_of_storeys = number_of_storeys self._thermal_capacity = thermal_capacity self._extra_loses_due_to_thermal_bridges = extra_loses_due_to_thermal_bridges self._indirect_heated_ratio = indirect_heated_ratio @@ -92,14 +90,6 @@ class Archetype: """ return self._average_storey_height - @property - def number_of_storeys(self): - """ - Get archetype number of storeys - :return: int - """ - return self._number_of_storeys - @property def thermal_capacity(self): """ diff --git a/data/construction/us_archetypes.xml b/data/construction/us_archetypes.xml index abaf0e9e..629feb8c 100644 --- a/data/construction/us_archetypes.xml +++ b/data/construction/us_archetypes.xml @@ -16,7 +16,6 @@ 3.05 - 2 130 0.15 0.15 @@ -173,7 +172,6 @@ 6.1 - 1 130 0.15 0.15 @@ -394,7 +392,6 @@ 3.05 - 2 130 0.05 0.15 @@ -549,7 +546,6 @@ 6.1 - 1 130 0.05 0.15 @@ -798,7 +794,7 @@ 0.50 0 - + 0.15 @@ -813,11 +809,11 @@ - - - - - - + 3.05 + 90 + 0.05 + 0.15 + 0.10 + 0 diff --git a/data/construction/us_constructions.xml b/data/construction/us_constructions.xml index d1c298b3..6873186c 100644 --- a/data/construction/us_constructions.xml +++ b/data/construction/us_constructions.xml @@ -716,7 +716,7 @@ - + 105 @@ -797,7 +797,7 @@ - + 105 diff --git a/imports/geometry/helpers/geometry_helper.py b/imports/geometry/helpers/geometry_helper.py index 17504da5..79f36fc3 100644 --- a/imports/geometry/helpers/geometry_helper.py +++ b/imports/geometry/helpers/geometry_helper.py @@ -251,7 +251,8 @@ class GeometryHelper: cte.QUICK_SERVICE_RESTAURANT: cte.RESTAURANT, cte.FULL_SERVICE_RESTAURANT: cte.RESTAURANT, cte.SMALL_HOTEL: cte.HOTEL, - cte.LARGE_HOTEL: cte.HOTEL + cte.LARGE_HOTEL: cte.HOTEL, + cte.INDUSTRY:cte.INDUSTRY } @staticmethod diff --git a/unittests/test_doe_idf.py b/unittests/test_doe_idf.py index a771986e..b7eddcf7 100644 --- a/unittests/test_doe_idf.py +++ b/unittests/test_doe_idf.py @@ -25,7 +25,7 @@ class TestBuildings(TestCase): self._example_path = (Path(__file__).parent / 'tests_data').resolve() def test_doe_idf(self): - city_file = "../unittests/tests_data/C40_Final.gml" + city_file = "../unittests/tests_data/one_building_in_kelowna.gml" output_path = Path('../unittests/tests_outputs/').resolve() city = GeometryFactory('citygml', city_file).city for building in city.buildings: @@ -34,7 +34,7 @@ class TestBuildings(TestCase): UsageFactory('comnet', city).enrich() ExportsFactory('idf', city, output_path).export() - self.assertEqual(10, len(city.buildings)) + self.assertEqual(1, len(city.buildings)) for building in city.buildings: for internal_zone in building.internal_zones: self.assertTrue(len(internal_zone.usage_zones) > 0) diff --git a/unittests/test_schedules_factory.py b/unittests/test_schedules_factory.py index da90168e..85a3c45d 100644 --- a/unittests/test_schedules_factory.py +++ b/unittests/test_schedules_factory.py @@ -35,6 +35,7 @@ class TestSchedulesFactory(TestCase): self.assertIsNotNone(_city, 'city is none') for building in _city.buildings: building.function = GeometryHelper.libs_function_from_hft(building.function) + building.year_of_construction = 2005 UsageFactory('hft', _city).enrich() return _city