コード例 #1
0
def test_use_market_maker_rate_parameter_is_respected_for_load_profiles(
        use_mmr, expected_rate):
    GlobalConfig.market_maker_rate = 9
    user_profile_path = os.path.join(d3a_path,
                                     "resources/Solar_Curve_W_sunny.csv")
    load = DefinedLoadStrategy(daily_load_profile=user_profile_path,
                               final_buying_rate=33,
                               use_market_maker_rate=use_mmr)
    load.area = FakeArea()
    load.owner = load.area
    load.event_activate()
    assert all(v == expected_rate for v in load.bid_update.final_rate.values())
コード例 #2
0
def test_predefined_load_strategy_rejects_incorrect_rate_parameters(
        use_mmr, initial_buying_rate):
    user_profile_path = os.path.join(d3a_path,
                                     "resources/Solar_Curve_W_sunny.csv")
    load = DefinedLoadStrategy(daily_load_profile=user_profile_path,
                               initial_buying_rate=initial_buying_rate,
                               use_market_maker_rate=use_mmr)
    load.area = FakeArea()
    load.owner = load.area
    with pytest.raises(D3ADeviceException):
        load.event_activate()
    with pytest.raises(D3ADeviceException):
        DefinedLoadStrategy(daily_load_profile=user_profile_path,
                            fit_to_limit=True,
                            energy_rate_increase_per_update=1)
    with pytest.raises(D3ADeviceException):
        DefinedLoadStrategy(daily_load_profile=user_profile_path,
                            fit_to_limit=False,
                            energy_rate_increase_per_update=-1)