コード例 #1
0
def test_window_construction_init_shade():
    """Test the initalization of WindowConstruction objects with shades."""
    lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517,
                                             0.359, 0.714, 0.207, 0, 0.84,
                                             0.046578, 1.0)
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    shade_mat = EnergyWindowMaterialShade('Low-e Diffusing Shade', 0.025, 0.15,
                                          0.5, 0.25, 0.5, 0, 0.4, 0.2, 0.1,
                                          0.75, 0.25)
    double_low_e_shade = WindowConstruction(
        'Double Low-E with Shade', [lowe_glass, gap, clear_glass, shade_mat])
    double_low_e_between_shade = WindowConstruction(
        'Double Low-E Between Shade', [lowe_glass, shade_mat, clear_glass])
    double_low_e_ext_shade = WindowConstruction(
        'Double Low-E Outside Shade',
        [shade_mat, lowe_glass, gap, clear_glass])

    assert double_low_e_shade.name == 'Double Low-E with Shade'
    assert double_low_e_shade.u_factor == pytest.approx(0.9091, rel=1e-2)
    assert double_low_e_between_shade.name == 'Double Low-E Between Shade'
    assert double_low_e_between_shade.u_factor == pytest.approx(1.13374,
                                                                rel=1e-2)
    assert double_low_e_ext_shade.name == 'Double Low-E Outside Shade'
    assert double_low_e_ext_shade.u_factor == pytest.approx(0.97678, rel=1e-2)
コード例 #2
0
def test_window_construction_init_blind():
    """Test the initalization of WindowConstruction objects with blinds."""
    lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517,
                                             0.359, 0.714, 0.207, 0, 0.84,
                                             0.046578, 1.0)
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    shade_mat = EnergyWindowMaterialBlind('Plastic Blind', 'Vertical', 0.025,
                                          0.01875, 0.003, 90, 0.2, 0.05, 0.4,
                                          0.05, 0.45, 0, 0.95, 0.1, 1)
    double_low_e_shade = WindowConstruction(
        'Double Low-E with Shade', [lowe_glass, gap, clear_glass, shade_mat])
    double_low_e_between_shade = WindowConstruction(
        'Double Low-E Between Shade', [lowe_glass, shade_mat, clear_glass])
    double_low_e_ext_shade = WindowConstruction(
        'Double Low-E Outside Shade',
        [shade_mat, lowe_glass, gap, clear_glass])

    assert double_low_e_shade.name == 'Double Low-E with Shade'
    assert double_low_e_shade.u_factor == pytest.approx(1.26296, rel=1e-2)
    assert double_low_e_between_shade.name == 'Double Low-E Between Shade'
    assert double_low_e_between_shade.u_factor == pytest.approx(1.416379,
                                                                rel=1e-2)
    assert double_low_e_ext_shade.name == 'Double Low-E Outside Shade'
    assert double_low_e_ext_shade.u_factor == pytest.approx(1.2089, rel=1e-2)
