Beispiel #1
0
def test_glazing_to_from_standards_dict():
    """Test the initialization of EnergyMaterial objects from standards gem."""
    standards_dict = {
        "name": "PYR B CLEAR 3MM",
        "material_type": "StandardGlazing",
        "thickness": 0.118110236220472,
        "conductivity": 6.24012461866438,
        "resistance": 0.160253209849202,
        "optical_data_type": "SpectralAverage",
        "solar_transmittance_at_normal_incidence": 0.74,
        "front_side_solar_reflectance_at_normal_incidence": 0.09,
        "back_side_solar_reflectance_at_normal_incidence": 0.1,
        "visible_transmittance_at_normal_incidence": 0.82,
        "front_side_visible_reflectance_at_normal_incidence": 0.11,
        "back_side_visible_reflectance_at_normal_incidence": 0.12,
        "infrared_transmittance_at_normal_incidence": 0.0,
        "front_side_infrared_hemispherical_emissivity": 0.84,
        "back_side_infrared_hemispherical_emissivity": 0.2,
        "dirt_correction_factor_for_solar_and_visible_transmittance": 1.0,
        "solar_diffusing": 0
    }
    mat_1 = EnergyWindowMaterialGlazing.from_standards_dict(standards_dict)

    assert mat_1.name == 'PYR B CLEAR 3MM'
    assert mat_1.thickness == pytest.approx(0.003, rel=1e-3)
    assert mat_1.conductivity == pytest.approx(0.9, rel=1e-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