Example #1
0
def test_check_duplicate_material_names():
    """Test the check_duplicate_material_names method."""
    room = Room.from_box('Tiny House Zone', 5, 10, 3)

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

    north_face = room[1]
    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))
    door.properties.energy.construction = door_constr
    north_face.add_door(door)

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

    assert model.properties.energy.check_duplicate_material_names(False)
    thin_stone.unlock()
    thin_stone.name = 'Stone'
    thin_stone.lock()
    assert not model.properties.energy.check_duplicate_material_names(False)
    with pytest.raises(ValueError):
        model.properties.energy.check_duplicate_material_names(True)
Example #2
0
def test_material_lockability():
    """Test the lockability of the EnergyMaterial."""
    concrete = EnergyMaterial('Concrete [HW]', 0.2, 0.5, 800, 1200)
    concrete.density = 600
    concrete.lock()
    with pytest.raises(AttributeError):
        concrete.density = 700
    concrete.unlock()
    concrete.density = 700
Example #3
0
    ('Air Wall Material', 0.01, 0.6, 1.28, 1004, 'Smooth', 0.95, 0.95, 0.95),
    'clear_glass': ('Generic Clear Glass', 0.006, 0.77, 0.07, 0.88, 0.08, 0,
                    0.84, 0.84, 1.0),
    'lowe_glass': ('Generic Low-e Glass', 0.006, 0.45, 0.36, 0.71, 0.21, 0,
                   0.84, 0.047, 1.0),
    'air_gap': ('Generic Window Air Gap', 0.0127, 'Air'),
    'argon_gap': ('Generic Window Argon Gap', 0.0127, 'Argon')
}

# establish variables for the default materials used across the library
# and auto-generate materials if they were not loaded from default.idf
try:
    brick = _idf_opaque_materials['Generic Brick']
except KeyError:
    brick = EnergyMaterial(*_default_prop['brick'])
    brick.lock()
    _idf_opaque_materials['Generic Brick'] = brick

try:
    concrete_lw = _idf_opaque_materials['Generic LW Concrete']
except KeyError:
    concrete_lw = EnergyMaterial(*_default_prop['concrete_lw'])
    concrete_lw.lock()
    _idf_opaque_materials['Generic LW Concrete'] = concrete_lw

try:
    concrete_hw = _idf_opaque_materials['Generic HW Concrete']
except KeyError:
    concrete_hw = EnergyMaterial(*_default_prop['concrete_hw'])
    concrete_hw.lock()
    _idf_opaque_materials['Generic HW Concrete'] = concrete_hw