コード例 #3
0
def test_setting_window_construction():
    """Test the setting of aperture and glass door constructions on ConstructionSet."""
    default_set = ConstructionSet('Tinted Window Set')
    tinted_glass = EnergyWindowMaterialGlazing(
        'Tinted Glass', 0.006, 0.35, 0.03, 0.884, 0.0804, 0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('Window Air Gap', thickness=0.0127)
    double_tint = WindowConstruction(
        'Double Tinted Window', [tinted_glass, gap, tinted_glass])
    single_tint = WindowConstruction(
        'Single Tinted Window', [tinted_glass])

    default_set.aperture_set.window_construction = double_tint
    assert default_set.aperture_set.window_construction == double_tint
    assert len(default_set.modified_constructions_unique) == 1
    assert len(default_set.modified_materials_unique) == 2

    assert isinstance(default_set.aperture_set.window_construction[0],
                      EnergyWindowMaterialGlazing)
    with pytest.raises(AttributeError):
        default_set.aperture_set.window_construction[0].thickness = 0.003

    default_set.aperture_set.interior_construction = single_tint
    assert default_set.aperture_set.interior_construction == single_tint
    default_set.aperture_set.skylight_construction = double_tint
    assert default_set.aperture_set.skylight_construction == double_tint
    default_set.aperture_set.operable_construction = double_tint
    assert default_set.aperture_set.operable_construction == double_tint

    default_set.door_set.exterior_glass_construction = double_tint
    assert default_set.door_set.exterior_glass_construction == double_tint
    default_set.door_set.interior_glass_construction = single_tint
    assert default_set.door_set.interior_glass_construction == single_tint

    assert len(default_set.modified_constructions_unique) == 2
    assert len(default_set.modified_materials_unique) == 2
コード例 #4
0
def test_window_temperature_profile():
    """Test the window construction temperature profile."""
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_clear = WindowConstruction(
        'Triple Clear Window',
        [clear_glass, gap, clear_glass, gap, clear_glass])
    temperatures, r_values = triple_clear.temperature_profile()

    assert len(temperatures) == 8
    assert temperatures[0] == pytest.approx(-18, rel=1e-2)
    assert temperatures[-1] == pytest.approx(21, rel=1e-2)
    assert len(r_values) == 7
    assert sum(r_values) == pytest.approx(triple_clear.r_factor, rel=1e-1)
    assert r_values[-1] == pytest.approx((1 / triple_clear.in_h_simple()),
                                         rel=1)

    temperatures, r_values = triple_clear.temperature_profile(
        36, 21, 4, 2., 180.0, 100000)
    assert len(temperatures) == 8
    assert temperatures[0] == pytest.approx(36, rel=1e-2)
    assert temperatures[-1] == pytest.approx(21, rel=1e-2)
    assert len(r_values) == 7
コード例 #5
0
def construction_window_blinds(directory):
    blinds = EnergyWindowMaterialBlind('Generic Aluminium Blinds')
    window_with_blinds = WindowConstruction(
        'Triple Pane Argon', [lowe_glass, argon_gap, lowe_glass, blinds])
    dest_file = os.path.join(directory, 'construction_window_blinds.json')
    with open(dest_file, 'w') as fp:
        json.dump(window_with_blinds.to_dict(abridged=True), fp, indent=4)
コード例 #6
0
def construction_window_triple(directory):
    triple_pane = WindowConstruction(
        'Triple Pane Argon',
        [lowe_glass, argon_gap, lowe_glass, argon_gap, clear_glass])
    dest_file = os.path.join(directory, 'construction_window_triple.json')
    with open(dest_file, 'w') as fp:
        json.dump(triple_pane.to_dict(abridged=True), fp, indent=4)
コード例 #7
0
def model_complete_single_zone_office(directory):
    room = Room.from_box('Tiny_House_Office', 5, 10, 3)
    room.properties.energy.program_type = prog_type_lib.office_program
    room.properties.energy.add_default_ideal_air()

    stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95,
                           0.75, 0.8)
    thermal_mass_constr = OpaqueConstruction('Thermal Mass Floor', [stone])
    room[0].properties.energy.construction = thermal_mass_constr

    south_face = room[3]
    south_face.apertures_by_ratio(0.4, 0.01)
    south_face.apertures[0].overhang(0.5, indoor=False)
    south_face.apertures[0].overhang(0.5, indoor=True)
    south_face.move_shades(Vector3D(0, 0, -0.5))
    light_shelf_out = ShadeConstruction('Outdoor_Light_Shelf', 0.5, 0.5)
    light_shelf_in = ShadeConstruction('Indoor_Light_Shelf', 0.7, 0.7)
    south_face.apertures[0].outdoor_shades[
        0].properties.energy.construction = light_shelf_out
    south_face.apertures[0].indoor_shades[
        0].properties.energy.construction = light_shelf_in

    north_face = room[1]
    north_face.overhang(0.25, indoor=False)
    door_verts = [
        Point3D(2, 10, 0.1),
        Point3D(1, 10, 0.1),
        Point3D(1, 10, 2.5),
        Point3D(2, 10, 2.5)
    ]
    door = Door('Front_Door', Face3D(door_verts))
    north_face.add_door(door)

    aperture_verts = [
        Point3D(4.5, 10, 1),
        Point3D(2.5, 10, 1),
        Point3D(2.5, 10, 2.5),
        Point3D(4.5, 10, 2.5)
    ]
    aperture = Aperture('Front_Aperture', Face3D(aperture_verts))
    triple_pane = WindowConstruction(
        'Triple Pane Window',
        [clear_glass, air_gap, clear_glass, air_gap, clear_glass])
    aperture.properties.energy.construction = triple_pane
    north_face.add_aperture(aperture)

    tree_canopy_geo = Face3D.from_regular_polygon(
        6, 2, Plane(Vector3D(0, 0, 1), Point3D(5, -3, 4)))
    tree_canopy = Shade('Tree_Canopy', tree_canopy_geo)

    table_geo = Face3D.from_rectangle(2, 2, Plane(o=Point3D(1.5, 4, 1)))
    table = Shade('Table', table_geo)
    room.add_indoor_shade(table)

    model = Model('Tiny_House', [room], orphaned_shades=[tree_canopy])

    dest_file = os.path.join(directory,
                             'model_complete_single_zone_office.json')
    with open(dest_file, 'w') as fp:
        json.dump(model.to_dict(), fp, indent=4)
