def load_gml(path, prj): '''This function loads buildings from a CityGML file Parameters ---------- path: string path of CityGML file prj: Project() Teaser instance of Project() ''' xml_file = open(path, 'r') gml_bind = citygml.CreateFromDocument(xml_file.read()) for i, city_object in enumerate(gml_bind.featureMember): if city_object.Feature.consistsOfBuildingPart: for part in city_object.Feature.consistsOfBuildingPart: if part.BuildingPart.function: if part.BuildingPart.function[0].value() == "1000": bldg = SingleFamilyDwelling(parent=prj, name=part.BuildingPart.id) elif part.BuildingPart.function[0].value() == "1120": bldg = Office(parent=prj, name=part.BuildingPart.id) else: bldg = Building(parent=prj, name=part.BuildingPart.id) else: bldg = Building(parent=prj, name=part.BuildingPart.id) _create_building_part(bldg=bldg, part=part) _set_attributes(bldg=bldg, gml_bldg=part.BuildingPart) bldg.set_height_gml() else: if city_object.Feature.function: if city_object.Feature.function[0].value() == "1000": bldg = SingleFamilyDwelling(parent=prj, name=city_object.Feature.id) elif city_object.Feature.function[0].value() == "1120": bldg = Office(parent=prj, name=city_object.Feature.id) else: bldg = Building(parent=prj, name=city_object.Feature.id) else: bldg = Building(parent=prj, name=city_object.Feature.id) _create_building(bldg=bldg, city_object=city_object) _set_attributes(bldg=bldg, gml_bldg=city_object.Feature) bldg.set_height_gml() try: bldg.set_gml_attributes() except: pass
def type_bldg_residential( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu=False, residential_layout=None, neighbour_buildings=None, attic=None, cellar=None, dormer=None, construction_type=None): """Old function, consider rewriting your code This is an old function for archetype generation, consider rewriting your code to use Project.add_non_residential(). This function will be eliminated within the next versions """ warnings.warn("You are using an old function for archetype " "generation, consider rewriting you code to use " "Project.add_residential(). This function will be " "eliminated within the next versions") type_bldg = SingleFamilyDwelling( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, residential_layout, neighbour_buildings, attic, cellar, dormer, construction_type) type_bldg.generate_archetype() type_bldg.calc_building_parameter( number_of_elements=self._number_of_elements_calc, merge_windows=self._merge_windows_calc, used_library=self._used_library_calc) return type_bldg
def type_bldg_residential(self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu=False, residential_layout=None, neighbour_buildings=None, attic=None, cellar=None, dormer=None, construction_type=None): '''Create and calculate an residential building Parameters ---------- name : str individual name year_of_construction : int year of first construction number_of_floors : int number of floors above ground height_of_floors : float average height of the floors net_leased_area : float total net leased area of building with_ahu : boolean if building has a central AHU or not residential_layout : int type of floor plan (default = 0) 0: compact 1: elongated/complex neighbour_buildings : int neighbour (default = 0) 0: no neighbour 1: one neighbour 2: two neighbours attic : int type of attic (default = 0) 0: flat roof 1: non heated attic 2: partly heated attic 3: heated attic cellar : int type of cellar (default = 0) 0: no cellar 1: non heated cellar 2: partly heated cellar 3: heated cellar construction_type : str construction type (default = "heavy") heavy: heavy construction light: light construction dormer : str construction type 0: no dormer 1: dormer Returns ---------- type_bldg : Instance of SingleFamilyDwelling() ''' type_bldg = SingleFamilyDwelling(self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, residential_layout, neighbour_buildings, attic, cellar, dormer, construction_type) type_bldg.generate_archetype() type_bldg.calc_building_parameter( number_of_elements=self._number_of_elements_calc, merge_windows=self._merge_windows_calc, used_library=self._used_library_calc) return type_bldg
def _load_building(prj, pyxb_bld, type, project_bind): if type == "Building": bldg = Building(prj) elif type == "Office": bldg = Office(prj) elif type == "Institute": bldg = Institute(prj) elif type == "Institute4": bldg = Institute4(prj) elif type == "Institute8": bldg = Institute8(prj) elif type == "Residential": bldg = SingleFamilyDwelling(prj) bldg.name = pyxb_bld.name bldg.street_name = pyxb_bld.street_name bldg.city = pyxb_bld.city bldg.type_of_building = pyxb_bld.type_of_building bldg.year_of_construction = pyxb_bld.year_of_construction bldg.year_of_retrofit = pyxb_bld.year_of_retrofit bldg.number_of_floors = pyxb_bld.number_of_floors bldg.height_of_floors = pyxb_bld.height_of_floors if not pyxb_bld.ThermalZone: bldg.net_leased_area = pyxb_bld.net_leased_area if pyxb_bld.CentralAHU: pyxb_ahu = pyxb_bld.CentralAHU bldg.central_ahu = BuildingAHU(bldg) bldg.central_ahu.heating = pyxb_ahu.heating bldg.central_ahu.cooling = pyxb_ahu.cooling bldg.central_ahu.dehumidification = pyxb_ahu.dehumidification bldg.central_ahu.humidification = pyxb_ahu.humidification bldg.central_ahu.heat_recovery = pyxb_ahu.heat_recovery bldg.central_ahu.by_pass_dehumidification = \ pyxb_ahu.by_pass_dehumidification bldg.central_ahu.efficiency_recovery = pyxb_ahu.efficiency_recovery try: if float(project_bind.version) >= 0.5: bldg.central_ahu.efficiency_recovery_false = \ pyxb_ahu.efficiency_recovery_false else: bldg.central_ahu.efficiency_recovery_false = \ pyxb_ahu.efficiency_revocery_false except AttributeError: bldg.central_ahu.efficiency_recovery_false = \ pyxb_ahu.efficiency_revocery_false bldg.central_ahu.profile_min_relative_humidity = \ pyxb_ahu.profile_min_relative_humidity bldg.central_ahu.profile_max_relative_humidity = \ pyxb_ahu.profile_max_relative_humidity bldg.central_ahu.profile_v_flow = \ pyxb_ahu.profile_v_flow bldg.central_ahu.profile_temperature = \ pyxb_ahu.profile_temperature for pyxb_zone in pyxb_bld.ThermalZone: zone = ThermalZone(bldg) zone.name = pyxb_zone.name zone.area = pyxb_zone.area zone.volume = pyxb_zone.volume zone.infiltration_rate = pyxb_zone.infiltration_rate zone.use_conditions = BoundaryConditions(zone) pyxb_use = pyxb_zone.UseCondition.BoundaryConditions zone.use_conditions.typical_length = pyxb_zone.typical_length zone.use_conditions.typical_width = pyxb_zone.typical_width zone.use_conditions.usage = \ pyxb_use.usage zone.use_conditions.usage_time = \ pyxb_use.UsageOperationTime.usage_time zone.use_conditions.daily_usage_hours = \ pyxb_use.UsageOperationTime.daily_usage_hours zone.use_conditions.yearly_usage_days = \ pyxb_use.UsageOperationTime.yearly_usage_days zone.use_conditions.yearly_usage_hours_day = \ pyxb_use.UsageOperationTime.yearly_usage_hours_day zone.use_conditions.yearly_usage_hours_night = \ pyxb_use.UsageOperationTime.yearly_usage_hours_night zone.use_conditions.daily_operation_ahu_cooling = \ pyxb_use.UsageOperationTime.daily_operation_ahu_cooling zone.use_conditions.yearly_heating_days = \ pyxb_use.UsageOperationTime.yearly_heating_days zone.use_conditions.yearly_ahu_days = \ pyxb_use.UsageOperationTime.yearly_ahu_days zone.use_conditions.yearly_cooling_days = \ pyxb_use.UsageOperationTime.yearly_cooling_days zone.use_conditions.daily_operation_heating = \ pyxb_use.UsageOperationTime.daily_operation_heating try: if float(project_bind.version) >= 0.4: zone.use_conditions.maintained_illuminance = \ pyxb_use.Lighting.maintained_illuminance else: zone.use_conditions.maintained_illuminance = \ pyxb_use.Lighting.maintained_illuminace except AttributeError: zone.use_conditions.maintained_illuminance = \ pyxb_use.Lighting.maintained_illuminace zone.use_conditions.usage_level_height = \ pyxb_use.Lighting.usage_level_height zone.use_conditions.red_factor_visual = \ pyxb_use.Lighting.red_factor_visual zone.use_conditions.rel_absence = \ pyxb_use.Lighting.rel_absence zone.use_conditions.room_index = \ pyxb_use.Lighting.room_index zone.use_conditions.part_load_factor_lighting = \ pyxb_use.Lighting.part_load_factor_lighting zone.use_conditions.ratio_conv_rad_lighting = \ pyxb_use.Lighting.ratio_conv_rad_lighting zone.use_conditions.set_temp_heat = \ pyxb_use.RoomClimate.set_temp_heat zone.use_conditions.set_temp_cool = \ pyxb_use.RoomClimate.set_temp_cool zone.use_conditions.temp_set_back = \ pyxb_use.RoomClimate.temp_set_back zone.use_conditions.min_temp_heat = \ pyxb_use.RoomClimate.min_temp_heat zone.use_conditions.max_temp_cool = \ pyxb_use.RoomClimate.max_temp_cool zone.use_conditions.rel_humidity = \ pyxb_use.RoomClimate.rel_humidity zone.use_conditions.cooling_time = \ pyxb_use.RoomClimate.cooling_time zone.use_conditions.heating_time = \ pyxb_use.RoomClimate.heating_time zone.use_conditions.min_air_exchange = \ pyxb_use.RoomClimate.min_air_exchange zone.use_conditions.rel_absence_ahu = \ pyxb_use.RoomClimate.rel_absence_ahu zone.use_conditions.part_load_factor_ahu = \ pyxb_use.RoomClimate.part_load_factor_ahu zone.use_conditions.persons = \ pyxb_use.InternalGains.persons zone.use_conditions.profile_persons = \ pyxb_use.InternalGains.profile_persons zone.use_conditions.machines = \ pyxb_use.InternalGains.machines zone.use_conditions.profile_machines = \ pyxb_use.InternalGains.profile_machines zone.use_conditions.lighting_power = \ pyxb_use.InternalGains.lighting_power zone.use_conditions.profile_lighting = \ pyxb_use.InternalGains.profile_lighting zone.use_conditions.min_ahu = \ pyxb_use.AHU.min_ahu zone.use_conditions.max_ahu = \ pyxb_use.AHU.max_ahu zone.use_conditions.with_ahu = \ pyxb_use.AHU.with_ahu zone.use_constant_ach_rate = \ pyxb_use.AHU.use_constant_ach_rate zone.base_ach = \ pyxb_use.AHU.base_ach zone.max_user_ach = \ pyxb_use.AHU.max_user_ach zone.max_overheating_ach = \ pyxb_use.AHU.max_overheating_ach zone.max_summer_ach = \ pyxb_use.AHU.max_summer_ach zone.winter_reduction = \ pyxb_use.AHU.winter_reduction for pyxb_wall in pyxb_zone.OuterWall: out_wall = OuterWall(zone) set_basic_data_teaser(pyxb_wall, out_wall) set_layer_data_teaser(pyxb_wall, out_wall) try: if float(project_bind.version) >= 0.6: for pyxb_wall in pyxb_zone.Door: out_wall = Door(zone) set_basic_data_teaser(pyxb_wall, out_wall) set_layer_data_teaser(pyxb_wall, out_wall) except AttributeError: pass for pyxb_wall in pyxb_zone.Rooftop: roof = Rooftop(zone) set_basic_data_teaser(pyxb_wall, roof) set_layer_data_teaser(pyxb_wall, roof) # zone.outer_walls.append(roof) for pyxb_wall in pyxb_zone.GroundFloor: gr_floor = GroundFloor(zone) set_basic_data_teaser(pyxb_wall, gr_floor) set_layer_data_teaser(pyxb_wall, gr_floor) # zone.outer_walls.append(gr_floor) for pyxb_wall in pyxb_zone.InnerWall: in_wall = InnerWall(zone) set_basic_data_teaser(pyxb_wall, in_wall) set_layer_data_teaser(pyxb_wall, in_wall) # zone.inner_walls.append(in_wall) for pyxb_wall in pyxb_zone.Ceiling: ceiling = Ceiling(zone) set_basic_data_teaser(pyxb_wall, ceiling) set_layer_data_teaser(pyxb_wall, ceiling) # zone.inner_walls.append(ceiling) for pyxb_wall in pyxb_zone.Floor: floor = Floor(zone) set_basic_data_teaser(pyxb_wall, floor) set_layer_data_teaser(pyxb_wall, floor) # zone.inner_walls.append(floor) for pyxb_win in pyxb_zone.Window: win = Window(zone) set_basic_data_teaser(pyxb_win, win) set_layer_data_teaser(pyxb_win, win)
def test_type_bldg_residential_with_calc(self): ''' Verification of the type building generation of an office building. Values are compared with TEASER3 values. ''' from teaser.logic.archetypebuildings.bmvbs.singlefamilydwelling import \ SingleFamilyDwelling prj.set_default() test_residential = SingleFamilyDwelling(parent=prj, name="TestBuilding", year_of_construction=1988, number_of_floors=3, height_of_floors=3, net_leased_area=2500) test_residential.generate_archetype() #general parameters assert len(test_residential.thermal_zones) == 1 #zone specific parameters for zone in test_residential.thermal_zones: if zone.name == "SingleDwelling": assert zone.area == 2500 #facade specific parameters assert round(test_residential.get_outer_wall_area(-2), 0) == 1108 assert round(test_residential.get_outer_wall_area(-1), 0) == 1108 assert round(test_residential.get_outer_wall_area(0), 0) == 325 assert round(test_residential.get_outer_wall_area(180), 0) == 325 assert round(test_residential.get_outer_wall_area(90), 0) == 325 assert round(test_residential.get_outer_wall_area(270), 0) == 325 assert round(test_residential.get_window_area(0), 0) == 125 assert round(test_residential.get_window_area(180), 0) == 125 assert round(test_residential.get_window_area(90), 0) == 125 assert round(test_residential.get_window_area(270), 0) == 125 prj.set_default() test_residential = SingleFamilyDwelling(parent=prj, name="TestBuilding", year_of_construction=1988, number_of_floors=3, height_of_floors=3, net_leased_area=2500, residential_layout=1, neighbour_buildings=1, attic=1, dormer=1, cellar=1, construction_type="light") test_residential.generate_archetype() #facade specific parameters assert round(test_residential.get_outer_wall_area(-2), 0) == 1108 assert round(test_residential.get_outer_wall_area(-1), 0) == 1108 assert round(test_residential.get_outer_wall_area(0), 0) == 398 assert round(test_residential.get_outer_wall_area(180), 0) == 398 assert round(test_residential.get_outer_wall_area(90), 0) == 398 assert round(test_residential.get_outer_wall_area(270), 0) == 398 assert round(test_residential.get_window_area(0), 0) == 125 assert round(test_residential.get_window_area(180), 0) == 125 assert round(test_residential.get_window_area(90), 0) == 125 assert round(test_residential.get_window_area(270), 0) == 125 prj.set_default() test_residential = SingleFamilyDwelling(parent=prj, name="TestBuilding", year_of_construction=1988, number_of_floors=3, height_of_floors=3, net_leased_area=2500, residential_layout=0, neighbour_buildings=2, attic=2, dormer=0, cellar=2, construction_type="heavy") test_residential.generate_archetype() #facade specific parameters assert round(test_residential.get_outer_wall_area(-2), 0) == 858 assert round(test_residential.get_outer_wall_area(-1), 0) == 484 assert round(test_residential.get_outer_wall_area(0), 0) == 270 assert round(test_residential.get_outer_wall_area(180), 0) == 270 assert round(test_residential.get_outer_wall_area(90), 0) == 270 assert round(test_residential.get_outer_wall_area(270), 0) == 270 assert round(test_residential.get_window_area(0), 0) == 125 assert round(test_residential.get_window_area(180), 0) == 125 assert round(test_residential.get_window_area(90), 0) == 125 assert round(test_residential.get_window_area(270), 0) == 125 prj.set_default() test_residential = SingleFamilyDwelling(parent=prj, name="TestBuilding", year_of_construction=1988, number_of_floors=3, height_of_floors=3, net_leased_area=2500, residential_layout=0, neighbour_buildings=2, attic=3, dormer=0, cellar=3, construction_type="light") test_residential.generate_archetype() #facade specific parameters assert round(test_residential.get_outer_wall_area(-2), 0) == 700 assert round(test_residential.get_outer_wall_area(-1), 0) == 789 assert round(test_residential.get_outer_wall_area(0), 0) == 255 assert round(test_residential.get_outer_wall_area(180), 0) == 255 assert round(test_residential.get_outer_wall_area(90), 0) == 255 assert round(test_residential.get_outer_wall_area(270), 0) == 255 assert round(test_residential.get_window_area(0), 0) == 125 assert round(test_residential.get_window_area(180), 0) == 125 assert round(test_residential.get_window_area(90), 0) == 125 assert round(test_residential.get_window_area(270), 0) == 125
def add_residential( self, method, usage, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu=False, residential_layout=None, neighbour_buildings=None, attic=None, cellar=None, dormer=None, construction_type=None, number_of_apartments=None): """Adds a residential building to the TEASER project This function adds a residential archetype building to the TEASER project. You need to specify the method of the archetype generation. Currently TEASER supports only method according 'iwu' and 'urbanrenet' for residential buildings ('tabula_de' to follow soon). Further the type of usage needs to be specified. Currently TEASER supports one type of residential building for 'iwu' and eleven types for 'urbanrenet'. For more information on specific archetype buildings and methods, please read the docs of archetype classes. This function also calculates the parameters of the buildings directly with the settings set in the project (e.g. used_library_calc or number_of_elements_calc). Parameters ---------- method : str Used archetype method, currenlty only 'iwu' or 'urbanrenet' are supported, 'tabula_de' to follow soon usage : str Main usage of the obtainend building, currently only 'single_family_dwelling' is supported for iwu and 'est1a', 'est1b', 'est2', 'est3', 'est4a', 'est4b', 'est5' 'est6', 'est7', 'est8a', 'est8b' for urbanrenet. name : str Individual name year_of_construction : int Year of first construction height_of_floors : float [m] Average height of the buildings' floors number_of_floors : int Number of building's floors above ground net_leased_area : float [m2] Total net leased area of building. This is area is NOT the footprint of a building with_ahu : Boolean If set to True, an empty instance of BuildingAHU is instantiated and assigned to attribute central_ahu. This instance holds information for central Air Handling units. Default is False. residential_layout : int Structure of floor plan (default = 0) CAUTION only used for iwu 0: compact 1: elongated/complex neighbour_buildings : int Number of neighbour buildings. CAUTION: this will not change the orientation of the buildings wall, but just the overall exterior wall and window area(!) (default = 0) 0: no neighbour 1: one neighbour 2: two neighbours attic : int Design of the attic. CAUTION: this will not change the orientation or tilt of the roof instances, but just adapt the roof area(!) ( default = 0) CAUTION only used for iwu 0: flat roof 1: non heated attic 2: partly heated attic 3: heated attic cellar : int Design of the of cellar CAUTION: this will not change the orientation, tilt of GroundFloor instances, nor the number or area of ThermalZones, but will change GroundFloor area(!) (default = 0) CAUTION only used for iwu 0: no cellar 1: non heated cellar 2: partly heated cellar 3: heated cellar dormer : str Is a dormer attached to the roof? CAUTION: this will not change roof or window orientation or tilt, but just adapt the roof area(!) (default = 0) CAUTION only used for iwu 0: no dormer 1: dormer construction_type : str Construction type of used wall constructions default is "heavy") heavy: heavy construction light: light construction number_of_apartments : int number of apartments inside Building (default = 1). CAUTION only used for urbanrenet Returns ---------- type_bldg : Instance of SingleFamilyDwelling() """ ass_error_method = "only 'iwu' and 'urbanrenet' are valid methods"\ "for residential archetype generation" assert method in ['iwu', 'urbanrenet'], ass_error_method ass_error_apart = "The keyword number_of_apartmens does not have any " \ "effect on archetype generation for 'iwu', see" \ "docs for more information" if method == 'iwu' and number_of_apartments is not None: warnings.warn(ass_error_apart) if method == 'iwu': ass_error_usage_iwu = "only 'single_family_dewlling' is a valid " \ "usage for iwu archetype method" assert usage in ['single_family_dwelling'], ass_error_usage_iwu if usage == 'single_family_dwelling': type_bldg = SingleFamilyDwelling( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, residential_layout, neighbour_buildings, attic, cellar, dormer, construction_type) elif method == 'urbanrenet': ass_error_usage_urn = "only 'est1a', 'est1b', 'est2', 'est3', " \ "'est4a', 'est4b', 'est5' 'est6', 'est7', " \ "'est8a','est8b' is are valid usages for " \ "urbanrenet archetype method" assert usage in ['est1a', 'est1b', 'est2', 'est3', 'est4a', 'est4b', 'est5', 'est6', 'est7', 'est8a', 'est8b'], ass_error_usage_urn if usage == 'est1a': type_bldg = EST1a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type) elif usage == 'est1b': type_bldg = EST1b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est2': type_bldg = EST2( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est3': type_bldg = EST3( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est4a': type_bldg = EST4a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est4b': type_bldg = EST4b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est5': type_bldg = EST5( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est6': type_bldg = EST6( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est7': type_bldg = EST7( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est8a': type_bldg = EST8a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) elif usage == 'est8b': type_bldg = EST8b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, neighbour_buildings, construction_type, number_of_apartments) type_bldg.generate_archetype() type_bldg.calc_building_parameter( number_of_elements=self._number_of_elements_calc, merge_windows=self._merge_windows_calc, used_library=self._used_library_calc) return type_bldg
def add_residential( self, method, usage, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu=False, internal_gains_mode=1, residential_layout=None, neighbour_buildings=None, attic=None, cellar=None, dormer=None, construction_type=None, number_of_apartments=None, ): """Add a residential building to the TEASER project. This function adds a residential archetype building to the TEASER project. You need to specify the method of the archetype generation. Currently TEASER supports only method according 'iwu', 'urbanrenet', 'tabula_de' and 'tabula_dk' for residential buildings. Further the type of usage needs to be specified. Currently TEASER supports one type of residential building for 'iwu' and eleven types for 'urbanrenet'. For more information on specific archetype buildings and methods, please read the docs of archetype classes. This function also calculates the parameters of the buildings directly with the settings set in the project (e.g. used_library_calc or number_of_elements_calc). Parameters ---------- method : str Used archetype method, currently only 'iwu' or 'urbanrenet' are supported, 'tabula_de' to follow soon usage : str Main usage of the obtained building, currently only 'single_family_dwelling' is supported for iwu and 'est1a', 'est1b', 'est2', 'est3', 'est4a', 'est4b', 'est5' 'est6', 'est7', 'est8a', 'est8b' for urbanrenet. name : str Individual name year_of_construction : int Year of first construction height_of_floors : float [m] Average height of the buildings' floors number_of_floors : int Number of building's floors above ground net_leased_area : float [m2] Total net leased area of building. This is area is NOT the footprint of a building with_ahu : Boolean If set to True, an empty instance of BuildingAHU is instantiated and assigned to attribute central_ahu. This instance holds information for central Air Handling units. Default is False. internal_gains_mode: int [1, 2, 3] mode for the internal gains calculation by persons: 1: Temperature and activity degree dependent calculation. The calculation is based on SIA 2024 (default) 2: Temperature and activity degree independent calculation, the max. heatflowrate is prescribed by the parameter fixed_heat_flow_rate_persons. 3: Temperature and activity degree dependent calculation with consideration of moisture. The calculation is based on SIA 2024 residential_layout : int Structure of floor plan (default = 0) CAUTION only used for iwu 0: compact 1: elongated/complex neighbour_buildings : int Number of neighbour buildings. CAUTION: this will not change the orientation of the buildings wall, but just the overall exterior wall and window area(!) (default = 0) 0: no neighbour 1: one neighbour 2: two neighbours attic : int Design of the attic. CAUTION: this will not change the orientation or tilt of the roof instances, but just adapt the roof area(!) ( default = 0) CAUTION only used for iwu 0: flat roof 1: non heated attic 2: partly heated attic 3: heated attic cellar : int Design of the of cellar CAUTION: this will not change the orientation, tilt of GroundFloor instances, nor the number or area of ThermalZones, but will change GroundFloor area(!) (default = 0) CAUTION only used for iwu 0: no cellar 1: non heated cellar 2: partly heated cellar 3: heated cellar dormer : str Is a dormer attached to the roof? CAUTION: this will not change roof or window orientation or tilt, but just adapt the roof area(!) (default = 0) CAUTION only used for iwu 0: no dormer 1: dormer construction_type : str Construction type of used wall constructions default is "heavy") heavy: heavy construction light: light construction number_of_apartments : int number of apartments inside Building (default = 1). CAUTION only used for urbanrenet Returns ---------- type_bldg : Instance of Archetype Building """ ass_error_method = ("only'tabula_de', 'tabula_dk', 'iwu' and " "'urbanrenet' " "are valid methods for residential archetype " "generation") assert method in [ "tabula_de", "iwu", "urbanrenet", "tabula_dk", ], ass_error_method ass_error_apart = ( "The keyword number_of_apartments does not have any " "effect on archetype generation for 'iwu' or" "'tabula_de', see docs for more information") if (method in ["iwu", "tabula_de", "tabula_dk"] and number_of_apartments is not None): warnings.warn(ass_error_apart) if method == "tabula_de": if self.data is None: self.data = DataClass(used_statistic=method) elif self.data.used_statistic != "tabula_de": self.data = DataClass(used_statistic=method) ass_error_usage_tabula = "only 'single_family_house'," "'terraced_house', 'multi_family_house', 'apartment_block' are" "valid usages for iwu archetype method" assert usage in [ "single_family_house", "terraced_house", "multi_family_house", "apartment_block", ], ass_error_usage_tabula if usage == "single_family_house": type_bldg = SingleFamilyHouse( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif usage == "terraced_house": type_bldg = TerracedHouse( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif usage == "multi_family_house": type_bldg = MultiFamilyHouse( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif usage == "apartment_block": type_bldg = ApartmentBlock( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif method == "tabula_dk": if self.data is None: self.data = DataClass(used_statistic=method) elif self.data.used_statistic != "tabula_dk": self.data = DataClass(used_statistic=method) ass_error_usage_tabula = "only 'single_family_house'," "'terraced_house', 'apartment_block' are" "valid usages for iwu archetype method" assert usage in [ "single_family_house", "terraced_house", "apartment_block", ], ass_error_usage_tabula if usage == "single_family_house": type_bldg = SingleFamilyHouse_DK( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif usage == "terraced_house": type_bldg = TerracedHouse_DK( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif usage == "apartment_block": type_bldg = ApartmentBlock_DK( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, construction_type, ) type_bldg.generate_archetype() return type_bldg elif method == "iwu": if self.data is None: self.data = DataClass(used_statistic=method) elif self.data.used_statistic != "iwu": self.data = DataClass(used_statistic=method) ass_error_usage_iwu = ("only 'single_family_dwelling' is a valid " "usage for iwu archetype method") assert usage in ["single_family_dwelling"], ass_error_usage_iwu if usage == "single_family_dwelling": type_bldg = SingleFamilyDwelling( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, residential_layout, neighbour_buildings, attic, cellar, dormer, construction_type, ) elif method == "urbanrenet": if self.data is None: self.data = DataClass(used_statistic="iwu") elif self.data.used_statistic != "iwu": self.data = DataClass(used_statistic="iwu") ass_error_usage_urn = ("only 'est1a', 'est1b', 'est2', 'est3', " "'est4a', 'est4b', 'est5' 'est6', 'est7', " "'est8a','est8b' is are valid usages for " "urbanrenet archetype method") assert usage in [ "est1a", "est1b", "est2", "est3", "est4a", "est4b", "est5", "est6", "est7", "est8a", "est8b", ], ass_error_usage_urn if usage == "est1a": type_bldg = EST1a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, ) elif usage == "est1b": type_bldg = EST1b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est2": type_bldg = EST2( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est3": type_bldg = EST3( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est4a": type_bldg = EST4a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est4b": type_bldg = EST4b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est5": type_bldg = EST5( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est6": type_bldg = EST6( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est7": type_bldg = EST7( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est8a": type_bldg = EST8a( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) elif usage == "est8b": type_bldg = EST8b( self, name, year_of_construction, number_of_floors, height_of_floors, net_leased_area, with_ahu, internal_gains_mode, neighbour_buildings, construction_type, number_of_apartments, ) type_bldg.generate_archetype() type_bldg.calc_building_parameter( number_of_elements=self._number_of_elements_calc, merge_windows=self._merge_windows_calc, used_library=self._used_library_calc, ) return type_bldg
def load_gml(path, prj): """This function loads buildings from a CityGML file This function is a proof of concept, be careful using it. Parameters ---------- path: string path of CityGML file prj: Project() Teaser instance of Project() """ xml_file = open(path, 'r') gml_bind = citygml.CreateFromDocument(xml_file.read()) for i, city_object in enumerate(gml_bind.featureMember): if city_object.Feature.consistsOfBuildingPart: for part in city_object.Feature.consistsOfBuildingPart: if part.BuildingPart.function: if part.BuildingPart.function[0].value() == "1000": bld = SingleFamilyDwelling(parent=prj, name=part.BuildingPart.id) elif part.BuildingPart.function[0].value() == "1120": bld = Office(parent=prj, name=part.BuildingPart.id) else: bld = Building(parent=prj, name=part.BuildingPart.id) else: bld = Building(parent=prj, name=part.BuildingPart.id) _create_building_part(bld=bld, part=part) _set_attributes(bld=bld, gml_bld=part.BuildingPart) bld.set_height_gml() else: if city_object.Feature.function: if city_object.Feature.function[0].value() == "1000": bld = SingleFamilyDwelling(parent=prj, name=city_object.Feature.id) elif city_object.Feature.function[0].value() == "1120": bld = Office(parent=prj, name=city_object.Feature.id) else: bld = Building(parent=prj, name=city_object.Feature.id) else: bld = Building(parent=prj, name=city_object.Feature.id) _create_building(bld=bld, city_object=city_object) _set_attributes(bld=bld, gml_bld=city_object.Feature) bld.set_height_gml() try: bld.set_gml_attributes() except UserWarning: print("bld.set_gml_attributes() did not work") pass try: bld.generate_from_gml() except (UserWarning, AttributeError): print("bld.generate_from_gml() did not work for building ", str(bld.name)) pass