From e53c506e739a8d12815312f70c6264cf6da543b2 Mon Sep 17 00:00:00 2001 From: Mohamed_Osman Date: Mon, 28 Oct 2024 14:02:58 -0400 Subject: [PATCH] Select building based on height --- hub/data/construction/CERC_archetypes.json | 32 +++++++++---------- .../data/montreal_function_to_hub_function.py | 1 + hub/imports/geometry/geojson.py | 15 +++++++++ input_files/input_buildings.geojson | 2 +- main.py | 1 + 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/hub/data/construction/CERC_archetypes.json b/hub/data/construction/CERC_archetypes.json index 74001536..64ffa292 100644 --- a/hub/data/construction/CERC_archetypes.json +++ b/hub/data/construction/CERC_archetypes.json @@ -273,7 +273,7 @@ }, { "function": "MURB_HighRiseApartment", - "period_of_construction": "1950_1980", + "period_of_construction": "1951_1980", "climate_zone": "6", "average_storey_height": 3, "thermal_capacity": 300, @@ -282,7 +282,7 @@ "infiltration_rate_for_ventilation_system_off": 5.0, "constructions": { "OutdoorsWall": { - "opaque_surface_name": "1950_1980_6", + "opaque_surface_name": "1951_1980_6", "transparent_surface_name": "Window_1950_1980_6", "transparent_ratio": { "north": "30.0", @@ -292,7 +292,7 @@ } }, "OutdoorsRoofCeiling": { - "opaque_surface_name": "1950_1980_6", + "opaque_surface_name": "1951_1980_6", "transparent_surface_name": null, "transparent_ratio": { "north": null, @@ -302,23 +302,23 @@ } }, "OutdoorsFloor": { - "opaque_surface_name": "1950_1980_6" + "opaque_surface_name": "1951_1980_6" }, "GroundWall": { - "opaque_surface_name": "1950_1980_6" + "opaque_surface_name": "1951_1980_6" }, "GroundRoofCeiling": { - "opaque_surface_name": "1950_1980_6" + "opaque_surface_name": "1951_1980_6" }, "GroundFloor": { - "opaque_surface_name": "1950_1980_6" + "opaque_surface_name": "1951_1980_6" } } }, { "function": "MURB_HighRiseApartment", - "period_of_construction": "1980_2010", + "period_of_construction": "1981_2010", "climate_zone": "6", "average_storey_height": 3, "thermal_capacity": 300, @@ -327,8 +327,8 @@ "infiltration_rate_for_ventilation_system_off": 3.0, "constructions": { "OutdoorsWall": { - "opaque_surface_name": "1980_2010_6", - "transparent_surface_name": "Window_1980_2010_6", + "opaque_surface_name": "1981_2010_6", + "transparent_surface_name": "Window_1981_2010_6", "transparent_ratio": { "north": "30.0", "east": "5.0", @@ -337,7 +337,7 @@ } }, "OutdoorsRoofCeiling": { - "opaque_surface_name": "1980_2010_6", + "opaque_surface_name": "1981_2010_6", "transparent_surface_name": null, "transparent_ratio": { "north": null, @@ -347,16 +347,16 @@ } }, "OutdoorsFloor": { - "opaque_surface_name": "1980_2010_6" + "opaque_surface_name": "1981_2010_6" }, "GroundWall": { - "opaque_surface_name": "1980_2010_6" + "opaque_surface_name": "1981_2010_6" }, "GroundRoofCeiling": { - "opaque_surface_name": "1980_2010_6" + "opaque_surface_name": "1981_2010_6" }, "GroundFloor": { - "opaque_surface_name": "1980_2010_6" + "opaque_surface_name": "1981_2010_6" } } }, @@ -408,7 +408,7 @@ { "function": "MURB_HighRiseApartment", - "period_of_construction": "2020_3000", + "period_of_construction": "2021_3000", "climate_zone": "6", "average_storey_height": 3, "thermal_capacity": 300, diff --git a/hub/helpers/data/montreal_function_to_hub_function.py b/hub/helpers/data/montreal_function_to_hub_function.py index 16353dab..894888ab 100644 --- a/hub/helpers/data/montreal_function_to_hub_function.py +++ b/hub/helpers/data/montreal_function_to_hub_function.py @@ -33,6 +33,7 @@ class MontrealFunctionToHubFunction: '6911': cte.CONVENTION_CENTER, '9510': cte.RESIDENTIAL, '1990': cte.MID_RISE_APARTMENT, + '2100': cte.HIGH_RISE_APARTMENT, '1923': cte.NON_HEATED, '7222': cte.SPORTS_LOCATION, '5002': cte.STRIP_MALL, diff --git a/hub/imports/geometry/geojson.py b/hub/imports/geometry/geojson.py index 998a2298..37f52c5b 100644 --- a/hub/imports/geometry/geojson.py +++ b/hub/imports/geometry/geojson.py @@ -127,6 +127,10 @@ class Geojson: function = None if self._function_field is not None: function = str(feature['properties'][self._function_field]) + if function == '1000': + height = float(feature['properties'][self._extrusion_height_field]) + function = self._define_building_function(height, function) + if function == 'Mixed use' or function == 'mixed use': function_parts = [] if 'usages' in feature['properties']: @@ -350,3 +354,14 @@ class Geojson: building.add_alias(alias) building.volume = volume return building + + def _define_building_function(self, height, function): + if height < 10: + return '1100' + if height < 20 and height > 10: + return '1990' + if height > 20: + return '2100' + else: + return '1000' + \ No newline at end of file diff --git a/input_files/input_buildings.geojson b/input_files/input_buildings.geojson index 359eab69..ceec6131 100644 --- a/input_files/input_buildings.geojson +++ b/input_files/input_buildings.geojson @@ -81,7 +81,7 @@ "name": "01044604", "address": "rue Victor-Hugo (MTL) 1636", "function": "1000", - "height": 12, + "height": 22, "year_of_construction": 1986 } }, diff --git a/main.py b/main.py index ecac641b..6c209f46 100644 --- a/main.py +++ b/main.py @@ -27,6 +27,7 @@ city = GeometryFactory('geojson', function_field='function', function_to_hub=Dictionaries().montreal_function_to_hub_function).city # Enrich city data + ConstructionFactory('cerc', city).enrich() UsageFactory('cerc', city).enrich()