def test_set_program_type():
    """Test the setting of a ProgramType on a Room."""
    lab_equip_day = ScheduleDay('Daily Lab Equipment', [0.25, 0.5, 0.25],
                                [Time(0, 0), Time(9, 0), Time(20, 0)])
    lab_equipment = ScheduleRuleset('Lab Equipment', lab_equip_day,
                                    None, schedule_types.fractional)
    lab_vent_day = ScheduleDay('Daily Lab Ventilation', [0.5, 1, 0.5],
                               [Time(0, 0), Time(9, 0), Time(20, 0)])
    lab_ventilation = ScheduleRuleset('Lab Ventilation', lab_vent_day,
                                      None, schedule_types.fractional)
    lab_program = office_program.duplicate()
    lab_program.identifier = 'Bio Laboratory'
    lab_program.electric_equipment.watts_per_area = 50
    lab_program.electric_equipment.schedule = lab_equipment
    lab_program.ventilation.flow_per_person = 0
    lab_program.ventilation.flow_per_area = 0
    lab_program.ventilation.air_changes_per_hour = 6
    lab_program.ventilation.schedule = lab_ventilation

    room = Room.from_box('ShoeBox', 5, 10, 3)
    room.properties.energy.program_type = lab_program

    assert room.properties.energy.program_type.identifier == 'Bio Laboratory'
    assert room.properties.energy.program_type == lab_program
    assert room.properties.energy.electric_equipment.watts_per_area == 50
    assert room.properties.energy.electric_equipment.schedule == lab_equipment
    assert room.properties.energy.ventilation.flow_per_person == 0
    assert room.properties.energy.ventilation.flow_per_area == 0
    assert room.properties.energy.ventilation.air_changes_per_hour == 6
    assert room.properties.energy.ventilation.schedule == lab_ventilation
Esempio n. 2
0
def test_set_all_room_2d_program_type():
    """Test the set_all_room_2d_program_type method on a Story."""
    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)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))

    lab_program = office_program.duplicate()
    lab_program.identifier = 'Bio Laboratory'
    lab_program.electric_equipment.watts_per_area = 50
    lab_program.ventilation.flow_per_person = 0
    lab_program.ventilation.flow_per_area = 0
    lab_program.ventilation.air_changes_per_hour = 6

    story.properties.energy.set_all_room_2d_program_type(lab_program)

    assert all(room_2d.properties.energy.program_type == lab_program
               for room_2d in story.room_2ds)
Esempio n. 3
0
def program_type_office(directory):
    dest_file = os.path.join(directory, 'program_type_office.json')
    program_obj = office_program.duplicate()
    simple_office = ScheduleDay(
        'Simple Weekday', [0, 1, 0],
        [Time(0, 0), Time(9, 0), Time(17, 0)])
    schedule = ScheduleRuleset('Office Water Use', simple_office, None,
                               schedule_types.fractional)
    shw = ServiceHotWater('Office Hot Water', 0.1, schedule)
    program_obj.service_hot_water = shw
    with open(dest_file, 'w') as fp:
        json.dump(program_obj.to_dict(abridged=False), fp, indent=4)
Esempio n. 4
0
def test_set_program_type():
    """Test the setting of a ProgramType on a Room2D."""
    lab_equip_day = ScheduleDay(
        'Daily Lab Equipment', [0.25, 0.5, 0.25],
        [Time(0, 0), Time(9, 0), Time(20, 0)])
    lab_equipment = ScheduleRuleset('Lab Equipment', lab_equip_day, None,
                                    schedule_types.fractional)
    lab_vent_day = ScheduleDay(
        'Daily Lab Ventilation', [0.5, 1, 0.5],
        [Time(0, 0), Time(9, 0), Time(20, 0)])
    lab_ventilation = ScheduleRuleset('Lab Ventilation', lab_vent_day, None,
                                      schedule_types.fractional)
    lab_program = office_program.duplicate()
    lab_program.identifier = 'Bio Laboratory'
    lab_program.electric_equipment.watts_per_area = 50
    lab_program.electric_equipment.schedule = lab_equipment
    lab_program.ventilation.flow_per_person = 0
    lab_program.ventilation.flow_per_area = 0
    lab_program.ventilation.air_changes_per_hour = 6
    lab_program.ventilation.schedule = lab_ventilation

    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    room = Room2D('SquareShoebox', Face3D(pts), 3)
    room.set_outdoor_window_parameters(ashrae_base)

    room.properties.energy.program_type = lab_program

    assert room.properties.energy.program_type.identifier == 'Bio Laboratory'
    assert room.properties.energy.program_type == lab_program

    hb_room, adj = room.to_honeybee()
    assert hb_room.properties.energy.electric_equipment.watts_per_area == 50
    assert hb_room.properties.energy.electric_equipment.schedule == lab_equipment
    assert hb_room.properties.energy.ventilation.flow_per_person == 0
    assert hb_room.properties.energy.ventilation.flow_per_area == 0
    assert hb_room.properties.energy.ventilation.air_changes_per_hour == 6
    assert hb_room.properties.energy.ventilation.schedule == lab_ventilation