Exemple #1
0
def test_setpoint_equality():
    """Test the equality of Setpoint objects."""
    simple_heat = ScheduleDay(
        'Simple Weekday HtgSetp', [18, 21, 18],
        [Time(0, 0), Time(9, 0), Time(17, 0)])
    simple_cool = ScheduleDay(
        'Simple Weekday ClgSetp', [28, 24, 28],
        [Time(0, 0), Time(9, 0), Time(17, 0)])
    heat_setpt = ScheduleRuleset('Office Heating', simple_heat, None,
                                 schedule_types.temperature)
    cool_setpt = ScheduleRuleset('Office Cooling', simple_cool, None,
                                 schedule_types.temperature)
    heat_setpt_2 = ScheduleRuleset.from_constant_value(
        'Office Heating', 21, schedule_types.temperature)
    cool_setpt_2 = ScheduleRuleset.from_constant_value(
        'Office Cooling', 24, schedule_types.temperature)

    setpoint = Setpoint('Office Setpoint', heat_setpt, cool_setpt)
    setpoint_dup = setpoint.duplicate()
    setpoint_alt = Setpoint('Office Setpoint', heat_setpt_2, cool_setpt_2)

    assert setpoint is setpoint
    assert setpoint is not setpoint_dup
    assert setpoint == setpoint_dup
    setpoint_dup.humidifying_setpoint = 30
    assert setpoint != setpoint_dup
    assert setpoint != setpoint_alt
Exemple #2
0
def test_setpoint_average():
    """Test the Setpoint.average method."""
    heat_setpt = ScheduleRuleset.from_constant_value(
        'Office Heating', 22, schedule_types.temperature)
    cool_setpt = ScheduleRuleset.from_constant_value(
        'Office Cooling', 24, schedule_types.temperature)
    office_setpoint = Setpoint('Office Setpoint', heat_setpt, cool_setpt)
    lobby_setpoint = office_setpoint.duplicate()
    lobby_setpoint.identifier = 'Lobby Setpoint'
    lobby_setpoint.heating_setpoint = 18
    lobby_setpoint.cooling_setpoint = 28

    office_avg = Setpoint.average('Office Average Setpoint',
                                  [office_setpoint, lobby_setpoint])

    assert office_avg.heating_setpoint == pytest.approx(20, rel=1e-3)
    assert office_avg.heating_setback == pytest.approx(20, rel=1e-3)
    assert office_avg.cooling_setpoint == pytest.approx(26, rel=1e-3)
    assert office_avg.cooling_setback == pytest.approx(26, rel=1e-3)
    assert office_avg.humidifying_setpoint is None
    assert office_avg.humidifying_setback is None
    assert office_avg.dehumidifying_setpoint is None
    assert office_avg.dehumidifying_setback is None
Exemple #3
0
def model_energy_afn_multizone(directory):

    # south Room
    szone_pts = Face3D(
        [Point3D(0, 0),
         Point3D(20, 0),
         Point3D(20, 10),
         Point3D(0, 10)])
    sroom = Room.from_polyface3d('SouthRoom',
                                 Polyface3D.from_offset_face(szone_pts, 3))

    # north Room
    nzone_pts = Face3D(
        [Point3D(0, 10),
         Point3D(20, 10),
         Point3D(20, 20),
         Point3D(0, 20)])
    nroom = Room.from_polyface3d('NorthRoom',
                                 Polyface3D.from_offset_face(nzone_pts, 3))

    # add exterior windows on east/west faces
    sroom[2].apertures_by_ratio(0.3)
    nroom[4].apertures_by_ratio(0.3)
    sroom[2].apertures[0].is_operable = True
    nroom[4].apertures[0].is_operable = True

    # add small interior windows on north/south faces
    sroom[3].apertures_by_ratio(0.15)
    nroom[1].apertures_by_ratio(0.15)
    sroom[3].apertures[0].is_operable = True
    nroom[1].apertures[0].is_operable = True

    # ventilation openings
    vent_openings = VentilationOpening(fraction_area_operable=1,
                                       fraction_height_operable=1,
                                       discharge_coefficient=0.6,
                                       wind_cross_vent=False,
                                       flow_coefficient_closed=0.001,
                                       flow_exponent_closed=0.667,
                                       two_way_threshold=0.0001)

    sroom.properties.energy.assign_ventilation_opening(vent_openings)
    nroom.properties.energy.assign_ventilation_opening(
        vent_openings.duplicate())

    # make ventilation control
    heat_setpt = ScheduleRuleset.from_constant_value(
        'House Heating', 20, schedule_types.temperature)
    cool_setpt = ScheduleRuleset.from_constant_value(
        'House Cooling', 28, schedule_types.temperature)
    setpoint = Setpoint('House Setpoint', heat_setpt, cool_setpt)
    sroom.properties.energy.setpoint = setpoint
    nroom.properties.energy.setpoint = setpoint.duplicate()

    vent_control = VentilationControl(22, 27, 12, 30)
    sroom.properties.energy.window_vent_control = vent_control
    nroom.properties.energy.window_vent_control = vent_control.duplicate()

    # rooms
    rooms = [sroom, nroom]
    for room in rooms:
        # Add program and hvac
        room.properties.energy.program_type = prog_type_lib.office_program

    # make model
    model = Model('Two_Zone_Simple', rooms)
    vsc = VentilationSimulationControl(
        vent_control_type='MultiZoneWithoutDistribution',
        building_type='LowRise',
        long_axis_angle=0,
        aspect_ratio=1)
    model.properties.energy.ventilation_simulation_control = vsc

    # make interior faces
    Room.solve_adjacency(rooms, 0.01)

    # make afn
    afn.generate(model.rooms)

    dest_file = os.path.join(directory, 'model_energy_afn.json')
    with open(dest_file, 'w') as fp:
        json.dump(model.to_dict(included_prop=['energy']), fp, indent=4)