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())
def get_setup(config): area = Area( 'Grid', children=[ Area('House 1', children=[ Area('H2 PV', strategy=PVUserProfileStrategy( panel_count=1, initial_selling_rate=80, power_profile={ 0: 200, 12: 400, 19: 0 }), event_list=[ StrategyEvents( 14, {'power_profile': { 0: 200, 14: 600, 19: 0 }}) ]) ]), Area('Grid Load', strategy=LoadHoursStrategy(avg_power_W=10000, hrs_per_day=24, hrs_of_day=list(range(0, 24)), final_buying_rate=35)) ], config=config) return area
def get_setup(config): ConstSettings.IAASettings.MARKET_TYPE = 3 area = Area( 'Grid', [ Area( 'House 1', [ Area('H1 PV', strategy=PVUserProfileStrategy( power_profile=house1_pv_production), appliance=PVAppliance()), Area('H1 General Load', strategy=DefinedLoadStrategy( daily_load_profile=load_profile_path, final_buying_rate=28), appliance=SwitchableAppliance()), ]), Area( 'House 2', [ Area('H2 PV', strategy=PVStrategy(30), appliance=PVAppliance()), Area('H2 General Load', strategy=DefinedLoadStrategy( daily_load_profile=house2_load_dict), appliance=SwitchableAppliance()), ]), Area( 'House 3', [ Area('H3 General Load', strategy=DefinedLoadStrategy( daily_load_profile=house3_load_dict, final_buying_rate=25), appliance=SwitchableAppliance()), ]), Area( 'House 4', [ Area('H4 General Load', strategy=DefinedLoadStrategy( daily_load_profile=load_profile_path, final_buying_rate=24), appliance=SwitchableAppliance()), ]), Area('Infinite Power Plant', strategy=CommercialStrategy(energy_rate=30), appliance=SimpleAppliance()), ], config=config ) return area
def get_setup(config): area = Area('Grid', [ Area('House 1', [ Area('H1 General Load', strategy=LoadHoursStrategy(avg_power_W=500, hrs_per_day=12, hrs_of_day=list(range(7, 20)))), Area( 'H1 PV', strategy=PVUserProfileStrategy(power_profile=user_profile_path, panel_count=1), ), ]), ], config=config) return area
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)
def get_setup(config): area = Area('Grid', [ Area('House 1', [ Area('H1 General Load', strategy=LoadHoursStrategy(avg_power_W=500, hrs_per_day=12, hrs_of_day=list(range(7, 20))), appliance=SwitchableAppliance()), Area('H1 PV', strategy=PVUserProfileStrategy( power_profile=user_profile, panel_count=1, risk=80), appliance=PVAppliance()), ]), ], config=config) return area
def get_setup(config): ConstSettings.IAASettings.MARKET_TYPE = 2 ConstSettings.IAASettings.BID_OFFER_MATCH_TYPE = \ BidOfferMatchAlgoEnum.PAY_AS_CLEAR.value area = Area('Grid', [ Area('House 1', [ Area('H1 PV', strategy=PVUserProfileStrategy( power_profile=house1_pv_production)), Area('H1 General Load', strategy=DefinedLoadStrategy( daily_load_profile=load_profile_path, final_buying_rate=28)), ]), Area('House 2', [ Area('H2 PV', strategy=PVStrategy(30)), Area( 'H2 General Load', strategy=DefinedLoadStrategy( daily_load_profile=house2_load_dict), ) ]), Area('House 3', [ Area( 'H3 General Load', strategy=DefinedLoadStrategy( daily_load_profile=house3_load_dict, final_buying_rate=25), ) ]), Area('House 4', [ Area( 'H4 General Load', strategy=DefinedLoadStrategy( daily_load_profile=load_profile_path, final_buying_rate=24), ) ]), Area( 'Infinite Power Plant', strategy=CommercialStrategy(energy_rate=30), ) ], config=config) return area
def get_setup(config): ConstSettings.GeneralSettings.DEFAULT_UPDATE_INTERVAL = 1 ConstSettings.IAASettings.MARKET_TYPE = 1 area = Area( 'Grid', [ Area( 'Community', [ Area( 'House 1', [ Area('H1 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H1 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV1.csv"), initial_selling_rate=20, final_selling_rate=20, fit_to_limit=True), appliance=PVAppliance()), ], grid_fee_percentage=0, grid_fee_constant=0, ), Area( 'House 2', [ Area('H2 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H2 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV2.csv"), initial_selling_rate=20, final_selling_rate=20, fit_to_limit=True), appliance=PVAppliance()), ], grid_fee_percentage=0, grid_fee_constant=0, ), Area( 'House 3', [ Area('H3 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H3 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV3.csv"), initial_selling_rate=20, final_selling_rate=20, fit_to_limit=True), appliance=PVAppliance()), ], grid_fee_percentage=0, grid_fee_constant=0, ), ], grid_fee_percentage=1, grid_fee_constant=0, ), Area('DSO', strategy=InfiniteBusStrategy(energy_buy_rate=20, energy_sell_rate=30), appliance=SimpleAppliance()), ], config=config, grid_fee_percentage=0, grid_fee_constant=0, ) return area
def get_setup(config): ConstSettings.GeneralSettings.DEFAULT_UPDATE_INTERVAL = 1 ConstSettings.IAASettings.MARKET_TYPE = 2 ConstSettings.GeneralSettings.KEEP_PAST_MARKETS = False ConstSettings.IAASettings.MIN_OFFER_AGE = 1 area = Area( 'Grid', [ Area( 'Community', [ Area( 'House 1', [ Area('H1 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H1 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV1.csv"), initial_selling_rate=20, final_selling_rate=15, fit_to_limit=True), appliance=PVAppliance()), Area('H1 General Load evening', strategy=LoadHoursStrategy( hrs_per_day=1, hrs_of_day=list([22, 23]), avg_power_W=2000, initial_buying_rate=20, final_buying_rate=30), appliance=SwitchableAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area('central storage', strategy=StorageStrategy(initial_soc=10, min_allowed_soc=10, battery_capacity_kWh=6, max_abs_battery_power_kW=5, initial_buying_rate=12, final_buying_rate=20, initial_selling_rate=29, final_selling_rate=20.01), appliance=SwitchableAppliance()), Area( 'House 2', [ Area('H2 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H2 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV2.csv"), initial_selling_rate=20, final_selling_rate=15, fit_to_limit=True), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'House 3', [ Area('H3 General Load', strategy=DefinedLoadStrategy( daily_load_profile=os.path.join( current_dir, "../../resources/KPI_L1.csv"), initial_buying_rate=20, final_buying_rate=30, fit_to_limit=True), appliance=SwitchableAppliance()), Area('H3 PV', strategy=PVUserProfileStrategy( power_profile=os.path.join( current_dir, "../../resources/KPI_PV3.csv"), initial_selling_rate=20, final_selling_rate=15, fit_to_limit=True), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area('Feed In Tariff', strategy=InfiniteBusStrategy(energy_buy_rate=15.2, energy_sell_rate=200), appliance=SimpleAppliance()), Area('Market Maker', strategy=MarketMakerStrategy(energy_rate=30, grid_connected=True)) ], config=config, grid_fee_percentage=0, transfer_fee_const=0, ) return area
def get_setup(config): ConstSettings.GeneralSettings.DEFAULT_UPDATE_INTERVAL = 3 ConstSettings.IAASettings.MARKET_TYPE = 2 ConstSettings.GeneralSettings.DEFAULT_MARKET_MAKER_RATE = 30 Houses_initial_buying_rate = 10 PV_initial = 20 PV_final = 4 area = Area('grid', [ Area('Community', [ Area('house-1-s', [ Area('h1-load-s', strategy=LoadProfileExternalStrategy( daily_load_profile=load1, initial_buying_rate=Houses_initial_buying_rate, use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h1-pv-s', strategy=PVUserProfileExternalStrategy( power_profile=pv1, initial_selling_rate=PV_initial, final_selling_rate=PV_final), appliance=PVAppliance()), Area('h1-storage-s', strategy=StorageExternalStrategy( initial_soc=50, min_allowed_soc=10, battery_capacity_kWh=5, max_abs_battery_power_kW=4), appliance=SwitchableAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, external_connection_available=True), Area( 'house-2', [ Area('h2-load', strategy=DefinedLoadStrategy( daily_load_profile=load2, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h2-pv', strategy=PVUserProfileStrategy( power_profile=pv2, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), Area('h2-storage', strategy=StorageStrategy(initial_soc=50, min_allowed_soc=10, battery_capacity_kWh=5, max_abs_battery_power_kW=4, initial_buying_rate=12, final_buying_rate=15, initial_selling_rate=29, final_selling_rate=15.01), appliance=SwitchableAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-3', [ Area('h3-load', strategy=DefinedLoadStrategy( daily_load_profile=load3, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h3-pv', strategy=PVUserProfileStrategy( power_profile=pv3, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-4', [ Area('h4-load', strategy=DefinedLoadStrategy( daily_load_profile=load4, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h4-pv', strategy=PVUserProfileStrategy( power_profile=pv4, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-5', [ Area('h5-load', strategy=DefinedLoadStrategy( daily_load_profile=load5, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-6', [ Area('h6-load', strategy=DefinedLoadStrategy( daily_load_profile=load6, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h6-pv', strategy=PVUserProfileStrategy( power_profile=pv6, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-7', [ Area('h7-load', strategy=DefinedLoadStrategy( daily_load_profile=load7, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h7-pv', strategy=PVUserProfileStrategy( power_profile=pv7, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-8', [ Area('h8-load', strategy=DefinedLoadStrategy( daily_load_profile=load8, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h8-pv', strategy=PVUserProfileStrategy( power_profile=pv8, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-9', [ Area('h9-load', strategy=DefinedLoadStrategy( daily_load_profile=load9, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h9-pv', strategy=PVUserProfileStrategy( power_profile=pv9, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-10', [ Area('h10-load', strategy=DefinedLoadStrategy( daily_load_profile=load10, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h10-pv', strategy=PVUserProfileStrategy( power_profile=pv10, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), Area( 'house-11', [ Area('h11-load', strategy=DefinedLoadStrategy( daily_load_profile=load11, initial_buying_rate=Houses_initial_buying_rate * round((random() - 0.5) * VARIANCE_RATES + 1, 2), use_market_maker_rate=True), appliance=SwitchableAppliance()), Area('h11-pv', strategy=PVUserProfileStrategy( power_profile=pv11, initial_selling_rate=PV_initial * round( (random() - 0.5) * VARIANCE_RATES + 1, 2), final_selling_rate=PV_final), appliance=PVAppliance()), ], grid_fee_percentage=0, transfer_fee_const=0, ), ], grid_fee_percentage=0, transfer_fee_const=0, external_connection_available=True), Area('Feed-in tariff', strategy=LoadHoursStrategy(avg_power_W=100000000, hrs_per_day=24, hrs_of_day=list(range(0, 24)), initial_buying_rate=11, final_buying_rate=11), appliance=SwitchableAppliance()), Area('Market Maker', strategy=MarketMakerStrategy( energy_rate=ConstSettings.GeneralSettings. DEFAULT_MARKET_MAKER_RATE, grid_connected=True), appliance=SimpleAppliance()), ], config=config, grid_fee_percentage=0, transfer_fee_const=0, external_connection_available=False) return area