コード例 #8
0
def test_window_shade_equivalency():
    """Test the equality of a WindowConstructionShade construction to another."""
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_clear = WindowConstruction(
        'Double Clear Window', [clear_glass, gap, clear_glass])
    shade_mat = EnergyWindowMaterialShade(
        'Low-e Diffusing Shade', 0.005, 0.15, 0.5, 0.25, 0.5, 0, 0.4,
        0.2, 0.1, 0.75, 0.25)
    sched = ScheduleRuleset.from_daily_values(
        'NighSched', [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 1, 1, 1])
    double_low_e_ec = WindowConstructionShade(
        'Double Low-E Inside EC', double_clear, shade_mat, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)
    double_low_e_ec_2 = double_low_e_ec.duplicate()
    double_low_e_ec_3 = WindowConstructionShade(
        'Double Low-E Inside EC', double_clear, shade_mat, 'Exterior',
        'AlwaysOn', None, sched)

    collection = [double_low_e_ec, double_low_e_ec, double_low_e_ec_2, double_low_e_ec_3]
    assert len(set(collection)) == 2
    assert double_low_e_ec == double_low_e_ec_2
    assert double_low_e_ec != double_low_e_ec_3
    assert double_low_e_ec_2 != double_low_e_ec_3

    double_low_e_ec_2.identifier = 'Cool Window'
    assert double_low_e_ec != double_low_e_ec_2
コード例 #9
0
def test_check_duplicate_construction_names():
    """Test the check_duplicate_construction_names method."""
    room = Room.from_box('Tiny House Zone', 5, 10, 3)

    stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95,
                           0.75, 0.8)
    thermal_mass_constr = OpaqueConstruction('Custom Construction', [stone])
    room[0].properties.energy.construction = thermal_mass_constr

    north_face = room[1]
    aperture_verts = [
        Point3D(4.5, 10, 1),
        Point3D(2.5, 10, 1),
        Point3D(2.5, 10, 2.5),
        Point3D(4.5, 10, 2.5)
    ]
    aperture = Aperture('Front Aperture', Face3D(aperture_verts))
    aperture.is_operable = True
    triple_pane = WindowConstruction(
        'Custom Window Construction',
        [clear_glass, air_gap, clear_glass, air_gap, clear_glass])
    aperture.properties.energy.construction = triple_pane
    north_face.add_aperture(aperture)

    model = Model('Tiny House', [room])

    assert model.properties.energy.check_duplicate_construction_names(False)
    triple_pane.unlock()
    triple_pane.name = 'Custom Construction'
    triple_pane.lock()
    assert not model.properties.energy.check_duplicate_construction_names(
        False)
    with pytest.raises(ValueError):
        model.properties.energy.check_duplicate_construction_names(True)
コード例 #10
0
def test_constructionset_dict_methods():
    """Test the to/from dict methods."""
    insulated_set = ConstructionSet('Insulated Set')
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_clear = WindowConstruction(
        'Triple Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass])

    insulated_set.aperture_set.window_construction = triple_clear
    constr_dict = insulated_set.to_dict()

    assert constr_dict['wall_set']['exterior_construction'] is None
    assert constr_dict['wall_set']['interior_construction'] is None
    assert constr_dict['wall_set']['ground_construction'] is None
    assert constr_dict['floor_set']['exterior_construction'] is None
    assert constr_dict['floor_set']['interior_construction'] is None
    assert constr_dict['floor_set']['ground_construction'] is None
    assert constr_dict['roof_ceiling_set']['exterior_construction'] is None
    assert constr_dict['roof_ceiling_set']['interior_construction'] is None
    assert constr_dict['roof_ceiling_set']['ground_construction'] is None
    assert constr_dict['aperture_set']['window_construction'] is not None
    assert constr_dict['aperture_set']['interior_construction'] is None
    assert constr_dict['aperture_set']['skylight_construction'] is None
    assert constr_dict['aperture_set']['operable_construction'] is None
    assert constr_dict['door_set']['exterior_construction'] is None
    assert constr_dict['door_set']['interior_construction'] is None
    assert constr_dict['door_set']['exterior_glass_construction'] is None
    assert constr_dict['door_set']['interior_glass_construction'] is None
    assert constr_dict['door_set']['overhead_construction'] is None
    assert constr_dict['shade_construction'] is None

    new_constr = ConstructionSet.from_dict(constr_dict)
    assert constr_dict == new_constr.to_dict()
コード例 #11
0
ファイル: windows.py プロジェクト: tejaskumar555/LBT-2-PH
def create_EP_const(_win_EP_material):
    """ Creates an 'E+' style construction for the window

    Args:
        _win_EP_material (): The E+ Material for the window
    Returns:
        constr (): The new E+ Construction for the window
    """

    try:  # import the core honeybee dependencies
        from honeybee.typing import clean_and_id_ep_string
    except ImportError as e:
        raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

    try:  # import the honeybee-energy dependencies
        from honeybee_energy.construction.window import WindowConstruction
        from honeybee_energy.lib.materials import window_material_by_identifier
    except ImportError as e:
        raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))
    
    material_objs = []
    for material in [_win_EP_material]:
        if isinstance(material, str):
            material = window_material_by_identifier(material)
        material_objs.append(material)
    
    name = 'PHPP_CONST_{}'.format(_win_EP_material.display_name)

    constr = WindowConstruction(clean_and_id_ep_string(name), material_objs)
    constr.display_name = name

    return constr
