Example #1
0
def test_window_to_from_standards_dict():
    """Test the initialization of OpaqueConstruction objects from standards gem."""
    filename = './tests/standards/OpenStudio_Standards_materials.json'
    if filename:
        with open(filename, 'r') as f:
            data_store = json.load(f)
    standards_dict = {
        "name":
        "U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air",
        "intended_surface_type":
        "ExteriorWindow",
        "standards_construction_type":
        "Metal framing (all other)",
        "insulation_layer":
        None,
        "skylight_framing":
        None,
        "materials":
        ["BRONZE 6MM", "AIR 13MM", "COATED POLY-55", "AIR 13MM", "CLEAR 3MM"]
    }
    glaz_constr = WindowConstruction.from_standards_dict(
        standards_dict, data_store)

    assert glaz_constr.name == 'U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air'
    assert glaz_constr.r_value == pytest.approx(0.645449, rel=1e-2)
    assert glaz_constr.u_value == pytest.approx(1.549307, rel=1e-2)
    assert glaz_constr.u_factor == pytest.approx(1.2237779, rel=1e-2)
    assert glaz_constr.r_factor == pytest.approx(0.817141, rel=1e-2)
Example #2
0
def test_window_to_from_standards_dict():
    """Test the initialization of OpaqueConstruction objects from standards gem."""
    standards_dict = {
        "name": "U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air",
        "intended_surface_type": "ExteriorWindow",
        "materials": [
            "BRONZE 6MM",
            "AIR 13MM",
            "COATED POLY-55",
            "AIR 13MM",
            "CLEAR 3MM"]}
    glaz_constr = WindowConstruction.from_standards_dict(standards_dict)

    assert glaz_constr.name == 'U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air'
    assert glaz_constr.r_value == pytest.approx(0.645449, rel=1e-2)
    assert glaz_constr.u_value == pytest.approx(1.549307, rel=1e-2)
    assert glaz_constr.u_factor == pytest.approx(1.2237779, rel=1e-2)
    assert glaz_constr.r_factor == pytest.approx(0.817141, rel=1e-2)
Example #3
0
def window_construction_by_identifier(construction_identifier):
    """Get an window construction from the library given the construction identifier.

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

    # create the Python object from the standards gem dictionary
    _constr_obj = WindowConstruction.from_standards_dict(_constr_dict)
    _constr_obj.lock()
    _window_constructions[construction_identifier] = _constr_obj  # load faster next time
    return _constr_obj