Esempio n. 1
0
def test_gas_invalid():
    """Test EnergyWindowMaterialGlazing objects with invalid properties."""
    air = EnergyWindowMaterialGas('Air Gap', 0.0125, 'Air')

    with pytest.raises(TypeError):
        air.identifier = ['test_identifier']
    with pytest.raises(AssertionError):
        air.thickness = -1
    with pytest.raises(AssertionError):
        air.gas_type = 'Helium'
Esempio n. 2
0
def test_gas_init():
    """Test the initalization of gas material objects and basic properties."""
    air = EnergyWindowMaterialGas('Air Gap', 0.0125, 'Air')
    str(air)  # test the string representation of the material
    air_dup = air.duplicate()

    assert air.identifier == air_dup.identifier == 'Air Gap'
    assert air.thickness == air_dup.thickness == 0.0125
    assert air.gas_type == air_dup.gas_type == 'Air'
    assert air.conductivity == air_dup.conductivity == pytest.approx(0.024069, rel=1e-2)
    assert air.viscosity == air_dup.viscosity == pytest.approx(1.73775e-05, rel=1e-2)
    assert air.specific_heat == air_dup.specific_heat == pytest.approx(1006.1033, rel=1e-2)
    assert air.density == air_dup.density == pytest.approx(1.292, rel=1e-2)
    assert air.prandtl == air_dup.prandtl == pytest.approx(0.7263, rel=1e-2)
Esempio n. 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
def window_material_by_name(material_name):
    """Get an window material from the library given the material name.

    Args:
        material_name: A text string for the name of the material.
    """
    try:  # see if the material has already been loaded to a Python object
        return _idf_window_materials[material_name]
    except KeyError:  # material likely needs to be loaded from standards data
        try:
            _mat_dict = _window_standards_dict[material_name]
        except KeyError:  # material is nowhere to be found; raise an error
            raise ValueError(
                '"{}" was not found in the window energy material library.'.
                format(material_name))

    # create the Python object from the standards gem dictionary
    if _mat_dict['material_type'] == 'StandardGlazing':
        _mat_obj = EnergyWindowMaterialGlazing.from_standards_dict(_mat_dict)
    elif _mat_dict['material_type'] == 'SimpleGlazing':
        _mat_obj = EnergyWindowMaterialSimpleGlazSys.from_standards_dict(
            _mat_dict)
    elif _mat_dict['material_type'] == 'Gas':
        _mat_obj = EnergyWindowMaterialGas.from_standards_dict(_mat_dict)
    else:
        raise ValueError(
            'Standards gem material type "{}" is not recognized.'.format(
                _mat_dict['material_type']))
    _mat_obj.lock()
    _idf_window_materials[
        material_name] = _mat_obj  # next time, it will be loaded faster
    return _mat_obj
Esempio n. 5
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
Esempio n. 6
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()
Esempio n. 7
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'
Esempio n. 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
Esempio n. 9
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)
Esempio n. 10
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)
Esempio n. 11
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
Esempio n. 12
0
def test_gas_properties_at_temperature():
    """Test the initalization of gas material objects and basic properties."""
    air = EnergyWindowMaterialGas('Air Gap', 0.0125, 'Air')

    assert air.conductivity_at_temperature(223) == pytest.approx(0.020177, rel=1e-2)
    assert air.viscosity_at_temperature(223) == pytest.approx(1.487e-05, rel=1e-2)
    assert air.specific_heat_at_temperature(223) == pytest.approx(1005.48, rel=1e-2)
    assert air.density_at_temperature(223) == pytest.approx(1.5832, rel=1e-2)
    assert air.prandtl_at_temperature(223) == pytest.approx(0.74099, rel=1e-2)
Esempio n. 13
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()
Esempio n. 14
0
def test_gas_init_from_idf():
    """Test the initialization of gas mixture objects from strings."""
    ep_str_1 = "WindowMaterial:Gas,\n" \
        "Gap_1_W_0_0127,            !- Name\n" \
        "Air,                       !- Gas Type\n" \
        "0.05;                      !- Thickness"
    air = EnergyWindowMaterialGas.from_idf(ep_str_1)

    assert air.identifier == 'Gap_1_W_0_0127'
    assert air.thickness == 0.05
    assert air.gas_type == 'Air'
