示例#1
0
def test_setpoint_setability():
    """Test the setting of properties of Setpoint."""
    heat_setpt = ScheduleRuleset.from_constant_value(
        'Office Heating', 21, schedule_types.temperature)
    cool_setpt = ScheduleRuleset.from_constant_value(
        'Office Cooling', 24, schedule_types.temperature)
    setpoint = Setpoint('Office Setpoint', heat_setpt, cool_setpt)

    setpoint.identifier = 'Office Zone Setpoint'
    assert setpoint.identifier == 'Office Zone Setpoint'
    setpoint.heating_setpoint = 20
    assert setpoint.heating_setpoint == 20
    assert setpoint.heating_setback == 20
    setpoint.cooling_setpoint = 26
    assert setpoint.cooling_setpoint == 26
    assert setpoint.cooling_setback == 26
    setpoint.humidifying_setpoint = 30
    assert setpoint.humidifying_setpoint == 30
    assert setpoint.humidifying_setback == 30
    setpoint.dehumidifying_setpoint = 60
    assert setpoint.dehumidifying_setpoint == 60
    assert setpoint.dehumidifying_setback == 60
示例#2
0
def test_setpoint_init_humidity():
    """Test the initialization of Setpoint with humidity setpoints."""
    heat_setpt = ScheduleRuleset.from_constant_value(
        'Office Heating', 21, schedule_types.temperature)
    cool_setpt = ScheduleRuleset.from_constant_value(
        'Office Cooling', 24, schedule_types.temperature)
    setpoint = Setpoint('Office Setpoint', heat_setpt, cool_setpt)
    setpoint.humidifying_setpoint = 30
    setpoint.dehumidifying_setpoint = 60
    str(setpoint)  # test the string representation

    assert setpoint.identifier == 'Office Setpoint'
    assert setpoint.heating_schedule == heat_setpt
    assert setpoint.heating_setpoint == 21
    assert setpoint.heating_setback == 21
    assert setpoint.cooling_schedule == cool_setpt
    assert setpoint.cooling_setpoint == 24
    assert setpoint.cooling_setback == 24
    assert setpoint.humidifying_schedule.is_constant
    assert setpoint.humidifying_setpoint == 30
    assert setpoint.humidifying_setback == 30
    assert setpoint.dehumidifying_schedule.is_constant
    assert setpoint.dehumidifying_setpoint == 60
    assert setpoint.dehumidifying_setback == 60
    from honeybee_energy.lib.schedules import schedule_by_identifier
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))

try:
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # make a default Setpoint name if none is provided
    name = clean_and_id_ep_string('Setpoint') if _name_ is None else \
        clean_ep_string(_name_)

    # get the schedules
    if isinstance(_heating_sch, str):
        _heating_sch = schedule_by_identifier(_heating_sch)
    if isinstance(_cooling_sch, str):
        _cooling_sch = schedule_by_identifier(_cooling_sch)

    # create the Setpoint object
    setpoint = Setpoint(name, _heating_sch, _cooling_sch)
    if _name_ is not None:
        setpoint.display_name = _name_

    # assign the humidification and dehumidification setpoints if requested
    if humid_setpt_ is not None:
        setpoint.humidifying_setpoint = humid_setpt_
    if dehumid_setpt_ is not None:
        setpoint.dehumidifying_setpoint = dehumid_setpt_