Example #1
0
 def click_add_new_element(self, parent, name, type, area):
     if type == "Outer Wall":
         element = OuterWall(parent)
         element.name = name
         element.area = area
     if type == "Inner Wall":
         element = InnerWall(parent)
         element.name = name
         element.area = area
     if type == "Window":
         element = Window(parent)
         element.name = name
         element.area = area
     if type == "GroundFloor":
         element = GroundFloor(parent)
         element.name = name
         element.area = area
     if type == "Ceiling":
         element = Ceiling(parent)
         element.name = name
         element.area = area
     if type == "Rooftop":
         element = Rooftop(parent)
         element.name = name
         element.area = area
     if type == "Floor":
         element = Floor(parent)
         element.name = name
         element.area = area
     return parent
Example #2
0
    def click_add_new_element(self, parent, name, type, area):
        '''
        adds a new element to a zone with specified name, area and type.

        Parameters:
        ----------
        parent : wall()
            parent class of an element

        name : str
            individual name

        type : string
            type of element

        area : float
            area of the element

        Returns
        ----------

        parent : wall()
            parent class of element
        '''

        if type == "Outer Wall":
            element = OuterWall(parent)
            element.name = name
            element.area = area
        if type == "Inner Wall":
            element = InnerWall(parent)
            element.name = name
            element.area = area
        if type == "Window":
            element = Window(parent)
            element.name = name
            element.area = area
        if type == "GroundFloor":
            element = GroundFloor(parent)
            element.name = name
            element.area = area
        if type == "Ceiling":
            element = Ceiling(parent)
            element.name = name
            element.area = area
        if type == "Rooftop":
            element = Rooftop(parent)
            element.name = name
            element.area = area
        if type == "Floor":
            element = Floor(parent)
            element.name = name
            element.area = area
        return parent
Example #3
0
    def generate_archetype(self):
        """Generates a SingleFamilyHouse archetype buildings

        With given values, this function generates an archetype building for
        Tabula Single Family House.
        """
        self.thermal_zones = None
        self._check_year_of_construction()
        # help area for the correct building area setting while using typeBldgs
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0

        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(parent=self)
            zone.name = key
            zone.area = type_bldg_area * value[0]
            use_cond = UseCond(parent=zone)
            use_cond.load_use_conditions(zone_usage=value[1])
            zone.use_conditions = use_cond

            zone.use_conditions.with_ahu = False
            zone.use_conditions.persons *= zone.area * 0.01
            zone.use_conditions.machines *= zone.area * 0.01

        if self.facade_estimation_factors[self.building_age_group]['ow1'] != 0:
            for key, value in self._outer_wall_names_1.items():
                for zone in self.thermal_zones:
                    outer_wall = OuterWall(zone)
                    outer_wall.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_1,
                        data_class=self.parent.data)
                    outer_wall.name = key
                    outer_wall.tilt = value[0]
                    outer_wall.orientation = value[1]
                    outer_wall.area = ((self.facade_estimation_factors[
                        self.building_age_group]['ow1'] * type_bldg_area) /
                                       len(self._outer_wall_names_1))

        if self.facade_estimation_factors[self.building_age_group]['ow2'] != 0:
            for key, value in self._outer_wall_names_2.items():
                for zone in self.thermal_zones:
                    outer_wall = OuterWall(zone)
                    outer_wall.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_2,
                        data_class=self.parent.data)
                    outer_wall.name = key
                    outer_wall.tilt = value[0]
                    outer_wall.orientation = value[1]
                    outer_wall.area = ((self.facade_estimation_factors[
                        self.building_age_group]['ow2'] * type_bldg_area) /
                                       len(self._outer_wall_names_2))

        if self.facade_estimation_factors[
                self.building_age_group]['win1'] != 0:
            for key, value in self.window_names_1.items():
                for zone in self.thermal_zones:
                    window = Window(zone)
                    window.load_type_element(
                        self.year_of_construction,
                        construction=self._construction_type_1,
                        data_class=self.parent.data)
                    window.name = key
                    window.tilt = value[0]
                    window.orientation = value[1]
                    window.area = ((self.facade_estimation_factors[
                        self.building_age_group]['win1'] * type_bldg_area) /
                                   len(self.window_names_1))

        if self.facade_estimation_factors[
                self.building_age_group]['win2'] != 0:
            for key, value in self.window_names_2.items():
                for zone in self.thermal_zones:
                    window = Window(zone)
                    window.load_type_element(
                        self.year_of_construction,
                        construction=self._construction_type_2,
                        data_class=self.parent.data)
                    window.name = key
                    window.tilt = value[0]
                    window.orientation = value[1]
                    window.area = ((self.facade_estimation_factors[
                        self.building_age_group]['win2'] * type_bldg_area) /
                                   len(self.window_names_2))

        if self.facade_estimation_factors[self.building_age_group]['gf1'] != 0:
            for key, value in self.ground_floor_names_1.items():

                for zone in self.thermal_zones:
                    gf = GroundFloor(zone)
                    gf.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_1,
                        data_class=self.parent.data)
                    gf.name = key
                    gf.tilt = value[0]
                    gf.orientation = value[1]
                    gf.area = ((self.facade_estimation_factors[
                        self.building_age_group]['gf1'] * type_bldg_area) /
                               len(self.ground_floor_names_1))

        if self.facade_estimation_factors[self.building_age_group]['gf2'] != 0:
            for key, value in self.ground_floor_names_2.items():

                for zone in self.thermal_zones:
                    gf = GroundFloor(zone)
                    gf.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_2,
                        data_class=self.parent.data)
                    gf.name = key
                    gf.tilt = value[0]
                    gf.orientation = value[1]
                    gf.area = ((self.facade_estimation_factors[
                        self.building_age_group]['gf2'] * type_bldg_area) /
                               len(self.ground_floor_names_2))

        if self.facade_estimation_factors[self.building_age_group]['rt1'] != 0:
            for key, value in self.roof_names_1.items():

                for zone in self.thermal_zones:
                    rt = Rooftop(zone)
                    rt.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_1,
                        data_class=self.parent.data)
                    rt.name = key
                    rt.tilt = value[0]
                    rt.orientation = value[1]
                    rt.area = ((self.facade_estimation_factors[
                        self.building_age_group]['rt1'] * type_bldg_area) /
                               len(self.roof_names_1))

        if self.facade_estimation_factors[self.building_age_group]['rt2'] != 0:
            for key, value in self.roof_names_2.items():

                for zone in self.thermal_zones:
                    rt = Rooftop(zone)
                    rt.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_2,
                        data_class=self.parent.data)
                    rt.name = key
                    rt.tilt = value[0]
                    rt.orientation = value[1]
                    rt.area = ((self.facade_estimation_factors[
                        self.building_age_group]['rt2'] * type_bldg_area) /
                               len(self.roof_names_2))

        if self.facade_estimation_factors[
                self.building_age_group]['door'] != 0:
            for key, value in self.door_names.items():

                for zone in self.thermal_zones:
                    door = Door(zone)
                    door.load_type_element(
                        year=self.year_of_construction,
                        construction=self._construction_type_1,
                        data_class=self.parent.data)
                    door.name = key
                    door.tilt = value[0]
                    door.orientation = value[1]
                    door.area = ((self.facade_estimation_factors[
                        self.building_age_group]['door'] * type_bldg_area) /
                                 len(self.door_names))

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(year=self.year_of_construction,
                                             construction="tabula_standard",
                                             data_class=self.parent.data)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(year=self.year_of_construction,
                                              construction="tabula_standard",
                                              data_class=self.parent.data)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(year=self.year_of_construction,
                                            construction="tabula_standard",
                                            data_class=self.parent.data)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #4
