def get_sample_win_constr(ureg: pint.UnitRegistry):
    win_frame = WindowFrameConstruction(
        name="window_frame_fixed_cesar-p",
        short_name="window_frame_fixed_cesar-p",
        frame_conductance=9.5 * ureg.W / ureg.m**2 / ureg.K,
        frame_solar_absorptance=0.5 * ureg.dimensionless,
        frame_visible_absorptance=0.5 * ureg.dimensionless,
        outside_reveal_solar_absorptance=0.5 * ureg.dimensionless,
        emb_co2_emission_per_m2=None,
        emb_non_ren_primary_energy_per_m2=None)

    win_shade = WindowShadingMaterial(
        True, "Shade0101", ureg("0.31 solar_transmittance"),
        ureg("0.5 solar_reflectance"), ureg("0.31 visible_transmittance"),
        ureg("0.5 visible_reflectance"),
        ureg("0.9 infrared_hemispherical_emissivity"),
        ureg("0.0 infrared_transmittance"), ureg("0.9 W/(m*K)"),
        ureg("0.001 m"), ureg("0.1 m"), 0, 0, 0, 0, 0)

    win_air_layer = WindowLayer(name="WindowAirGap",
                                material=get_sample_gas(ureg),
                                thickness=0.02 * ureg.m)
    win_glass_layer = WindowLayer(name="TestGlazing",
                                  material=get_sample_win_glazing_mat(ureg),
                                  thickness=0.006 * ureg.m)

    win_constr_name = "My_Window_Glass_Constr_Test"
    return WindowConstruction(
        frame=win_frame,
        glass=WindowGlassConstruction(
            name=win_constr_name,
            layers=[win_glass_layer, win_air_layer, win_glass_layer],
            emb_co2_emission_per_m2=None,
            emb_non_ren_primary_energy_per_m2=None),
        shade=win_shade)
    def get_retrofitted_window(
            self, base_win_constr: WindowConstruction) -> WindowConstruction:
        """
        To define retrofit construction the retrofit regulation and target set in the configuration-YML under
        RETROFIT are used.

        raises LookupError if no retrofit construction was found
        :param base_win_constr: window for which to get retrofitted window construction
        :return: new WindowConstruction object which can be used as retrofit for the passed one.
        """

        assert isinstance(base_win_constr.glass, WindowGlassConstruction), (
            f"Retrofit can only handle fully specified "
            f"window glasses of type WindowGlassConstruction"
            f", but {type(base_win_constr)} was passed."
            f"Try changing data source to GraphDB in manager "
            f"config.")
        retrofitted_glass = self._graph_access.get_retrofitted_window_glass(
            base_win_constr.glass)
        retrofitted_win = WindowConstruction(
            glass=retrofitted_glass,
            frame=copy.deepcopy(base_win_constr.frame),
            shade=copy.deepcopy(base_win_constr.shade))

        return retrofitted_win
Esempio n. 3
0
def test_window_costs_not_defined():
    ureg = cesarp.common.init_unit_registry()
    retCosts = ConstructionRetrofitCosts(ureg, {})
    glass_constr = WindowGlassConstruction(
        "http://uesl_data/sources/archetypes/windows/AFancyWindow", None, None,
        None)
    ret_win = WindowConstruction(glass=glass_constr, frame=None, shade=None)
    assert retCosts.get_costs_for_window_retrofit(
        ret_win) == 0 * ureg.CHF / ureg.m**2
Esempio n. 4
0
def test_window_costs():
    ureg = cesarp.common.init_unit_registry()
    retCosts = ConstructionRetrofitCosts(ureg, {})
    glass_constr = WindowGlassConstruction(
        "http://uesl_data/sources/archetypes/windows/Window2014_DoubleLowE_Air_Triple",
        None, None, None)
    ret_win = WindowConstruction(glass=glass_constr, frame=None, shade=None)
    assert retCosts.get_costs_for_window_retrofit(
        ret_win) == 1000 * ureg.CHF / ureg.m**2
def get_mock_window_construction_for_emission_calc(ureg: pint.UnitRegistry):
    glass = WindowGlassConstruction(
        name=None,
        layers=None,
        emb_co2_emission_per_kg=57.6 * ureg.kg * ureg.CO2eq / ureg.m**2,
        emb_non_ren_primary_energy_per_kg=837 * ureg.MJ * ureg.Oileq /
        ureg.m**2,
    )
    frame = WindowFrameConstruction(
        emb_co2_emission_per_m2=256 * ureg.kg * ureg.CO2eq / ureg.m**2,
        emb_non_ren_primary_energy_per_m2=3740 * ureg.MJ * ureg.Oileq /
        ureg.m**2)
    return WindowConstruction(name="winconstrtest", glass=glass, frame=frame)
