예제 #1
0
def test_opaque_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":
        "Metal framed wallsW1_R8.60",
        "intended_surface_type":
        "ExteriorWall",
        "standards_construction_type":
        None,
        "insulation_layer":
        "Typical Insulation",
        "skylight_framing":
        None,
        "materials": [
            "Stucco - 7/8 in. CBES", "W1_R8.60",
            "Air - Metal Wall Framing - 16 or 24 in. OC",
            "Gypsum Board - 1/2 in. CBES"
        ]
    }
    wall_constr = OpaqueConstruction.from_standards_dict(
        standards_dict, data_store)

    assert wall_constr.name == 'Metal framed wallsW1_R8.60'
    assert wall_constr.r_value == pytest.approx(1.7411, rel=1e-2)
    assert wall_constr.u_value == pytest.approx(0.57434, rel=1e-2)
    assert wall_constr.u_factor == pytest.approx(0.524972, rel=1e-2)
    assert wall_constr.r_factor == pytest.approx(1.904860, rel=1e-2)
def test_opaque_to_from_standards_dict():
    """Test the initialization of OpaqueConstruction objects from standards gem."""
    standards_dict = {
        "name": "Typical Insulated Exterior Mass Wall",
        "intended_surface_type": "ExteriorWall",
        "materials": [
            "1IN Stucco",
            "8IN CONCRETE HW RefBldg",
            "Typical Insulation",
            "1/2IN Gypsum"]}
    wall_constr = OpaqueConstruction.from_standards_dict(standards_dict)

    assert wall_constr.name == 'Typical Insulated Exterior Mass Wall'
    assert wall_constr.r_value == pytest.approx(0.29934598728, rel=1e-3)
    assert wall_constr.u_value == pytest.approx(3.3406160178, rel=1e-3)
    assert wall_constr.u_factor == pytest.approx(2.159364735, rel=1e-3)
    assert wall_constr.r_factor == pytest.approx(0.463099162, rel=1e-3)
예제 #3
0
def opaque_construction_by_identifier(construction_identifier):
    """Get an opaque 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 _opaque_constructions[construction_identifier]
    except KeyError:  # construction likely needs to be loaded from standards data
        try:
            _constr_dict = _opaque_constr_standards_dict[construction_identifier]
        except KeyError:  # construction is nowhere to be found; raise an error
            raise ValueError(
                '"{}" was not found in the opaque energy construction library.'.format(
                    construction_identifier))

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