0
    def generate_archetype(self):
        """Generates an office building.

        With given values, this class generates an office archetype building
        according to TEASER requirements.
        """
        # help area for the correct building area setting while using typeBldgs
        self.thermal_zones = None
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0
        # create zones with their corresponding area, name and usage
        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.area = type_bldg_area * value[0]
            zone.name = key
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1], data_class=self.parent.data)
            zone.use_conditions = use_cond

        # statistical estimation of the facade

        self._est_outer_wall_area = (self.est_factor_wall_area *
                                     type_bldg_area**self.est_exponent_wall)
        self._est_win_area = (self.est_factor_win_area *
                              type_bldg_area**self.est_exponent_win)
        self._est_roof_area = (type_bldg_area /
                               self.number_of_floors) * self.gross_factor
        self._est_floor_area = (type_bldg_area /
                                self.number_of_floors) * self.gross_factor

        # manipulation of wall according to facade design
        # (received from window_layout)

        self._est_facade_area = self._est_outer_wall_area + self._est_win_area

        if not self.window_layout == 0:
            self._est_outer_wall_area = self._est_facade_area * self.corr_factor_wall
            self._est_win_area = self._est_facade_area * self.corr_factor_win
        else:
            pass

        # set the facade area to the four orientations

        for key, value in self.outer_wall_names.items():
            # North and South
            if value[1] == 0 or value[1] == 180:
                self.outer_area[value[1]] = self._est_outer_wall_area * (
                    self._est_length /
                    (2 * self._est_width + 2 * self._est_length))
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area * (
                    self._est_width /
                    (2 * self._est_width + 2 * self._est_length))
            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data,
                )
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area * (
                    self._est_length /
                    (2 * self._est_width + 2 * self._est_length))

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area * (
                    self._est_width /
                    (2 * self._est_width + 2 * self._est_length))
            """
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime.
            """
            for zone in self.thermal_zones:
                window = Window(zone)
                window.load_type_element(
                    self.year_of_construction,
                    "Kunststofffenster, "
                    "Isolierverglasung",
                    data_class=self.parent.data,
                )
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data,
                )
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data,
                )
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data,
                )
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data,
                    )
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data,
                    )
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #5
0
def import_building_from_excel(project, building_name, construction_age,
                               path_to_excel, sheet_names):
    """
    Import building data from excel, convert it via the respective zoning and feed it to teasers logic classes.
    Pay attention to hard coded parts, which are marked.

    Parameters
    ----------
    project: Project()
        TEASER instance of Project
    building_name: str
        name of building to be set in the project
    construction_age: int [y]
        construction age of the building
    path_to_excel: str
        path to excel file to be imported
    sheet_names: str or list
        sheet names which shall be imported
    return data: pandas.DataFrame
        zoned DataFrame which is finally used to parametrize the teaser classes
    return project: Project()
        TEASER instance of Project filled with the imported building data
    """
    def warn_constructiontype(element):
        """Generic warning function"""
        if element.construction_type is None:
            warnings.warn(
                'In zone "%s" the %s construction "%s" could not be loaded from the TypeBuildingElements.json, '
                "an error will occur due to missing data for calculation."
                "Check for spelling and the correct combination of building age and construction type."
                "Here is the list of faulty entries:\n%s"
                "\nThese entries can easily be found checking the stated index in the produced ZonedInput.xlsx"
                % (
                    group["zone"].iloc[0],
                    element.name,
                    group["OuterWallConstruction"].iloc[0],
                    group,
                ))

    bldg = Building(parent=project)
    bldg.name = building_name
    bldg.year_of_construction = construction_age
    bldg.with_ahu = True  # HardCodedInput
    if bldg.with_ahu is True:
        bldg.central_ahu.heat_recovery = True  # HardCodedInput
        bldg.central_ahu.efficiency_recovery = 0.35  # HardCodedInput
        bldg.central_ahu.temperature_profile = 25 * [273.15 + 18
                                                     ]  # HardCodedInput
        bldg.central_ahu.min_relative_humidity_profile = 25 * [
            0
        ]  # HardCodedInput
        bldg.central_ahu.max_relative_humidity_profile = 25 * [
            1
        ]  # HardCodedInput
        bldg.central_ahu.v_flow_profile = 25 * [1]  # HardCodedInput

    # Parameters that need hard coding in teasers logic classes
    # 1. "use_set_back" needs hard coding at aixlib.py in the init; defines
    # if the in the useconditions stated
    #   heating_time with the respective set_back_temp should be applied.
    #   use_set_back = false -> all hours of the day
    #   have same set_temp_heat actual value: use_set_back = Check your current version!
    # 2. HeaterOn, CoolerOn, hHeat, lCool, etc. can be hard coded in the text
    # file
    #   "teaser / data / output / modelicatemplate / AixLib /
    #   AixLib_ThermalZoneRecord_TwoElement"
    #   actual changes: Check your current version!

    # Parameters to be set for each and every zone (#HardCodedInput)
    # -----------------------------
    out_wall_tilt = 90
    window_tilt = 90
    ground_floor_tilt = 0
    floor_tilt = 0
    ceiling_tilt = 0
    rooftop_tilt = 0
    ground_floor_orientation = -2
    floor_orientation = -2
    rooftop_orientation = -1
    ceiling_orientation = -1
    # -----------------------------

    # load_building_data from excel_to_pandas DataFrame:
    data = import_data(path_to_excel, sheet_names)

    # informative print
    usage_types = get_list_of_present_entries(data["UsageType"])
    print("List of present usage_types in the original Data set: \n%s" %
          usage_types)

    # define the zoning methodology/function
    data = zoning_example(data)

    # informative print
    usage_types = get_list_of_present_entries(data["Zone"])
    print("List of zones after the zoning is applied: \n%s" % usage_types)

    # aggregate all rooms of each zone and for each set general parameter,
    # boundary conditions
    # and parameter regarding the building physics
    zones = data.groupby(["Zone"])
    for name, zone in zones:

        # Block: Thermal zone (general parameter)
        tz = ThermalZone(parent=bldg)
        tz.name = str(name)
        tz.area = zone["NetArea[m²]"].sum()
        # room vice calculation of volume plus summing those
        tz.volume = (np.array(zone["NetArea[m²]"]) *
                     np.array(zone["HeatedRoomHeight[m]"])).sum()

        # Block: Boundary Conditions
        # load UsageOperationTime, Lighting, RoomClimate and InternalGains
        # from the "UseCondition.json"
        tz.use_conditions = UseConditions(parent=tz)
        tz.use_conditions.load_use_conditions(zone["Zone"].iloc[0],
                                              project.data)

        # Block: Building Physics
        # Grouping by orientation and construction type
        # aggregating and feeding to the teaser logic classes
        grouped = zone.groupby(
            ["OuterWallOrientation[°]", "OuterWallConstruction"])
        for name, group in grouped:
            # looping through a groupby object automatically discards the
            # groups where one of the attributes is nan
            # additionally check for strings, since the value must be of type
            # int or float
            if not isinstance(group["OuterWallOrientation[°]"].iloc[0], str):
                out_wall = OuterWall(parent=tz)
                out_wall.name = (
                    "outer_wall_" +
                    str(int(group["OuterWallOrientation[°]"].iloc[0])) + "_" +
                    str(group["OuterWallConstruction"].iloc[0]))
                out_wall.area = group["OuterWallArea[m²]"].sum()
                out_wall.tilt = out_wall_tilt
                out_wall.orientation = group["OuterWallOrientation[°]"].iloc[0]
                # load wall properties from "TypeBuildingElements.json"
                out_wall.load_type_element(
                    year=bldg.year_of_construction,
                    construction=group["OuterWallConstruction"].iloc[0],
                )
                warn_constructiontype(out_wall)
            else:
                warnings.warn(
                    'In zone "%s" the OuterWallOrientation "%s" is '
                    "neither float nor int, "
                    "hence this building element is not added.\nHere is the "
                    "list of faulty entries:\n%s"
                    "\n These entries can easily be found checking the stated "
                    "index in the produced ZonedInput.xlsx" % (
                        group["Zone"].iloc[0],
                        group["OuterWallOrientation[°]"].iloc[0],
                        group,
                    ))

        grouped = zone.groupby(["WindowOrientation[°]", "WindowConstruction"])
        for name, group in grouped:
            # looping through a groupby object automatically discards the
            # groups where one of the attributes is nan
            # additionally check for strings, since the value must be of type
            # int or float
            if not isinstance(group["OuterWallOrientation[°]"].iloc[0], str):
                window = Window(parent=tz)
                window.name = (
                    "window_" +
                    str(int(group["WindowOrientation[°]"].iloc[0])) + "_" +
                    str(group["WindowConstruction"].iloc[0]))
                window.area = group["WindowArea[m²]"].sum()
                window.tilt = window_tilt
                window.orientation = group["WindowOrientation[°]"].iloc[0]
                # load wall properties from "TypeBuildingElements.json"
                window.load_type_element(
                    year=bldg.year_of_construction,
                    construction=group["WindowConstruction"].iloc[0],
                )
                warn_constructiontype(window)
            else:
                warnings.warn(
                    'In zone "%s" the window orientation "%s" is neither '
                    "float nor int, "
                    "hence this building element is not added. Here is the "
                    "list of faulty entries:\n%s"
                    "\nThese entries can easily be found checking the stated "
                    "index in the produced ZonedInput.xlsx" % (
                        group["Zone"].iloc[0],
                        group["WindowOrientation[°]"].iloc[0],
                        group,
                    ))

        grouped = zone.groupby(["IsGroundFloor", "FloorConstruction"])
        for name, group in grouped:
            if group["NetArea[m²]"].sum() != 0:  # to avoid devision by 0
                if group["IsGroundFloor"].iloc[0] == 1:
                    ground_floor = GroundFloor(parent=tz)
                    ground_floor.name = "ground_floor" + str(
                        group["FloorConstruction"].iloc[0])
                    ground_floor.area = group["NetArea[m²]"].sum()
                    ground_floor.tilt = ground_floor_tilt
                    ground_floor.orientation = ground_floor_orientation
                    # load wall properties from "TypeBuildingElements.json"
                    ground_floor.load_type_element(
                        year=bldg.year_of_construction,
                        construction=group["FloorConstruction"].iloc[0],
                    )
                    warn_constructiontype(ground_floor)
                elif group["IsGroundFloor"].iloc[0] == 0:
                    floor = Floor(parent=tz)
                    floor.name = "floor" + str(
                        group["FloorConstruction"].iloc[0])
                    floor.area = group["NetArea[m²]"].sum() / 2  # only half of
                    # the floor belongs to this story
                    floor.tilt = floor_tilt
                    floor.orientation = floor_orientation
                    # load wall properties from "TypeBuildingElements.json"
                    floor.load_type_element(
                        year=bldg.year_of_construction,
                        construction=group["FloorConstruction"].iloc[0],
                    )
                    warn_constructiontype(floor)
                else:
                    warnings.warn(
                        "Values for IsGroundFloor have to be either 0 or 1, "
                        "for no or yes respectively")
            else:
                warnings.warn(
                    'zone "%s" with IsGroundFloor "%s" and construction '
                    'type "%s" '
                    "has no floor nor groundfloor, since the area equals 0." %
                    (
                        group["Zone"].iloc[0],
                        group["IsGroundFloor"].iloc[0],
                        group["FloorConstruction"].iloc[0],
                    ))

        grouped = zone.groupby(["IsRooftop", "CeilingConstruction"])
        for name, group in grouped:
            if group["NetArea[m²]"].sum() != 0:  # to avoid devision by 0
                if group["IsRooftop"].iloc[0] == 1:
                    rooftop = Rooftop(parent=tz)
                    rooftop.name = "rooftop" + str(
                        group["CeilingConstruction"].iloc[0])
                    rooftop.area = group["NetArea[m²]"].sum(
                    )  # sum up area of respective
                    # rooftop parts
                    rooftop.tilt = rooftop_tilt
                    rooftop.orientation = rooftop_orientation
                    # load wall properties from "TypeBuildingElements.json"
                    rooftop.load_type_element(
                        year=bldg.year_of_construction,
                        construction=group["CeilingConstruction"].iloc[0],
                    )
                    warn_constructiontype(rooftop)
                elif group["IsRooftop"].iloc[0] == 0:
                    ceiling = Ceiling(parent=tz)
                    ceiling.name = "ceiling" + str(
                        group["CeilingConstruction"].iloc[0])
                    ceiling.area = group["NetArea[m²]"].sum() / 2  # only half
                    # of the ceiling belongs to a story,
                    # the other half to the above
                    ceiling.tilt = ceiling_tilt
                    ceiling.orientation = ceiling_orientation
                    # load wall properties from "TypeBuildingElements.json"
                    ceiling.load_type_element(
                        year=bldg.year_of_construction,
                        construction=group["CeilingConstruction"].iloc[0],
                    )
                    warn_constructiontype(ceiling)
                else:
                    warnings.warn(
                        "Values for IsRooftop have to be either 0 or 1, "
                        "for no or yes respectively")
            else:
                warnings.warn(
                    'zone "%s" with IsRooftop "%s" and construction type '
                    '"%s" '
                    "has no ceiling nor rooftop, since the area equals 0." % (
                        group["Zone"].iloc[0],
                        group["IsRooftop"].iloc[0],
                        group["CeilingConstruction"].iloc[0],
                    ))

        grouped = zone.groupby(["InnerWallConstruction"])
        for name, group in grouped:
            if group["InnerWallArea[m²]"].sum() != 0:  # to avoid devision by 0
                in_wall = InnerWall(parent=tz)
                in_wall.name = "inner_wall" + str(
                    group["InnerWallConstruction"].iloc[0])
                in_wall.area = group["InnerWallArea[m²]"].sum() / 2  # only
                # half of the wall belongs to each room,
                # the other half to the adjacent
                # load wall properties from "TypeBuildingElements.json"
                in_wall.load_type_element(
                    year=bldg.year_of_construction,
                    construction=group["InnerWallConstruction"].iloc[0],
                )
                warn_constructiontype(in_wall)
            else:
                warnings.warn(
                    'zone "%s" with inner wall construction "%s" has no '
                    "inner walls, since area = 0." %
                    (group["Zone"].iloc[0], group["InnerWallConstructio"
                                                  "n"].iloc[0]))

        # Block: AHU and infiltration #Attention hard coding
        # set the supply volume flow of the AHU per zone
        ahu_dict = {
            "Bedroom": [15.778, 15.778],
            "Corridorsinthegeneralcarearea": [5.2941, 5.2941],
            "Examinationortreatmentroom": [15.743, 15.743],
            "MeetingConferenceseminar": [16.036, 16.036],
            "Stocktechnicalequipmentarchives": [20.484, 20.484],
            "WCandsanitaryroomsinnonresidentialbuildings": [27.692, 27.692],
        }
        _i = 0
        for key in ahu_dict:
            if tz.name == key:
                tz.use_conditions.min_ahu = ahu_dict[key][0]
                tz.use_conditions.max_ahu = ahu_dict[key][1]
                _i = 1
        if _i == 0:
            warnings.warn(
                "The zone %s could not be found in your ahu_dict. Hence, "
                "no AHU flow is defined. The default value is "
                "0 (min_ahu = 0; max_ahu=0" % tz.name)

    return project, data