Esempio n. 6
0
def test_win_glass_emissions():
    ureg = cesarp.common.init_unit_registry()
    ret_em = RetrofitEmbodiedEmissions(ureg)
    win_glass_emb_co2 = 32.2 * ureg.kg * ureg.CO2eq / ureg.m**2
    test_win = WindowConstruction(
        frame=None,
        glass=WindowGlassConstruction(
            name=
            "http://uesl_data/sources/archetypes/windows/Window2001_LowE_Xenon_Double",
            layers=None,
            emb_co2_emission_per_m2=win_glass_emb_co2,
            emb_non_ren_primary_energy_per_m2=None),
        shade=None)
    assert ret_em.get_win_ret_glass_emb_co2(test_win) == win_glass_emb_co2
    assert ret_em.get_win_ret_glass_emb_non_renewable_pen(test_win) == None
def sample_model_with_constr():
    ureg = cesarp.common.init_unit_registry()
    ground_temps = SiteGroundTemperatures(
        building_surface=18 * ureg.degreeC,
        shallow=17 * ureg.degreeC,
        deep=15 * ureg.degreeC,
        ground_temp_per_month=[10, 11, 12, 13, 15, 20, 22, 25, 21, 19, 17, 12
                               ] * ureg.degreeC)
    site = Site(weather_file_path="theWeather.epw",
                site_ground_temperatures=ground_temps,
                simulation_year=2020)

    win_frame = WindowFrameConstruction(
        name="window_frame_fixed_cesar-p",
        short_name="window_frame_fixed_cesar-p",
        frame_conductance=9.5 * ureg.W / ureg.m**2 / ureg.K,
        frame_solar_absorptance=0.5 * ureg.dimensionless,
        frame_visible_absorptance=0.5 * ureg.dimensionless,
        outside_reveal_solar_absorptance=0.5 * ureg.dimensionless,
        emb_co2_emission_per_m2=2 * ureg.kg * ureg.CO2eq / ureg.m**2,
        emb_non_ren_primary_energy_per_m2=0.5 * ureg.MJ * ureg.Oileq /
        ureg.m**2)

    win_shade = WindowShadingMaterial(
        True, "Shade0101", ureg("0.31 solar_transmittance"),
        ureg("0.5 solar_reflectance"), ureg("0.31 visible_transmittance"),
        ureg("0.5 visible_reflectance"),
        ureg("0.9 infrared_hemispherical_emissivity"),
        ureg("0.0 infrared_transmittance"), ureg("0.9 W/(m*K)"),
        ureg("0.001 m"), ureg("0.1 m"), 0, 0, 0, 0, 0)

    test_opaque_material = OpaqueMaterial("material", ureg("10 kg/m3"),
                                          OpaqueMaterialRoughness.ROUGH,
                                          ureg("0.9 solar_absorptance"),
                                          ureg("1200 J/K/kg"),
                                          ureg("0.9 thermal_absorptance"),
                                          ureg("0.9 W/(m*K)"),
                                          ureg("0.9 visible_absorptance"))
    test_transparent_material = TransparentMaterial(
        "glass_material",
        ureg("0.9 back_side_infrared_hemispherical_emissivity"),
        ureg("0.9 back_side_solar_reflectance"),
        ureg("0.9 back_side_visible_reflectance"),
        ureg("0.9 W/(m*K)"),
        ureg("1.0 dirt_correction_factor"),
        ureg("0.9 front_side_infrared_hemispherical_emissivity"),
        ureg("0.9 front_side_solar_reflectance"),
        ureg("0.9 front_side_visible_reflectance"),
        ureg("0.0 infrared_transmittance"),
        ureg("0.31 solar_transmittance"),
        ureg("0.31 visible_transmittance"),
    )
    roof_constr = Construction(
        "Roof", [Layer("Roof_L1", ureg("0.3m"), test_opaque_material)],
        BuildingElement.ROOF)
    wall_constr = Construction(
        "Wall", [Layer("Wall_L1", ureg("0.3m"), test_opaque_material)],
        BuildingElement.WALL)
    ground_constr = Construction(
        "Ground", [Layer("Ground_L1", ureg("0.3m"), test_opaque_material)],
        BuildingElement.GROUNDFLOOR)
    internal_ceiling_constr = Construction(
        "InternalCeiling",
        [Layer("InternalCeiling_L1", ureg("0.3m"), test_opaque_material)],
        BuildingElement.INTERNAL_CEILING)
    window_glas_constr = WindowGlassConstruction(
        "Glass",
        [WindowLayer("Glass_L1", ureg("0.02m"), test_transparent_material)])

    construction = BuildingConstruction(
        # NOTE: reusing the same ConstructionAsIDF object or path's as WindowPath breks pickling/unpickling because jsonpickle recognizes them as same objects but does not unpickle it correct....
        window_construction=WindowConstruction(glass=window_glas_constr,
                                               frame=win_frame,
                                               shade=win_shade),
        roof_constr=roof_constr,
        groundfloor_constr=ground_constr,
        wall_constr=wall_constr,
        internal_ceiling_constr=internal_ceiling_constr,
        glazing_ratio=0.3,
        infiltration_rate=0.6 * ureg.ACH,
        infiltration_profile=ScheduleFixedValue(
            1 * ureg.dimensionless,
            cesarp.common.ScheduleTypeLimits.FRACTION()),
        installation_characteristics=InstallationsCharacteristics(
            fraction_radiant_from_activity=0.3 * ureg.dimensionless,
            lighting_characteristics=LightingCharacteristics(
                0.4 * ureg.dimensionless, 0.2 * ureg.dimensionless,
                0.2 * ureg.dimensionless),
            dhw_fraction_lost=0.4 * ureg.dimensionless,
            electric_appliances_fraction_radiant=0.2 * ureg.dimensionless,
            e_carrier_heating=EnergySource.WOOD,
            e_carrier_dhw=EnergySource.SOLAR_THERMAL),
    )
    fract_type = cesarp.common.ScheduleTypeLimits.FRACTION()
    cooling_sched = get_schedule_file(
        "cooling.csv", ureg.dimensionless,
        cesarp.common.ScheduleTypeLimits.TEMPERATURE())

    geom_fact = GeometryBuilderFactory(
        read_sitevertices_from_csv(
            os.path.dirname(__file__) / Path("./testfixture/SiteVertices.csv"),
            {
                'gis_fid': "TARGET_FID",
                'height': "HEIGHT",
                'x': 'POINT_X',
                'y': 'POINT_Y'
            }), {"GEOMETRY": {
                "NEIGHBOURHOOD": {
                    "RADIUS": 100
                }
            }})
    geom_builder = geom_fact.get_geometry_builder(5, 0.3)
    bldg_shape_detailed = geom_builder.get_bldg_shape_detailed()
    neighbours = geom_builder.get_bldg_shape_of_neighbours()

    neighbours_construction_props = {
        BuildingElement.WALL.name:
        ShadingObjectConstruction(
            diffuse_solar_reflectance_unglazed_part=0.3 *
            ureg.diffuse_solar_reflectance,
            diffuse_visible_reflectance_unglazed_part=0.3 *
            ureg.diffuse_visible_reflectance,
            glazing_ratio=0.3 * ureg.dimensionless,
            window_glass_construction=construction.window_constr.glass),
        BuildingElement.ROOF.name:
        ShadingObjectConstruction(
            diffuse_solar_reflectance_unglazed_part=0.15 *
            ureg.diffuse_solar_reflectance,
            diffuse_visible_reflectance_unglazed_part=0.17 *
            ureg.diffuse_visible_reflectance,
            glazing_ratio=0 * ureg.dimensionless,
            window_glass_construction=construction.window_constr.glass),
    }

    operation = BuildingOperation(
        name="test",
        occupancy=Occupancy(floor_area_per_person=50 * ureg.m**2 / ureg.person,
                            occupancy_fraction_schedule=get_schedule_file(
                                "occupancy.csv", ureg.dimensionless,
                                fract_type),
                            activity_schedule=get_schedule_file(
                                "activity.csv", ureg.W / ureg.person,
                                cesarp.common.ScheduleTypeLimits.ANY())),
        electric_appliances=InstallationOperation(
            get_schedule_file("electirc_appliance.csv", ureg.dimensionless,
                              fract_type), 3 * ureg.watt / ureg.m**2),
        lighting=InstallationOperation(
            get_schedule_file("lighting.csv", ureg.dimensionless, fract_type),
            1.2 * ureg.watt / ureg.m**2),
        dhw=InstallationOperation(
            get_schedule_file("dhw.csv", ureg.dimensionless, fract_type),
            12 * ureg.watt / ureg.m**2),
        hvac_operation=HVACOperation(
            heating_setpoint_schedule=get_schedule_file(
                "heating.csv", ureg.dimensionless,
                cesarp.common.ScheduleTypeLimits.TEMPERATURE()),
            cooling_setpoint_schedule=cooling_sched,
            ventilation_fraction_schedule=get_schedule_file(
                "ventilation.csv", ureg.dimensionless, fract_type),
            outdoor_air_flow_per_zone_floor_area=3.2 * ureg.m**3 / ureg.sec /
            ureg.m**2),
        night_vent=NightVent(True, ureg("3.1 ACH"), ureg("20 degreeC"),
                             ureg("2 degreeC"), ureg("5.5 m/sec"), "20:00",
                             "07:00", cooling_sched),
        win_shading_ctrl=WindowShadingControl(True, False, ureg("90 W/m2"),
                                              "xxx"))

    op_mapping = BuildingOperationMapping()
    op_mapping.add_operation_assignment(
        range(0, bldg_shape_detailed.get_nr_of_floors()), operation)

    return BuildingModel(22, 2015, site, bldg_shape_detailed, neighbours,
                         neighbours_construction_props, construction,
                         op_mapping, BldgType.MFH)
def get_win_constr(name_glass, name_frame):
    return WindowConstruction(
        glass=WindowGlassConstruction(name_glass, None, None, None),
        frame=WindowFrameConstruction(name_frame, None, None, None, None, None,
                                      None, None),
        shade=WindowShadingMaterial.create_empty_unavailable())
Esempio n. 9
0
 def get_window_construction(self):
     return WindowConstruction(frame=self.window_frame_construction,
                               glass=self.__get_window_glass_construction(),
                               shade=self.window_shade_constr)