Пример #1
0
    def with_ahu(self, value):

        if value is True and self.central_ahu is None:
            self.central_ahu = BuildingAHU(self)
            self._with_ahu = True
        elif value is False and self.central_ahu:
            self.central_ahu = None
            self._with_ahu = False
Пример #2
0
    def __init__(
        self,
        parent=None,
        name=None,
        year_of_construction=None,
        net_leased_area=None,
        with_ahu=False,
        internal_gains_mode=1,
    ):
        """Constructor of Building Class
        """

        self.parent = parent
        self.name = name
        self.year_of_construction = year_of_construction
        self.net_leased_area = net_leased_area
        self._with_ahu = with_ahu

        if with_ahu is True:
            self.central_ahu = BuildingAHU(self)
        else:
            self._central_ahu = None

        self.internal_gains_mode = internal_gains_mode
        self.number_of_floors = None
        self.height_of_floors = None
        self.internal_id = random.random()
        self._year_of_retrofit = None
        self.type_of_building = type(self).__name__
        self.building_id = None
        self.street_name = ""
        self.city = ""
        self.longitude = 6.05
        self.latitude = 50.79

        self._thermal_zones = []
        self._outer_area = {}
        self._window_area = {}

        self.bldg_height = None
        self.volume = 0
        self.sum_heat_load = 0
        self.sum_cooling_load = 0
        self._number_of_elements_calc = 2
        self._merge_windows_calc = False
        self._used_library_calc = "AixLib"

        self.library_attr = None
Пример #3
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)
Пример #4
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)