예제 #1
0
def test_use_mmr_parameter_is_respected_for_pv_profiles(use_mmr, expected_rate):
    GlobalConfig.market_maker_rate = 13
    user_profile_path = os.path.join(d3a_path, "resources/Solar_Curve_W_sunny.csv")
    pv = PVUserProfileStrategy(
        power_profile=user_profile_path, initial_selling_rate=17, use_market_maker_rate=use_mmr,
        max_panel_power_W=200)
    pv.area = FakeArea()
    pv.event_activate()
    assert all(v == expected_rate for v in pv.offer_update.initial_rate.values())
예제 #2
0
def test_pv_user_profile_constructor_rejects_incorrect_parameters():
    user_profile_path = os.path.join(d3a_path, "resources/Solar_Curve_W_sunny.csv")
    with pytest.raises(D3ADeviceException):
        PVUserProfileStrategy(power_profile=user_profile_path, panel_count=-1)
    with pytest.raises(D3ADeviceException):
        pv = PVUserProfileStrategy(power_profile=user_profile_path,
                                   initial_selling_rate=5, final_selling_rate=15)
        pv.event_activate()
    with pytest.raises(D3ADeviceException):
        PVUserProfileStrategy(power_profile=user_profile_path,
                              fit_to_limit=True, energy_rate_decrease_per_update=1)
    with pytest.raises(D3ADeviceException):
        PVUserProfileStrategy(power_profile=user_profile_path,
                              fit_to_limit=False, energy_rate_decrease_per_update=-1)