コード例 #12
0
def test_window_shade_lockability():
    """Test the lockability of the WindowConstructionShade construction."""
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_clear = WindowConstruction(
        'Double Clear Window', [clear_glass, gap, clear_glass])
    shade_mat = EnergyWindowMaterialShade(
        'Low-e Diffusing Shade', 0.005, 0.15, 0.5, 0.25, 0.5, 0, 0.4,
        0.2, 0.1, 0.75, 0.25)
    sched = ScheduleRuleset.from_daily_values(
        'NighSched', [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 1, 1, 1])
    double_low_e_ec = WindowConstructionShade(
        'Double Low-E Inside EC', double_clear, shade_mat, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)

    with pytest.raises(AttributeError):
        double_low_e_ec.window_construction.materials = \
            [clear_glass, gap, clear_glass, gap, clear_glass]
    with pytest.raises(AttributeError):
        double_low_e_ec.window_construction.schedule.identifier = 'ScheduleName'
    with pytest.raises(AttributeError):
        double_low_e_ec.shade_location = 'Interior'

    double_low_e_ec.control_type = 'AlwaysOn'
    double_low_e_ec.lock()
    with pytest.raises(AttributeError):
        double_low_e_ec.control_type = 'OnIfHighSolarOnWindow'
    double_low_e_ec.unlock()
    double_low_e_ec.control_type = 'OnIfHighSolarOnWindow'
コード例 #13
0
def test_window_construction_ec_init():
    """Test the initialization of WindowConstructionShade objects with electrochromic."""
    lowe_glass = EnergyWindowMaterialGlazing(
        'Low-e Glass', 0.00318, 0.4517, 0.359, 0.714, 0.207,
        0, 0.84, 0.046578, 1.0)
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.03)
    tint_glass = EnergyWindowMaterialGlazing(
        'Tinted Low-e Glass', 0.00318, 0.09, 0.359, 0.16, 0.207,
        0, 0.84, 0.046578, 1.0)
    window_constr = WindowConstruction('Double Low-E', [lowe_glass, gap, clear_glass])
    sched = ScheduleRuleset.from_daily_values(
        'NighSched', [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 1, 1, 1])
    double_low_e_ec = WindowConstructionShade(
        'Double Low-E Inside EC', window_constr, tint_glass, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)
    double_low_e_between_ec = WindowConstructionShade(
        'Double Low-E Between EC', window_constr, tint_glass, 'Between')
    double_low_e_ext_ec = WindowConstructionShade(
        'Double Low-E Outside EC', window_constr, tint_glass, 'Interior')
    double_low_e_ec_dup = double_low_e_ec.duplicate()

    assert double_low_e_ec.identifier == 'Double Low-E Inside EC'
    assert double_low_e_ec.window_construction == \
        double_low_e_ec_dup.window_construction
    assert double_low_e_ec.shade_material == double_low_e_ec_dup.shade_material
    assert double_low_e_ec.shade_location == \
        double_low_e_ec_dup.shade_location == 'Exterior'
    assert double_low_e_ec.control_type == \
        double_low_e_ec_dup.control_type == 'OnIfHighSolarOnWindow'
    assert double_low_e_ec.setpoint == double_low_e_ec_dup.setpoint == 200
    assert double_low_e_ec.schedule == double_low_e_ec_dup.schedule == sched
    assert len(double_low_e_ec.materials) == 3
    assert len(double_low_e_ec.layers) == 3
    assert len(double_low_e_ec.unique_materials) == 4
    assert not double_low_e_ec.is_symmetric
    assert double_low_e_ec.is_switchable_glazing
    assert double_low_e_ec.has_shade
    assert double_low_e_ec.thickness == \
        double_low_e_ec.window_construction.thickness
    assert double_low_e_ec.glazing_count == 2
    assert double_low_e_ec.gap_count == 1

    assert double_low_e_between_ec.identifier == 'Double Low-E Between EC'
    assert double_low_e_between_ec.shade_location == 'Between'
    assert double_low_e_between_ec.control_type == 'AlwaysOn'
    assert double_low_e_between_ec.setpoint is None
    assert double_low_e_between_ec.schedule is None
    assert len(double_low_e_between_ec.materials) == 3
    assert len(double_low_e_between_ec.unique_materials) == 4
    assert not double_low_e_between_ec.is_symmetric
    assert double_low_e_between_ec.gap_count == 1

    assert double_low_e_ext_ec.identifier == 'Double Low-E Outside EC'
    assert len(double_low_e_ext_ec.materials) == 3