Example #6
0
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)
Example #7
0
    def generate_from_gml(self):
        """Enriches lod1 or lod2 data from CityGML

        Adds Zones, BoundaryConditions, Material settings for walls and
        windows to the geometric representation of CityGML
        """

        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0
        # create zones with their corresponding area, name and usage
        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.area = type_bldg_area * value[0]
            zone.name = key
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1], data_class=self.parent.data)
            zone.use_conditions = use_cond
            zone.use_conditions.with_ahu = False
            zone.use_conditions.persons *= zone.area * 0.01
            zone.use_conditions.machines *= zone.area * 0.01

            for surface in self.gml_surfaces:
                if surface.surface_tilt is not None:
                    if surface.surface_tilt == 90:
                        outer_wall = OuterWall(zone)
                        outer_wall.load_type_element(
                            year=self.year_of_construction,
                            construction=self.construction_type,
                            data_class=self.parent.data)
                        outer_wall.name = surface.name
                        outer_wall.tilt = surface.surface_tilt
                        outer_wall.orientation = surface.surface_orientation

                        window = Window(zone)
                        window.load_type_element(self.year_of_construction,
                                                 "Kunststofffenster, "
                                                 "Isolierverglasung",
                                                 data_class=self.parent.data)
                        window.name = "asd" + str(surface.surface_tilt)
                        window.tilt = surface.surface_tilt
                        window.orientation = surface.surface_orientation

                    elif surface.surface_tilt == 0 and \
                        surface.surface_orientation == \
                            -2:
                        outer_wall = GroundFloor(zone)
                        outer_wall.load_type_element(
                            year=self.year_of_construction,
                            construction=self.construction_type,
                            data_class=self.parent.data)
                        outer_wall.name = surface.name
                        outer_wall.tilt = surface.surface_tilt
                        outer_wall.orientation = surface.surface_orientation

                    else:
                        outer_wall = Rooftop(zone)
                        outer_wall.load_type_element(
                            year=self.year_of_construction,
                            construction=self.construction_type,
                            data_class=self.parent.data)
                        outer_wall.name = surface.name
                        outer_wall.tilt = surface.surface_tilt
                        outer_wall.orientation = surface.surface_orientation

            for key, value in self.inner_wall_names.items():

                for zone in self.thermal_zones:
                    inner_wall = InnerWall(zone)
                    inner_wall.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data)
                    inner_wall.name = key
                    inner_wall.tilt = value[0]
                    inner_wall.orientation = value[1]

            if self.number_of_floors > 1:

                for key, value in self.ceiling_names.items():

                    for zone in self.thermal_zones:
                        ceiling = Ceiling(zone)
                        ceiling.load_type_element(
                            year=self.year_of_construction,
                            construction=self.construction_type,
                            data_class=self.parent.data)
                        ceiling.name = key
                        ceiling.tilt = value[0]
                        ceiling.orientation = value[1]

                for key, value in self.floor_names.items():

                    for zone in self.thermal_zones:
                        floor = Floor(zone)
                        floor.load_type_element(
                            year=self.year_of_construction,
                            construction=self.construction_type,
                            data_class=self.parent.data)
                        floor.name = key
                        floor.tilt = value[0]
                        floor.orientation = value[1]
            else:
                pass

        for surface in self.gml_surfaces:
            if surface.surface_tilt is not None:
                if surface.surface_tilt != 0 and surface.surface_orientation\
                        != -2 and surface.surface_orientation != -1:
                    self.set_outer_wall_area(
                        surface.surface_area * (1 - self.est_factor_win_area),
                        surface.surface_orientation)
                else:
                    self.set_outer_wall_area(surface.surface_area,
                                             surface.surface_orientation)
        for surface in self.gml_surfaces:

            if surface.surface_tilt != 0 and surface.surface_orientation != \
                    -2 and surface.surface_orientation != -1:
                self.set_window_area(
                    surface.surface_area * self.est_factor_win_area,
                    surface.surface_orientation)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #8