Esempio n. 15
0
def test_gas_to_from_standards_dict():
    """Test initialization of EnergyWindowMaterialGas objects from standards gem."""
    standards_dict = {
        "name": "AIR 13MM",
        "material_type": "Gas",
        "thickness": 0.5,
        "gas_type": "Air"
    }
    mat_1 = EnergyWindowMaterialGas.from_standards_dict(standards_dict)

    assert mat_1.name == 'AIR 13MM'
    assert mat_1.thickness == pytest.approx(0.0127, rel=1e-2)
    assert mat_1.gas_type == 'Air'
Esempio n. 16
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
Esempio n. 17
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
Esempio n. 18
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)
Esempio n. 19
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
Esempio n. 20
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
Esempio n. 21
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
Esempio n. 22
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
Esempio n. 23
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
Esempio n. 24
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()
Esempio n. 25
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
Esempio n. 26
0
def test_gas_dict_methods():
    """Test the to/from dict methods."""
    argon = EnergyWindowMaterialGas('Argon Gap', 0.0125, 'Argon')
    material_dict = argon.to_dict()
    new_material = EnergyWindowMaterialGas.from_dict(material_dict)
    assert material_dict == new_material.to_dict()
Esempio n. 27
0
def test_window_construction_shade_init():
    """Test the initialization of WindowConstructionShade 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.005, 0.15, 0.5, 0.25, 0.5, 0, 0.4,
        0.2, 0.1, 0.75, 0.25)
    shade_thick = 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, gap, clear_glass])
    window_clear = WindowConstruction('Double Low-E', [clear_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])

    with pytest.raises(AssertionError):
        double_low_e_between_shade = WindowConstructionShade(
            'Double Low-E Between Shade', window_constr, shade_thick, 'Between')

    double_low_e_shade = WindowConstructionShade(
        'Double Low-E with Shade', window_constr, shade_mat, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)
    double_low_e_between_shade = WindowConstructionShade(
        'Double Low-E Between Shade', window_clear, shade_mat, 'Between')
    double_ext_shade = WindowConstructionShade(
        'Double Outside Shade', window_clear, shade_mat, 'Interior')

    double_low_e_shade_dup = double_low_e_shade.duplicate()

    assert double_low_e_shade.identifier == 'Double Low-E with Shade'
    assert double_low_e_shade.window_construction == \
        double_low_e_shade_dup.window_construction
    assert double_low_e_shade.shade_material == double_low_e_shade_dup.shade_material
    assert double_low_e_shade.shade_location == \
        double_low_e_shade_dup.shade_location == 'Exterior'
    assert double_low_e_shade.control_type == \
        double_low_e_shade_dup.control_type == 'OnIfHighSolarOnWindow'
    assert double_low_e_shade.setpoint == double_low_e_shade_dup.setpoint == 200
    assert double_low_e_shade.schedule == double_low_e_shade_dup.schedule == sched
    assert len(double_low_e_shade.materials) == 4
    assert len(double_low_e_shade.layers) == 4
    assert len(double_low_e_shade.unique_materials) == 4
    assert double_low_e_shade.r_value == double_low_e_shade.r_value == \
        pytest.approx(0.41984, rel=1e-2)
    assert double_low_e_shade.u_value == double_low_e_shade.u_value == \
        pytest.approx(2.3818, rel=1e-2)
    assert double_low_e_shade.u_factor == double_low_e_shade.u_factor == \
        pytest.approx(1.69802, rel=1e-2)
    assert double_low_e_shade.r_factor == double_low_e_shade.r_factor == \
        pytest.approx(0.588919, rel=1e-2)
    assert not double_low_e_shade.is_symmetric
    assert not double_low_e_shade.is_switchable_glazing
    assert double_low_e_shade.has_shade
    assert double_low_e_shade.inside_emissivity == \
        double_low_e_shade.inside_emissivity == 0.84
    assert double_low_e_shade.outside_emissivity == \
        double_low_e_shade.outside_emissivity == 0.4
    assert double_low_e_shade.thickness == \
        double_low_e_shade.window_construction.thickness
    assert double_low_e_shade.glazing_count == 2
    assert double_low_e_shade.gap_count == 1

    assert double_low_e_between_shade.identifier == 'Double Low-E Between Shade'
    assert double_low_e_between_shade.shade_location == 'Between'
    assert double_low_e_between_shade.control_type == 'AlwaysOn'
    assert double_low_e_between_shade.setpoint is None
    assert double_low_e_between_shade.schedule is None
    assert len(double_low_e_between_shade.materials) == 5
    assert len(double_low_e_between_shade.unique_materials) == 3
    assert double_low_e_between_shade.is_symmetric
    assert double_low_e_between_shade.gap_count == 2

    assert double_ext_shade.identifier == 'Double Outside Shade'
    assert len(double_ext_shade.materials) == 4
    assert len(double_ext_shade.unique_materials) == 3
Esempio n. 28
0
def test_window_construction_blind_init():
    """Test the initialization of WindowConstructionShade 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.03)
    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, gap, clear_glass])
    window_clear = WindowConstruction('Double Low-E', [clear_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_shade = WindowConstructionShade(
        'Double Low-E with Blind', window_constr, shade_mat, 'Exterior',
        'OnIfHighSolarOnWindow', 200, sched)
    double_low_e_between_shade = WindowConstructionShade(
        'Double Low-E Between Blind', window_clear, shade_mat, 'Between')
    double_low_e_ext_shade = WindowConstructionShade(
        'Double Low-E Outside Blind', window_constr, shade_mat, 'Interior')
    double_low_e_shade_dup = double_low_e_shade.duplicate()

    assert double_low_e_shade.identifier == 'Double Low-E with Blind'
    assert double_low_e_shade.window_construction == \
        double_low_e_shade_dup.window_construction
    assert double_low_e_shade.shade_material == double_low_e_shade_dup.shade_material
    assert double_low_e_shade.shade_location == \
        double_low_e_shade_dup.shade_location == 'Exterior'
    assert double_low_e_shade.control_type == \
        double_low_e_shade_dup.control_type == 'OnIfHighSolarOnWindow'
    assert double_low_e_shade.setpoint == double_low_e_shade_dup.setpoint == 200
    assert double_low_e_shade.schedule == double_low_e_shade_dup.schedule == sched
    assert len(double_low_e_shade.materials) == 4
    assert len(double_low_e_shade.layers) == 4
    assert len(double_low_e_shade.unique_materials) == 4
    assert not double_low_e_shade.is_symmetric
    assert not double_low_e_shade.is_switchable_glazing
    assert double_low_e_shade.has_shade
    assert double_low_e_shade.inside_emissivity == \
        double_low_e_shade.inside_emissivity == 0.84
    assert double_low_e_shade.outside_emissivity == \
        double_low_e_shade.outside_emissivity == 0.95
    assert double_low_e_shade.thickness == \
        double_low_e_shade.window_construction.thickness
    assert double_low_e_shade.glazing_count == 2
    assert double_low_e_shade.gap_count == 1

    assert double_low_e_between_shade.identifier == 'Double Low-E Between Blind'
    assert double_low_e_between_shade.shade_location == 'Between'
    assert double_low_e_between_shade.control_type == 'AlwaysOn'
    assert double_low_e_between_shade.setpoint is None
    assert double_low_e_between_shade.schedule is None
    assert len(double_low_e_between_shade.materials) == 5
    assert len(double_low_e_between_shade.unique_materials) == 3
    assert double_low_e_between_shade.is_symmetric
    assert double_low_e_between_shade.gap_count == 2

    assert double_low_e_ext_shade.identifier == 'Double Low-E Outside Blind'
    assert len(double_low_e_ext_shade.materials) == 4
Esempio n. 29
0
def test_gas_defaults():
    """Test the EnergyWindowMaterialGas default properties."""
    air = EnergyWindowMaterialGas('Default Gap')

    assert air.thickness == 0.0125
    assert air.gas_type == 'Air'
try:  # import the honeybee-energy dependencies
    from honeybee_energy.material.gas import EnergyWindowMaterialGas, \
        EnergyWindowMaterialGasMixture
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    # set the default material properties
    _thickness_ = 0.0125 if _thickness_ is None else _thickness_
    _gas_types_ = ['Air'] if len(_gas_types_) == 0 else _gas_types_
    _gas_ratios_ = [1 / len(_gas_types_)] * len(_gas_types_) if \
        len(_gas_ratios_) == 0 else _gas_ratios_
    assert len(_gas_types_) == len(_gas_ratios_), \
        'Length of _gas_types_ does not equal length of _gas_ratios_.'

    # create the material
    if len(_gas_types_) == 1:
        mat = EnergyWindowMaterialGas(
            clean_and_id_ep_string(_name), _thickness_, _gas_types_[0])
    else:
        mat = EnergyWindowMaterialGasMixture(
            clean_and_id_ep_string(_name), _thickness_, _gas_types_, _gas_ratios_)
    mat.display_name = _name