def test_check_duplicate_construction_names(): """Test the check_duplicate_construction_names method.""" room = Room.from_box('Tiny House Zone', 5, 10, 3) stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95, 0.75, 0.8) thermal_mass_constr = OpaqueConstruction('Custom Construction', [stone]) room[0].properties.energy.construction = thermal_mass_constr north_face = room[1] aperture_verts = [ Point3D(4.5, 10, 1), Point3D(2.5, 10, 1), Point3D(2.5, 10, 2.5), Point3D(4.5, 10, 2.5) ] aperture = Aperture('Front Aperture', Face3D(aperture_verts)) aperture.is_operable = True triple_pane = WindowConstruction( 'Custom Window Construction', [clear_glass, air_gap, clear_glass, air_gap, clear_glass]) aperture.properties.energy.construction = triple_pane north_face.add_aperture(aperture) model = Model('Tiny House', [room]) assert model.properties.energy.check_duplicate_construction_names(False) triple_pane.unlock() triple_pane.name = 'Custom Construction' triple_pane.lock() assert not model.properties.energy.check_duplicate_construction_names( False) with pytest.raises(ValueError): model.properties.energy.check_duplicate_construction_names(True)
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
try: generic_underground_roof = _idf_opaque_constructions[ 'Generic Underground Roof'] except KeyError: generic_underground_roof = OpaqueConstruction( 'Generic Underground Roof', _default_prop['generic_underground_roof']) generic_underground_roof.lock() _idf_opaque_constructions[ 'Generic Underground Roof'] = generic_underground_roof try: generic_double_pane = _idf_window_constructions['Generic Double Pane'] except KeyError: generic_double_pane = WindowConstruction( 'Generic Double Pane', _default_prop['generic_double_pane']) generic_double_pane.lock() _idf_window_constructions['Generic Double Pane'] = generic_double_pane try: generic_single_pane = _idf_window_constructions['Generic Single Pane'] except KeyError: generic_single_pane = WindowConstruction( 'Generic Single Pane', _default_prop['generic_single_pane']) generic_single_pane.lock() _idf_window_constructions['Generic Single Pane'] = generic_single_pane try: generic_exterior_door = _idf_opaque_constructions['Generic Exterior Door'] except KeyError: generic_exterior_door = OpaqueConstruction( 'Generic Exterior Door', _default_prop['generic_exterior_door'])