def test_story_make_underground(): """Test the Story make_underground method.""" pts_1 = (Point3D(0, 0, 3), Point3D(0, 10, 3), Point3D(10, 10, 3), Point3D(10, 0, 3)) pts_2 = (Point3D(10, 0, 3), Point3D(10, 10, 3), Point3D(20, 10, 3), Point3D(20, 0, 3)) pts_3 = (Point3D(0, 10, 3), Point3D(0, 20, 3), Point3D(10, 20, 3), Point3D(10, 10, 3)) pts_4 = (Point3D(10, 10, 3), Point3D(10, 20, 3), Point3D(20, 20, 3), Point3D(20, 10, 3)) room2d_1 = Room2D('Office1', Face3D(pts_1), 3) room2d_2 = Room2D('Office2', Face3D(pts_2), 3) room2d_3 = Room2D('Office3', Face3D(pts_3), 3) room2d_4 = Room2D('Office4', Face3D(pts_4), 3) story = Story('OfficeFloor', [room2d_1, room2d_2, room2d_3, room2d_4]) story.solve_room_2d_adjacency(0.01) assert all(not room.is_ground_contact for room in story.room_2ds) assert all(not room.is_top_exposed for room in story.room_2ds) assert story.is_above_ground story.set_ground_contact(True) assert all(room.is_ground_contact for room in story.room_2ds) story.set_top_exposed(True) assert all(room.is_top_exposed for room in story.room_2ds) story.make_underground() assert not story.is_above_ground
def lab_building(directory): poly_file = './scripts/geometry/lab_building_geo.json' with open(poly_file, 'r') as fp: geo_dict = json.load(fp) # get all of the programs and construction sets c_set = constr_set_lib.construction_set_by_identifier('2013::ClimateZone5::SteelFramed') office = prog_type_lib.program_type_by_identifier('2013::MediumOffice::ClosedOffice') writeup = prog_type_lib.program_type_by_identifier('2013::Laboratory::Office') lab_support = prog_type_lib.program_type_by_identifier('2013::Laboratory::Lab with fume hood') laboratory = prog_type_lib.program_type_by_identifier('2013::Laboratory::Open lab') conference = prog_type_lib.program_type_by_identifier('2013::MediumOffice::Conference') classroom = prog_type_lib.program_type_by_identifier('2013::MediumOffice::Classroom') corridor = prog_type_lib.program_type_by_identifier('2013::MediumOffice::Corridor') storage = prog_type_lib.program_type_by_identifier('2013::MediumOffice::Storage') progs = [office, writeup, lab_support, laboratory, conference, classroom, corridor, storage] prog_keys = ['office', 'writeup', 'lab_support', 'laboratory', 'conference', 'classroom', 'corridor', 'storage'] # create the basic Room objects rooms = [] for prog_key, program in zip(prog_keys, progs): for i, room_geo_dict in enumerate(geo_dict[prog_key]): room_geo = Face3D.from_dict(room_geo_dict) room = Room2D('{}_{}'.format(prog_key, i), room_geo, 3.5) room.properties.energy.program_type = program room.properties.energy.construction_set = c_set room.properties.energy.add_default_ideal_air() rooms.append(room) # solve adjacency and set windows + shades story = Story('Lab_Floor_1', rooms, 4) story.remove_room_2d_colinear_vertices(0.01) story.intersect_room_2d_adjacency(0.01) story.solve_room_2d_adjacency(0.01) story.set_outdoor_window_parameters(RepeatingWindowRatio(0.35, 2.8, 0.8, 3)) story.set_ground_contact(True) story.set_top_exposed(True) bldg = Building('Lab_Building', [story]) # create the honeybee model model = bldg.to_honeybee(tolerance=0.01) model.units = 'Meters' model.tolerance = 0.01 model.angle_tolerance = 1.0 # generate louvers for all of the apertures for ap in model.apertures: ap.louvers_by_count(1, 0.5, 0.0, 0.0, Vector2D(1, 0)) # write the model to a JSON dest_file = os.path.join(directory, 'lab_building.hbjson') with open(dest_file, 'w') as fp: json.dump(model.to_dict(), fp, indent=4)