Beispiel #1
0
def test_service_hot_water_lockability():
    """Test the lockability of ServiceHotWater objects."""
    weekday_office = ScheduleDay('Weekday Office Water Use', [0, 1, 0],
                                 [Time(0, 0), Time(9, 0), Time(17, 0)])
    saturday_office = ScheduleDay('Saturday Office Water Use', [0, 0.25, 0],
                                  [Time(0, 0), Time(9, 0), Time(17, 0)])
    weekend_rule = ScheduleRule(saturday_office)
    weekend_rule.apply_weekend = True
    schedule = ScheduleRuleset('Office Water Use', weekday_office,
                               [weekend_rule], schedule_types.fractional)
    shw = ServiceHotWater('Open Office Zone Hot Water', 0.1, schedule)

    shw.flow_per_area = 0.2
    shw.lock()
    with pytest.raises(AttributeError):
        shw.flow_per_area = 0.25
    with pytest.raises(AttributeError):
        shw.schedule.default_day_schedule.remove_value_by_time(Time(17, 0))
    shw.unlock()
    shw.flow_per_area = 0.25
    with pytest.raises(AttributeError):
        shw.schedule.default_day_schedule.remove_value_by_time(Time(17, 0))
Beispiel #2
0
def test_service_hot_water_setability():
    """Test the setting of properties of ServiceHotWater."""
    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)
    constant = ScheduleRuleset.from_constant_value(
        'Constant Water Use', 1, schedule_types.fractional)
    shw = ServiceHotWater('Office Hot Water', 0.1, schedule)

    shw.identifier = 'Office Zone Hot Water'
    assert shw.identifier == 'Office Zone Hot Water'
    shw.flow_per_area = 0.05
    assert shw.flow_per_area == 0.05
    shw.schedule = constant
    assert shw.schedule == constant
    assert shw.schedule.values() == [1] * 8760
    shw.target_temperature = 25
    assert shw.target_temperature == 25
    shw.sensible_fraction = 0.25
    assert shw.sensible_fraction == 0.25
    shw.latent_fraction = 0.1
    assert shw.latent_fraction == 0.1