コード例 #14
0
def test_window_construction_init():
    """Test the initalization of WindowConstruction objects and basic properties."""
    lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517,
                                             0.359, 0.714, 0.207, 0, 0.84,
                                             0.046578, 1.0)
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_low_e = WindowConstruction('Double Low-E Window',
                                      [lowe_glass, gap, clear_glass])
    double_clear = WindowConstruction('Double Clear Window',
                                      [clear_glass, gap, clear_glass])
    triple_clear = WindowConstruction(
        'Triple Clear Window',
        [clear_glass, gap, clear_glass, gap, clear_glass])
    double_low_e_dup = double_low_e.duplicate()
    str(double_low_e)  # test the string representation of the construction

    assert double_low_e.name == double_low_e_dup.name == 'Double Low-E Window'
    assert len(double_low_e.materials) == len(double_low_e_dup.materials) == 3
    assert double_low_e.r_value == double_low_e_dup.r_value == \
        pytest.approx(0.41984, rel=1e-2)
    assert double_low_e.u_value == double_low_e_dup.u_value == \
        pytest.approx(2.3818, rel=1e-2)
    assert double_low_e.u_factor == double_low_e_dup.u_factor == \
        pytest.approx(1.69802, rel=1e-2)
    assert double_low_e.r_factor == double_low_e_dup.r_factor == \
        pytest.approx(0.588919, rel=1e-2)
    assert double_low_e.inside_emissivity == \
        double_low_e_dup.inside_emissivity == 0.84
    assert double_low_e.outside_emissivity == \
        double_low_e_dup.outside_emissivity == 0.84
    assert double_low_e.unshaded_solar_transmittance == \
        double_low_e_dup.unshaded_solar_transmittance == 0.4517 * 0.770675
    assert double_low_e.unshaded_visible_transmittance == \
        double_low_e_dup.unshaded_visible_transmittance == 0.714 * 0.8836
    assert double_low_e.glazing_count == double_low_e_dup.glazing_count == 2
    assert double_low_e.gap_count == double_low_e_dup.gap_count == 1
    assert double_low_e.has_shade is double_low_e_dup.has_shade is False
    assert double_low_e.shade_location is double_low_e_dup.shade_location is None

    assert double_clear.u_factor == pytest.approx(2.72, rel=1e-2)
    assert double_low_e.u_factor == pytest.approx(1.698, rel=1e-2)
    assert triple_clear.u_factor == pytest.approx(1.757, rel=1e-2)
コード例 #15
0
def construction_window_blinds(directory):
    shade_mat = EnergyWindowMaterialBlind(
        'Plastic Blind', 'Vertical', 0.025, 0.01875, 0.003, 90, 0.2, 0.05, 0.4,
        0.05, 0.45, 0, 0.95, 0.1, 1)
    window_constr = WindowConstruction('Double Low-E', [lowe_glass, argon_gap, clear_glass])
    window_with_blinds = WindowConstructionShade(
        'Double Low-E Outside Shade', window_constr, shade_mat, 'Interior')
    dest_file = os.path.join(directory, 'construction_window_blinds.json')
    with open(dest_file, 'w') as fp:
        json.dump(window_with_blinds.to_dict(abridged=True), fp, indent=4)
コード例 #16
0
def construction_window_shade(directory):
    """Test the initialization of WindowConstructionShade objects with shades."""
    shade_mat = EnergyWindowMaterialShade(
        'Low-e Diffusing Shade', 0.025, 0.15, 0.5, 0.25, 0.5, 0, 0.4,
        0.2, 0.1, 0.75, 0.25)
    window_constr = WindowConstruction('Double Low-E', [lowe_glass, argon_gap, clear_glass])
    window_with_shade = WindowConstructionShade(
        'Double Low-E Outside Shade', window_constr, shade_mat, 'Interior')
    dest_file = os.path.join(directory, 'construction_window_shade.json')
    with open(dest_file, 'w') as fp:
        json.dump(window_with_shade.to_dict(abridged=True), fp, indent=4)
