def test_check_duplicate_construction_set_identifiers(): """Test the check_duplicate_construction_set_identifiers method.""" first_floor = Room.from_box('First_Floor', 10, 10, 3, origin=Point3D(0, 0, 0)) second_floor = Room.from_box('Second_Floor', 10, 10, 3, origin=Point3D(0, 0, 3)) for face in first_floor[1:5]: face.apertures_by_ratio(0.2, 0.01) for face in second_floor[1:5]: face.apertures_by_ratio(0.2, 0.01) base_constr_set = ConstructionSet('Lower Floor Construction Set') first_floor.properties.energy.construction_set = base_constr_set second_floor.properties.energy.construction_set = base_constr_set pts_1 = [Point3D(0, 0, 6), Point3D(0, 10, 6), Point3D(10, 10, 6), Point3D(10, 0, 6)] pts_2 = [Point3D(0, 0, 6), Point3D(5, 0, 9), Point3D(5, 10, 9), Point3D(0, 10, 6)] pts_3 = [Point3D(10, 0, 6), Point3D(10, 10, 6), Point3D(5, 10, 9), Point3D(5, 0, 9)] pts_4 = [Point3D(0, 0, 6), Point3D(10, 0, 6), Point3D(5, 0, 9)] pts_5 = [Point3D(10, 10, 6), Point3D(0, 10, 6), Point3D(5, 10, 9)] face_1 = Face('AtticFace1', Face3D(pts_1)) face_2 = Face('AtticFace2', Face3D(pts_2)) face_3 = Face('AtticFace3', Face3D(pts_3)) face_4 = Face('AtticFace4', Face3D(pts_4)) face_5 = Face('AtticFace5', Face3D(pts_5)) attic = Room('Attic', [face_1, face_2, face_3, face_4, face_5], 0.01, 1) constr_set = ConstructionSet('Attic Construction Set') polyiso = EnergyMaterial('PolyIso', 0.2, 0.03, 43, 1210, 'MediumRough') roof_constr = OpaqueConstruction('Attic Roof Construction', [roof_membrane, polyiso, wood]) floor_constr = OpaqueConstruction('Attic Floor Construction', [wood, insulation, wood]) constr_set.floor_set.interior_construction = floor_constr constr_set.roof_ceiling_set.exterior_construction = roof_constr attic.properties.energy.construction_set = constr_set Room.solve_adjacency([first_floor, second_floor, attic], 0.01) model = Model('MultiZoneSingleFamilyHouse', [first_floor, second_floor, attic]) assert model.properties.energy.check_duplicate_construction_set_identifiers(False) constr_set.unlock() constr_set.identifier = 'Lower Floor Construction Set' constr_set.lock() assert not model.properties.energy.check_duplicate_construction_set_identifiers(False) with pytest.raises(ValueError): model.properties.energy.check_duplicate_construction_set_identifiers(True)
"""Collection of construction sets.""" from honeybee_energy.constructionset import ConstructionSet from ._loadconstructionsets import _json_construction_sets # establish variables for the default construction sets used across the library # and auto-generate construction sets if they were not loaded from default.idf try: generic_construction_set = _json_construction_sets[ 'Default Generic Construction Set'] except KeyError: generic_construction_set = ConstructionSet( 'Default Generic Construction Set') generic_construction_set.lock() _json_construction_sets[ 'Default Generic Construction Set'] = generic_construction_set # make lists of program types to look up items in the library CONSTRUCTION_SETS = tuple(_json_construction_sets.keys()) def construction_set_by_name(construction_set_name): """Get a construction_set from the library given its name. Args: construction_set_name: A text string for the name of the ConstructionSet. """ try: return _json_construction_sets[construction_set_name] except KeyError: raise ValueError(