0
    def generate_archetype(self):
        """Generates a SingleFamilyDwelling building.

        With given values, this class generates a archetype building for
        single family dwellings according to TEASER requirements
        """
        # help area for the correct building area setting while using typeBldgs
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0

        self._number_of_heated_floors = self._est_factor_heated_cellar + \
            self.number_of_floors + self.est_living_area_factor \
            * self._est_factor_heated_attic

        self._living_area_per_floor = type_bldg_area / \
            self._number_of_heated_floors

        self._est_ground_floor_area = self.est_bottom_building_closure * \
            self._living_area_per_floor

        self._est_roof_area = self.est_upper_building_closure * \
            self._est_factor_dormer * self._est_area_per_floor * \
            self._living_area_per_floor

        self._top_floor_area = self._est_area_per_roof * \
            self._living_area_per_floor

        if self._est_roof_area == 0:
            self._est_roof_area = self._top_floor_area

        self._est_facade_area = self._est_facade_to_floor_area * \
            self._living_area_per_floor + self._est_extra_floor_area

        self._est_win_area = self.est_factor_win_area * type_bldg_area

        self._est_cellar_wall_area = self.est_factor_cellar_area * \
            self._est_factor_heated_cellar * self._est_facade_area

        self._est_outer_wall_area = (self._number_of_heated_floors *
                                     self._est_facade_area) - \
            self._est_cellar_wall_area - \
            self._est_win_area

        # self._est_factor_volume = type_bldg_area * 2.5

        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.name = key
            zone.area = type_bldg_area * value[0]
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1], data_class=self.parent.data)

            zone.use_conditions = use_cond
            zone.use_conditions.with_ahu = False
            zone.use_conditions.persons *= zone.area * 0.01
            zone.use_conditions.machines *= zone.area * 0.01

        for key, value in self.outer_wall_names.items():
            # North and South

            if value[1] == 0 or value[1] == 180.0:
                self.outer_area[value[1]] = self._est_outer_wall_area / \
                    self.nr_of_orientation
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area / \
                    self.nr_of_orientation

            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area / \
                    self.nr_of_orientation

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area / \
                    self.nr_of_orientation
            '''
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime
            '''
            for zone in self.thermal_zones:
                window = Window(zone)

                window.load_type_element(self.year_of_construction,
                                         "Kunststofffenster, "
                                         "Isolierverglasung",
                                         data_class=self.parent.data)
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(year=self.year_of_construction,
                                       construction=self.construction_type,
                                       data_class=self.parent.data)
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_ground_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]
                # zone.inner_walls.append(inner_wall)

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
                    # zone.inner_walls.append(floor)
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #9
0
def load_teaser_json(path, project):
    """Load a project from json.

    TEASERs internal file format to store information.

    Parameters
    ----------
    path: string
        path of teaserjson file

    project: Project()
        Teaser instance of Project()


    """
    __building_class = {
        "Office": {
            "method": "bmvbs",
            "teaser_class": Office
        },
        "Institute": {
            "method": "bmvbs",
            "teaser_class": Institute
        },
        "Institute4": {
            "method": "bmvbs",
            "teaser_class": Institute4
        },
        "Institute8": {
            "method": "bmvbs",
            "teaser_class": Institute8
        },
        "Building": {
            "method": "undefined",
            "teaser_class": Building
        },
        "SingleFamilyDwelling": {
            "method": "iwu",
            "teaser_class": SingleFamilyDwelling
        },
        "SingleFamilyHouse": {
            "method": "tabula_de",
            "teaser_class": SingleFamilyHouse
        },
        "TerracedHouse": {
            "method": "tabula_de",
            "teaser_class": TerracedHouse
        },
        "MultiFamilyHouse": {
            "method": "tabula_de",
            "teaser_class": MultiFamilyHouse
        },
        "ApartmentBlock": {
            "method": "tabula_de",
            "teaser_class": ApartmentBlock
        },
    }
    with open(path, "r+") as f:
        prj_in = json.load(f, object_pairs_hook=collections.OrderedDict)

    project.name = prj_in["project"]["name"]
    project.weather_file_path = prj_in["project"]["weather_file_path"]
    project.number_of_elements_calc = prj_in["project"][
        "number_of_elements_calc"]
    project.merge_windows_calc = prj_in["project"]["merge_windows_calc"]
    project.used_library_calc = prj_in["project"]["used_library_calc"]
    project.modelica_info.start_time = prj_in["project"]["modelica_info"][
        "start_time"]
    project.modelica_info.stop_time = prj_in["project"]["modelica_info"][
        "stop_time"]
    project.modelica_info.interval_output = prj_in["project"]["modelica_info"][
        "interval_output"]
    project.modelica_info.current_solver = prj_in["project"]["modelica_info"][
        "current_solver"]
    project.modelica_info.equidistant_output = prj_in["project"][
        "modelica_info"]["equidistant_output"]
    project.modelica_info.results_at_events = prj_in["project"][
        "modelica_info"]["results_at_events"]
    project.modelica_info.version = prj_in["project"]["modelica_info"][
        "version"]

    for bldg_name, bldg_in in prj_in["project"]["buildings"].items():
        bl_class = __building_class[bldg_in["classification"]
                                    ["class"]]["teaser_class"]
        bldg = bl_class(parent=project)
        bldg.name = bldg_name
        bldg.street_name = bldg_in["street_name"]
        bldg.city = bldg_in["city"]
        bldg.year_of_construction = bldg_in["year_of_construction"]
        bldg.year_of_retrofit = bldg_in["year_of_retrofit"]
        bldg.number_of_floors = bldg_in["number_of_floors"]
        bldg.height_of_floors = bldg_in["height_of_floors"]
        # bldg.net_leased_area = bldg_in["net_leased_area"]
        bldg.outer_area = bldg_in["outer_area"]
        bldg.window_area = bldg_in["window_area"]

        try:
            bldg.central_ahu = BuildingAHU(parent=bldg)
            bldg.central_ahu.heating = bldg_in["central_ahu"]["heating"]
            bldg.central_ahu.cooling = bldg_in["central_ahu"]["cooling"]
            bldg.central_ahu.dehumidification = bldg_in["central_ahu"][
                "dehumidification"]
            bldg.central_ahu.humidification = bldg_in["central_ahu"][
                "humidification"]
            bldg.central_ahu.heat_recovery = bldg_in["central_ahu"][
                "heat_recovery"]
            bldg.central_ahu.by_pass_dehumidification = bldg_in["central_ahu"][
                "by_pass_dehumidification"]
            bldg.central_ahu.efficiency_recovery = bldg_in["central_ahu"][
                "efficiency_recovery"]
            bldg.central_ahu.efficiency_recovery_false = bldg_in[
                "central_ahu"]["efficiency_recovery_false"]
            bldg.central_ahu.min_relative_humidity_profile = bldg_in[
                "central_ahu"]["min_relative_humidity_profile"]
            bldg.central_ahu.max_relative_humidity_profile = bldg_in[
                "central_ahu"]["max_relative_humidity_profile"]
            bldg.central_ahu.v_flow_profile = bldg_in["central_ahu"][
                "v_flow_profile"]
            bldg.central_ahu.temperature_profile = bldg_in["central_ahu"][
                "temperature_profile"]
        except KeyError:
            pass

        for tz_name, zone_in in bldg_in["thermal_zones"].items():
            tz = ThermalZone(parent=bldg)
            tz.name = tz_name
            tz.area = zone_in["area"]
            tz.volume = zone_in["volume"]
            tz.use_conditions = UseConditions(parent=tz)
            tz.use_conditions.usage = zone_in["use_conditions"]["usage"]
            tz.use_conditions.typical_length = zone_in["use_conditions"][
                "typical_length"]
            tz.use_conditions.typical_width = zone_in["use_conditions"][
                "typical_width"]
            tz.use_conditions.with_heating = zone_in["use_conditions"][
                "with_heating"]
            tz.use_conditions.with_cooling = zone_in["use_conditions"][
                "with_cooling"]
            tz.use_conditions.with_ideal_thresholds = zone_in[
                "use_conditions"]["with_ideal_thresholds"]
            tz.use_conditions.T_threshold_heating = zone_in["use_conditions"][
                "T_threshold_heating"]
            tz.use_conditions.T_threshold_cooling = zone_in["use_conditions"][
                "T_threshold_cooling"]
            tz.use_conditions.fixed_heat_flow_rate_persons = zone_in[
                "use_conditions"]["fixed_heat_flow_rate_persons"]
            tz.use_conditions.activity_degree_persons = zone_in[
                "use_conditions"]["activity_degree_persons"]
            tz.use_conditions.persons = zone_in["use_conditions"]["persons"]
            tz.use_conditions.internal_gains_moisture_no_people = zone_in[
                "use_conditions"]["internal_gains_moisture_no_people"]
            tz.use_conditions.ratio_conv_rad_persons = zone_in[
                "use_conditions"]["ratio_conv_rad_persons"]
            tz.use_conditions.machines = zone_in["use_conditions"]["machines"]
            tz.use_conditions.ratio_conv_rad_machines = zone_in[
                "use_conditions"]["ratio_conv_rad_machines"]
            tz.use_conditions.lighting_power = zone_in["use_conditions"][
                "lighting_power"]
            tz.use_conditions.ratio_conv_rad_lighting = zone_in[
                "use_conditions"]["ratio_conv_rad_lighting"]
            tz.use_conditions.use_constant_infiltration = zone_in[
                "use_conditions"]["use_constant_infiltration"]
            tz.use_conditions.infiltration_rate = zone_in["use_conditions"][
                "infiltration_rate"]
            tz.use_conditions.max_user_infiltration = zone_in[
                "use_conditions"]["max_user_infiltration"]
            tz.use_conditions.max_overheating_infiltration = zone_in[
                "use_conditions"]["max_overheating_infiltration"]
            tz.use_conditions.max_summer_infiltration = zone_in[
                "use_conditions"]["max_summer_infiltration"]
            tz.use_conditions.winter_reduction_infiltration = zone_in[
                "use_conditions"]["winter_reduction_infiltration"]
            tz.use_conditions.min_ahu = zone_in["use_conditions"]["min_ahu"]
            tz.use_conditions.max_ahu = zone_in["use_conditions"]["max_ahu"]
            tz.use_conditions.with_ahu = zone_in["use_conditions"]["with_ahu"]
            tz.use_conditions.heating_profile = zone_in["use_conditions"][
                "heating_profile"]
            tz.use_conditions.cooling_profile = zone_in["use_conditions"][
                "cooling_profile"]
            tz.use_conditions.persons_profile = zone_in["use_conditions"][
                "persons_profile"]
            tz.use_conditions.machines_profile = zone_in["use_conditions"][
                "machines_profile"]
            tz.use_conditions.lighting_profile = zone_in["use_conditions"][
                "lighting_profile"]

            for wall_name, wall_in in zone_in["outer_walls"].items():
                out_wall = OuterWall(parent=tz)
                out_wall.name = wall_name
                set_basic_data_teaser(wall_in, out_wall)
                set_layer_data_teaser(wall_in, out_wall)
            for door_name, door_in in zone_in["doors"].items():
                door = Door(parent=tz)
                door.name = door_name
                set_basic_data_teaser(door_in, door)
                set_layer_data_teaser(door_in, door)
            for roof_name, roof_in in zone_in["rooftops"].items():
                roof = Rooftop(parent=tz)
                roof.name = roof_name
                set_basic_data_teaser(roof_in, roof)
                set_layer_data_teaser(roof_in, roof)
            for gf_name, gf_in in zone_in["ground_floors"].items():
                gf = GroundFloor(parent=tz)
                gf.name = gf_name
                set_basic_data_teaser(gf_in, gf)
                set_layer_data_teaser(gf_in, gf)
            for win_name, win_in in zone_in["windows"].items():
                win = Window(parent=tz)
                win.name = win_name
                set_basic_data_teaser(win_in, win)
                set_layer_data_teaser(win_in, win)
            for iw_name, iw_in in zone_in["inner_walls"].items():
                in_wall = InnerWall(parent=tz)
                in_wall.name = iw_name
                set_basic_data_teaser(iw_in, in_wall)
                set_layer_data_teaser(iw_in, in_wall)
            for fl_name, fl_in in zone_in["floors"].items():
                floor = Floor(parent=tz)
                floor.name = fl_name
                set_basic_data_teaser(fl_in, floor)
                set_layer_data_teaser(fl_in, floor)
            for cl_name, cl_in in zone_in["ceilings"].items():
                ceil = Ceiling(parent=tz)
                ceil.name = cl_name
                set_basic_data_teaser(cl_in, ceil)
                set_layer_data_teaser(cl_in, ceil)