コード例 #17
0
def test_window_dict_methods():
    """Test the to/from dict methods."""
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_clear = WindowConstruction(
        'Triple Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass])
    constr_dict = triple_clear.to_dict()
    new_constr = WindowConstruction.from_dict(constr_dict)
    assert constr_dict == new_constr.to_dict()
コード例 #18
0
def test_run_idf_window_shade():
    """Test the Model.to.idf and run_idf method with a model that has a window shade."""
    # Get input Model
    room = Room.from_box('TinyHouseZone', 5, 10, 3)
    room.properties.energy.program_type = office_program
    room.properties.energy.add_default_ideal_air()

    double_clear = WindowConstruction('Double Pane Clear',
                                      [clear_glass, air_gap, clear_glass])
    shade_mat = EnergyWindowMaterialShade('Low-e Diffusing Shade', 0.005, 0.15,
                                          0.5, 0.25, 0.5, 0, 0.4, 0.2, 0.1,
                                          0.75, 0.25)
    sched = ScheduleRuleset.from_daily_values('NighSched', [
        1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1
    ])
    double_ec = WindowConstructionShade('Double Low-E Inside EC', double_clear,
                                        shade_mat, 'Interior',
                                        'OnIfHighSolarOnWindow', 200, sched)

    south_face = room[3]
    south_face.apertures_by_ratio(0.4, 0.01)
    south_face.apertures[0].properties.energy.construction = double_ec
    north_face = room[1]
    north_face.apertures_by_ratio(0.4, 0.01)

    model = Model('TinyHouse', [room])

    # Get the input SimulationParameter
    sim_par = SimulationParameter()
    sim_par.output.add_zone_energy_use()
    ddy_file = './tests/ddy/chicago.ddy'
    sim_par.sizing_parameter.add_from_ddy_996_004(ddy_file)
    sim_par.run_period.end_date = Date(1, 7)

    # create the IDF string for simulation paramters and model
    idf_str = '\n\n'.join((sim_par.to_idf(), model.to.idf(model)))

    # write the final string into an IDF
    idf = os.path.join(folders.default_simulation_folder, 'test_file_shd',
                       'in.idf')
    write_to_file(idf, idf_str, True)

    # prepare the IDF for simulation
    epw_file = './tests/simulation/chicago.epw'
    prepare_idf_for_simulation(idf, epw_file)

    # run the IDF through EnergyPlus
    sql, zsz, rdd, html, err = run_idf(idf, epw_file)

    assert os.path.isfile(sql)
    assert os.path.isfile(err)
    err_obj = Err(err)
    assert 'EnergyPlus Completed Successfully' in err_obj.file_contents
コード例 #19
0
def test_window_symmetric():
    """Test that the window construction is_symmetric property."""
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    low_e_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.05, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_low_e = WindowConstruction('Double Clear Window',
                                      [clear_glass, gap, low_e_glass])
    double_clear = WindowConstruction('Clear Window',
                                      [clear_glass, gap, clear_glass])
    single_clear = WindowConstruction('Clear Window', [clear_glass])
    triple_clear = WindowConstruction(
        'Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass])

    assert not double_low_e.is_symmetric
    assert double_clear.is_symmetric
    assert single_clear.is_symmetric
    assert triple_clear.is_symmetric
コード例 #20
0
def test_window_equivalency():
    """Test the equality of a window construction to another."""
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_clear = WindowConstruction('Clear Window',
                                      [clear_glass, gap, clear_glass])
    double_clear_2 = double_clear.duplicate()
    triple_clear = WindowConstruction(
        'Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass])
    double_clear_3 = WindowConstruction('Double Clear Window',
                                        [clear_glass, gap, clear_glass])

    collection = [double_clear, double_clear, double_clear_2, triple_clear]
    assert len(set(collection)) == 2
    assert double_clear == double_clear_2
    assert double_clear != triple_clear
    assert double_clear != double_clear_3

    double_clear_2.name = 'Cool Window'
    assert double_clear != double_clear_2
コード例 #21
0
def test_window_construction_init_gas_mixture():
    """Test the initalization of WindowConstruction objects with a gas mixture."""
    lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517,
                                             0.359, 0.714, 0.207, 0, 0.84,
                                             0.046578, 1.0)
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    air_argon = EnergyWindowMaterialGasMixture('Air Argon Gap', 0.0125,
                                               ('Air', 'Argon'), (0.1, 0.9))
    double_low_e_argon = WindowConstruction(
        'Double Low-E with Argon', [lowe_glass, air_argon, clear_glass])

    assert double_low_e_argon.u_factor == pytest.approx(1.46319708, rel=1e-2)
コード例 #22
0
def test_writer_to_idf():
    """Test the Model to.idf method."""
    room = Room.from_box('TinyHouseZone', 5, 10, 3)
    room.properties.energy.program_type = office_program
    room.properties.energy.add_default_ideal_air()

    stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough',
                           0.95, 0.75, 0.8)
    thermal_mass_constr = OpaqueConstruction('Thermal Mass Floor', [stone])
    room[0].properties.energy.construction = thermal_mass_constr

    south_face = room[3]
    south_face.apertures_by_ratio(0.4, 0.01)
    south_face.apertures[0].overhang(0.5, indoor=False)
    south_face.apertures[0].overhang(0.5, indoor=True)
    south_face.move_shades(Vector3D(0, 0, -0.5))
    light_shelf_out = ShadeConstruction('OutdoorLightShelf', 0.5, 0.5)
    light_shelf_in = ShadeConstruction('IndoorLightShelf', 0.7, 0.7)
    south_face.apertures[0].outdoor_shades[0].properties.energy.construction = light_shelf_out
    south_face.apertures[0].indoor_shades[0].properties.energy.construction = light_shelf_in

    north_face = room[1]
    north_face.overhang(0.25, indoor=False)
    door_verts = [Point3D(2, 10, 0.1), Point3D(1, 10, 0.1),
                  Point3D(1, 10, 2.5), Point3D(2, 10, 2.5)]
    door = Door('FrontDoor', Face3D(door_verts))
    north_face.add_door(door)

    aperture_verts = [Point3D(4.5, 10, 1), Point3D(2.5, 10, 1),
                      Point3D(2.5, 10, 2.5), Point3D(4.5, 10, 2.5)]
    aperture = Aperture('FrontAperture', Face3D(aperture_verts))
    triple_pane = WindowConstruction(
        'Triple Pane Window', [clear_glass, air_gap, clear_glass, air_gap, clear_glass])
    aperture.properties.energy.construction = triple_pane
    north_face.add_aperture(aperture)

    tree_canopy_geo = Face3D.from_regular_polygon(
        6, 2, Plane(Vector3D(0, 0, 1), Point3D(5, -3, 4)))
    tree_canopy = Shade('TreeCanopy', tree_canopy_geo)

    table_geo = Face3D.from_rectangle(2, 2, Plane(o=Point3D(1.5, 4, 1)))
    table = Shade('Table', table_geo)
    room.add_indoor_shade(table)

    model = Model('TinyHouse', [room], orphaned_shades=[tree_canopy])

    assert hasattr(model.to, 'idf')
    idf_string = model.to.idf(model, schedule_directory='./tests/idf/')
コード例 #23
0
def test_from_dict():
    """Test the Aperture from_dict method with energy properties."""
    aperture = Aperture.from_vertices(
        'wall_window', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_pane = WindowConstruction(
        'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass])
    aperture.properties.energy.construction = triple_pane

    ad = aperture.to_dict()
    new_aperture = Aperture.from_dict(ad)
    assert new_aperture.properties.energy.construction == triple_pane
    assert new_aperture.to_dict() == ad
コード例 #24
0
def test_writer_to_idf():
    """Test the Aperture to_idf method."""
    aperture = Aperture.from_vertices(
        'wall_window', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_pane = WindowConstruction(
        'TriplePane', [clear_glass, gap, clear_glass, gap, clear_glass])
    aperture.properties.energy.construction = triple_pane

    assert hasattr(aperture.to, 'idf')
    idf_string = aperture.to.idf(aperture)
    assert 'wall_window,' in idf_string
    assert 'FenestrationSurface:Detailed,' in idf_string
    assert 'TriplePane' in idf_string
コード例 #25
0
def test_window_lockability():
    """Test the lockability of the window construction."""
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_clear = WindowConstruction('Double Clear Window',
                                      [clear_glass, gap, clear_glass])

    double_clear.materials = [clear_glass, gap, clear_glass, gap, clear_glass]
    double_clear.lock()
    with pytest.raises(AttributeError):
        double_clear.materials = [clear_glass]
    with pytest.raises(AttributeError):
        double_clear[0].solar_transmittance = 0.45
    double_clear.unlock()
    double_clear.materials = [clear_glass]
    double_clear[0].solar_transmittance = 0.45
コード例 #26
0
def test_set_construction():
    """Test the setting of a construction on an Aperture."""
    vertices_wall = [[0, 0, 0], [0, 10, 0], [0, 10, 3], [0, 0, 3]]
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_pane = WindowConstruction(
        'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass])

    aperture = Aperture.from_vertices('wall window', vertices_wall)
    aperture.properties.energy.construction = triple_pane

    assert aperture.properties.energy.construction == triple_pane
    assert aperture.properties.energy.is_construction_set_by_user

    with pytest.raises(AttributeError):
        aperture.properties.energy.construction[0].thickness = 0.1
コード例 #27
0
def test_to_dict():
    """Test the Aperture to_dict method with energy properties."""
    aperture = Aperture.from_vertices(
        'wall_window', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_pane = WindowConstruction(
        'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass])

    ad = aperture.to_dict()
    assert 'properties' in ad
    assert ad['properties']['type'] == 'ApertureProperties'
    assert 'energy' in ad['properties']
    assert ad['properties']['energy']['type'] == 'ApertureEnergyProperties'

    aperture.properties.energy.construction = triple_pane
    ad = aperture.to_dict()
    assert 'construction' in ad['properties']['energy']
    assert ad['properties']['energy']['construction'] is not None
コード例 #28
0
def test_window_shade_dict_methods():
    """Test the to/from dict methods."""
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    double_clear = WindowConstruction(
        'Double Clear Window', [clear_glass, gap, clear_glass])
    shade_mat = EnergyWindowMaterialShade(
        'Low-e Diffusing Shade', 0.005, 0.15, 0.5, 0.25, 0.5, 0, 0.4,
        0.2, 0.1, 0.75, 0.25)
    sched = ScheduleRuleset.from_daily_values(
        'NighSched', [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                      0, 0, 0, 0, 0, 1, 1, 1])
    double_low_e_ec = WindowConstructionShade(
        'Double Low-E Inside EC', double_clear, shade_mat, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)

    constr_dict = double_low_e_ec.to_dict()
    new_constr = WindowConstructionShade.from_dict(constr_dict)
    assert double_low_e_ec == new_constr
    assert constr_dict == new_constr.to_dict()
コード例 #29
0
def test_duplicate():
    """Test what happens to energy properties when duplicating an Aperture."""
    verts = [
        Point3D(0, 0, 0),
        Point3D(10, 0, 0),
        Point3D(10, 0, 10),
        Point3D(0, 0, 10)
    ]
    clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715,
                                              0.770675, 0.07, 0.8836, 0.0804,
                                              0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_pane = WindowConstruction(
        'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass])

    aperture_original = Aperture('wall window', Face3D(verts))
    aperture_dup_1 = aperture_original.duplicate()

    assert aperture_original.properties.energy.host is aperture_original
    assert aperture_dup_1.properties.energy.host is aperture_dup_1
    assert aperture_original.properties.energy.host is not \
        aperture_dup_1.properties.energy.host

    assert aperture_original.properties.energy.construction == \
        aperture_dup_1.properties.energy.construction
    aperture_dup_1.properties.energy.construction = triple_pane
    assert aperture_original.properties.energy.construction != \
        aperture_dup_1.properties.energy.construction

    aperture_dup_2 = aperture_dup_1.duplicate()

    assert aperture_dup_1.properties.energy.construction == \
        aperture_dup_2.properties.energy.construction
    aperture_dup_2.properties.energy.construction = None
    assert aperture_dup_1.properties.energy.construction != \
        aperture_dup_2.properties.energy.construction
コード例 #30
0
        'Generic Interior Ceiling'] = generic_interior_ceiling

try:
    generic_underground_roof = _idf_opaque_constructions[
        'Generic Underground Roof']
except KeyError:
    generic_underground_roof = OpaqueConstruction(
        'Generic Underground Roof', _default_prop['generic_underground_roof'])
    generic_underground_roof.lock()
    _idf_opaque_constructions[
        'Generic Underground Roof'] = generic_underground_roof

try:
    generic_double_pane = _idf_window_constructions['Generic Double Pane']
except KeyError:
    generic_double_pane = WindowConstruction(
        'Generic Double Pane', _default_prop['generic_double_pane'])
    generic_double_pane.lock()
    _idf_window_constructions['Generic Double Pane'] = generic_double_pane

try:
    generic_single_pane = _idf_window_constructions['Generic Single Pane']
except KeyError:
    generic_single_pane = WindowConstruction(
        'Generic Single Pane', _default_prop['generic_single_pane'])
    generic_single_pane.lock()
    _idf_window_constructions['Generic Single Pane'] = generic_single_pane

try:
    generic_exterior_door = _idf_opaque_constructions['Generic Exterior Door']
except KeyError:
    generic_exterior_door = OpaqueConstruction(