Example #10
0
    def generate_archetype(self):
        """Generates a residential building.

        With given values, this class generates a type residential
        building according to TEASER requirements.

        """
        # help area for the correct building area setting while using typeBldgs
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0

        self._est_ground_floor_area = type_bldg_area / self.number_of_floors

        self._est_roof_area = type_bldg_area / self.number_of_floors

        self._est_win_area = self.est_factor_win_area * type_bldg_area * \
                             (1 - self._est_factor_neighbour / 4)

        self._est_outer_wall_area = (self.est_factor_facade_to_volume *
            type_bldg_area *
            self.height_of_floors -
            self._est_ground_floor_area -
            self._est_roof_area -
            self._est_win_area)*(1 - self._est_factor_neighbour / 4)

        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.name = key
            zone.area = type_bldg_area * value[0]
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1])

            zone.use_conditions = use_cond

        for key, value in self.outer_wall_names.items():
            # North and South

            if value[1] == 0 or value[1] == 180.0:
                self.outer_area[value[1]] = self._est_outer_wall_area / \
                                            self.nr_of_orientation
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area / \
                                            self.nr_of_orientation

            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area / \
                                             self.nr_of_orientation

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area / \
                                             self.nr_of_orientation

            '''
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime
            '''
            for zone in self.thermal_zones:
                window = Window(zone)

                window.load_type_element(self.year_of_construction,
                                         "Kunststofffenster, Isolierverglasung"
                                         )
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(self.year_of_construction,
                                       self.construction_type)
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_ground_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(self.year_of_construction,
                                               self.construction_type)
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]
                # zone.inner_walls.append(inner_wall)

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(self.year_of_construction,
                                              self.construction_type)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(self.year_of_construction,
                                            self.construction_type)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
                    # zone.inner_walls.append(floor)
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #11
0
    def generate_archetype(self):
        """Generates a residential building.

        With given values, this class generates a type residential
        building according to TEASER requirements.

        """
        # help area for the correct building area setting while using typeBldgs
        self.thermal_zones = None
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0

        self._est_ground_floor_area = type_bldg_area / self.number_of_floors

        self._est_roof_area = type_bldg_area / self.number_of_floors

        self._est_win_area = self.est_factor_win_area * type_bldg_area * \
            (1 - self._est_factor_neighbour / 4)

        self._est_outer_wall_area = (self.est_factor_facade_to_volume *
                                     type_bldg_area *
                                     self.height_of_floors -
                                     self._est_ground_floor_area -
                                     self._est_roof_area -
                                     self._est_win_area) *\
            (1 - self._est_factor_neighbour / 4)

        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.name = key
            zone.area = type_bldg_area * value[0]
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1])

            zone.use_conditions = use_cond

        for key, value in self.outer_wall_names.items():
            # North and South

            if value[1] == 0 or value[1] == 180.0:
                self.outer_area[value[1]] = self._est_outer_wall_area / \
                    self.nr_of_orientation
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area / \
                    self.nr_of_orientation

            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area / \
                    self.nr_of_orientation

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area / \
                    self.nr_of_orientation
            '''
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime
            '''
            for zone in self.thermal_zones:
                window = Window(zone)

                window.load_type_element(
                    self.year_of_construction,
                    "Kunststofffenster, Isolierverglasung")
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(self.year_of_construction,
                                       self.construction_type)
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_ground_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(self.year_of_construction,
                                               self.construction_type)
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]
                # zone.inner_walls.append(inner_wall)

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(self.year_of_construction,
                                              self.construction_type)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(self.year_of_construction,
                                            self.construction_type)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
                    # zone.inner_walls.append(floor)
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #12
0
    def generate_from_gml(self):
        """enriches lod1 or lod2 data from citygml

        adds Zones, BoundaryConditions, Material settings for walls and
        windows to the geometric representation of CityGML

        number or height of floors need to be specified
        """

        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0
        # create zones with their corresponding area, name and usage
        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.area = type_bldg_area * value[0]
            zone.name = key
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1])
            zone.use_conditions = use_cond
            zone.use_conditions.with_ahu = False
            zone.use_conditions.persons *= zone.area * 0.01
            zone.use_conditions.machines *= zone.area * 0.01

            for surface in self.gml_surfaces:
                if surface.surface_tilt == 90:
                    outer_wall = OuterWall(zone)
                    outer_wall.load_type_element(self.year_of_construction,
                                                 self.construction_type)
                    outer_wall.name = surface.name
                    outer_wall.tilt = surface.surface_tilt
                    outer_wall.orientation = surface.surface_orientation

                    window = Window(zone)
                    window.load_type_element(self.year_of_construction,
                                            "Kunststofffenster, Isolierverglasung")
                    window.name = "asd"+str(surface.surface_tilt)
                    window.tilt = surface.surface_tilt
                    window.orientation = surface.surface_orientation

                elif surface.surface_tilt == 0 and surface.surface_orientation ==\
                        -2:
                    outer_wall = GroundFloor(zone)
                    outer_wall.load_type_element(self.year_of_construction,
                                                 self.construction_type)
                    outer_wall.name = surface.name
                    outer_wall.tilt = surface.surface_tilt
                    outer_wall.orientation = surface.surface_orientation

                else:
                    outer_wall = Rooftop(zone)
                    outer_wall.load_type_element(self.year_of_construction,
                                                 self.construction_type)
                    outer_wall.name = surface.name
                    outer_wall.tilt = surface.surface_tilt
                    outer_wall.orientation = surface.surface_orientation

            for key, value in self.inner_wall_names.items():

                for zone in self.thermal_zones:
                    inner_wall = InnerWall(zone)
                    inner_wall.load_type_element(self.year_of_construction,
                                                 self.construction_type)
                    inner_wall.name = key
                    inner_wall.tilt = value[0]
                    inner_wall.orientation = value[1]

            if self.number_of_floors > 1:

                for key, value in self.ceiling_names.items():

                    for zone in self.thermal_zones:
                        ceiling = Ceiling(zone)
                        ceiling.load_type_element(self.year_of_construction,
                                                  self.construction_type)
                        ceiling.name = key
                        ceiling.tilt = value[0]
                        ceiling.orientation = value[1]

                for key, value in self.floor_names.items():

                    for zone in self.thermal_zones:
                        floor = Floor(zone)
                        floor.load_type_element(self.year_of_construction,
                                                self.construction_type)
                        floor.name = key
                        floor.tilt = value[0]
                        floor.orientation = value[1]
            else:
                pass

        for surface in self.gml_surfaces:
            self.set_outer_wall_area(surface.surface_area *
                                     (1- self.est_factor_win_area),
                                     surface.surface_orientation)
        for surface in self.gml_surfaces:

            if surface.surface_tilt != 0 and surface.surface_orientation !=\
                    -2 and surface.surface_orientation != -1:
                self.set_window_area(surface.surface_area *
                                     self.est_factor_win_area,
                                     surface.surface_orientation)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #13
0
    def generate_archetype(self):
        '''Generates a residential building.

        With given values, this class generates a type residential
        building according to TEASER requirements
        Berechnungsgrundlagen: IWU, "Kurzverfahren Energieprofil"; 2005.

        '''
        #help area for the correct building area setting while using typeBldgs
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0

        self._number_of_heated_floors = self._est_factor_heated_cellar + \
                    self.number_of_floors + self.est_living_area_factor\
                     *self._est_factor_heated_attic

        self._living_area_per_floor = type_bldg_area / \
                self._number_of_heated_floors

        self._est_ground_floor_area = self.est_bottom_building_closure * \
                    self._living_area_per_floor

        self._est_roof_area = self.est_upper_building_closure * \
                self._est_factor_dormer * self._est_area_per_floor * \
                self._living_area_per_floor

        self._top_floor_area = self._est_area_per_roof * \
                self._living_area_per_floor

        if self._est_roof_area == 0:
            self._est_roof_area = self._top_floor_area

        self._est_facade_area = self._est_facade_to_floor_area * \
                self._living_area_per_floor + self._est_extra_floor_area

        self._est_win_area = self.est_factor_win_area * type_bldg_area

        self._est_cellar_wall_area = self.est_factor_cellar_area * \
                self._est_factor_heated_cellar * self._est_facade_area

        self._est_outer_wall_area = (self._number_of_heated_floors * \
                self._est_facade_area) - self._est_cellar_wall_area - \
                self._est_win_area

        # self._est_factor_volume = type_bldg_area * 2.5

        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.name = key
            zone.area = type_bldg_area * value[0]
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1])

            zone.use_conditions = use_cond

        for key, value in self.outer_wall_names.items():
            # North and South

            if value[1] == 0 or value[1] == 180.0:
                self.outer_area[value[1]] = self._est_outer_wall_area / \
                        self.nr_of_orientation
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area / \
                        self.nr_of_orientation

            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area / \
                        self.nr_of_orientation

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area / \
                        self.nr_of_orientation

            '''
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime
            '''
            for zone in self.thermal_zones:
                window = Window(zone)

                window.load_type_element(self.year_of_construction,
                                        "Kunststofffenster, Isolierverglasung")
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(self.year_of_construction, \
                                       self.construction_type)
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_ground_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(self.year_of_construction, \
                                               self.construction_type)
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(self.year_of_construction,
                                             self.construction_type)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]
                # zone.inner_walls.append(inner_wall)

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(self.year_of_construction,
                                              self.construction_type)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(self.year_of_construction,
                                            self.construction_type)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
                    # zone.inner_walls.append(floor)
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()
Example #14
0
    def generate_archetype(self):
        '''Generates an office building.

        With given values, this class generates a type building according to
        TEASER requirements.

        '''
        #help area for the correct building area setting while using typeBldgs
        type_bldg_area = self.net_leased_area
        self.net_leased_area = 0.0
        # create zones with their corresponding area, name and usage
        for key, value in self.zone_area_factors.items():
            zone = ThermalZone(self)
            zone.area = type_bldg_area * value[0]
            zone.name = key
            use_cond = UseCond(zone)
            use_cond.load_use_conditions(value[1],
                                         data_class=self.parent.data)
            zone.use_conditions = use_cond

            zone.use_conditions.persons = zone.area * 0.01 * \
                zone.use_conditions.persons
            zone.use_conditions.machines = zone.area * 0.01 * \
                zone.use_conditions.machines

            # self.thermal_zones.append(zone)

        # statistical estimation of the facade

        self._est_outer_wall_area = self.est_factor_wall_area * \
                                type_bldg_area ** self.est_exponent_wall
        self._est_win_area = self.est_factor_win_area * \
                             type_bldg_area ** self.est_exponent_win
        self._est_roof_area = (type_bldg_area / self.number_of_floors) * \
                              self.gross_factor
        self._est_floor_area = (type_bldg_area / self.number_of_floors) * \
                               self.gross_factor

        # manipulation of wall according to facade design
        # (received from window_layout)

        self._est_facade_area = self._est_outer_wall_area + self._est_win_area

        if not self.window_layout == 0:
            self._est_outer_wall_area = self._est_facade_area * \
                                        self.corr_factor_wall
            self._est_win_area = self._est_facade_area * self.corr_factor_win
        else:
            pass

        # set the facade area to the four orientations

        for key, value in self.outer_wall_names.items():
            # North and South
            if value[1] == 0 or value[1] == 180:
                self.outer_area[value[1]] = self._est_outer_wall_area * \
                 (self._est_length / (2 * self._est_width + 2 * self._est_length))
            # East and West
            elif value[1] == 90 or value[1] == 270:

                self.outer_area[value[1]] = self._est_outer_wall_area * \
                (self._est_width / (2 * self._est_width + 2 * self._est_length))
            for zone in self.thermal_zones:
                # create wall and set building elements
                outer_wall = OuterWall(zone)
                outer_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                outer_wall.name = key
                outer_wall.tilt = value[0]
                outer_wall.orientation = value[1]

        for key, value in self.window_names.items():

            if value[1] == 0 or value[1] == 180:

                self.window_area[value[1]] = self._est_win_area * \
                (self._est_length / (2 * self._est_width + 2 * self._est_length))

            elif value[1] == 90 or value[1] == 270:

                self.window_area[value[1]] = self._est_win_area * \
                (self._est_width / (2 * self._est_width + 2 * self._est_length))

            '''
            There is no real classification for windows, so this is a bit hard
            code - will be fixed sometime.
            '''
            for zone in self.thermal_zones:
                window = Window(zone)
                window.load_type_element(self.year_of_construction,
                                        "Kunststofffenster, Isolierverglasung",
                                        data_class=self.parent.data)
                window.name = key
                window.tilt = value[0]
                window.orientation = value[1]

        for key, value in self.roof_names.items():

            self.outer_area[value[1]] = self._est_roof_area

            for zone in self.thermal_zones:
                roof = Rooftop(zone)
                roof.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                roof.name = key
                roof.tilt = value[0]
                roof.orientation = value[1]
                # zone.outer_walls.append(roof)

        for key, value in self.ground_floor_names.items():

            self.outer_area[value[1]] = self._est_floor_area

            for zone in self.thermal_zones:
                ground_floor = GroundFloor(zone)
                ground_floor.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                ground_floor.name = key
                ground_floor.tilt = value[0]
                ground_floor.orientation = value[1]
                # zone.outer_walls.append(ground_floor)

        for key, value in self.inner_wall_names.items():

            for zone in self.thermal_zones:
                inner_wall = InnerWall(zone)
                inner_wall.load_type_element(
                    year=self.year_of_construction,
                    construction=self.construction_type,
                    data_class=self.parent.data)
                inner_wall.name = key
                inner_wall.tilt = value[0]
                inner_wall.orientation = value[1]
                # zone.inner_walls.append(inner_wall)

        if self.number_of_floors > 1:

            for key, value in self.ceiling_names.items():

                for zone in self.thermal_zones:
                    ceiling = Ceiling(zone)
                    ceiling.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data)
                    ceiling.name = key
                    ceiling.tilt = value[0]
                    ceiling.orientation = value[1]
                    # zone.inner_walls.append(ceiling)

            for key, value in self.floor_names.items():

                for zone in self.thermal_zones:
                    floor = Floor(zone)
                    floor.load_type_element(
                        year=self.year_of_construction,
                        construction=self.construction_type,
                        data_class=self.parent.data)
                    floor.name = key
                    floor.tilt = value[0]
                    floor.orientation = value[1]
                    # zone.inner_walls.append(floor)
        else:
            pass

        for key, value in self.outer_area.items():
            self.set_outer_wall_area(value, key)
        for key, value in self.window_area.items():
            self.set_window_area(value, key)

        for zone in self.thermal_zones:
            zone.set_inner_wall_area()
            zone.set_volume_zone()