Exemplo n.º 1
0
def get_setup(config):

    i_c = 12 * 1.2
    i_c_f = 1
    area = Area('Grid', [
        Area('House 1', [
            Area('H1 PV', strategy=PVStrategy(60, 80),
                 appliance=PVAppliance()),
            Area('H1 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
            Area('H1 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=i_c,
                                          max_abs_battery_power_kW=i_c,
                                          initial_capacity_kWh=i_c_f * i_c),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 2', [
            Area('H2 PV', strategy=PVStrategy(60, 80),
                 appliance=PVAppliance()),
            Area('H2 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
            Area('H2 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=i_c,
                                          max_abs_battery_power_kW=i_c,
                                          initial_capacity_kWh=i_c_f * i_c),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 3', [
            Area('H3 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
            Area('H3 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=i_c,
                                          max_abs_battery_power_kW=i_c,
                                          initial_capacity_kWh=i_c_f * i_c),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 4', [
            Area('H4 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
            Area('H4 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=i_c,
                                          max_abs_battery_power_kW=i_c,
                                          initial_capacity_kWh=i_c_f * i_c),
                 appliance=SwitchableAppliance()),
        ]),
    ],
                config=config)
    return area
Exemplo n.º 2
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.event_activate()
    assert all(v == expected_rate for v in load.bid_update.final_rate.values())
Exemplo n.º 3
0
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
Exemplo n.º 4
0
def get_setup(config):
    area = Area('Grid', [
        Area('House 1', [
            Area('H1 DefinedLoad',
                 strategy=DefinedLoadStrategy(daily_load_profile=profile_path,
                                              final_buying_rate=36),
                 appliance=SwitchableAppliance()),
            Area('H1 Storage1',
                 strategy=StorageStrategy(initial_soc=50),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 2', [
            Area('H2 General Load',
                 strategy=LoadHoursStrategy(avg_power_W=1000,
                                            hrs_per_day=4,
                                            hrs_of_day=list(range(12, 16)),
                                            final_buying_rate=35),
                 appliance=SwitchableAppliance()),
            Area('H2 PV', strategy=PVStrategy(1, 80), appliance=PVAppliance()),
        ]),
        Area('Finite Commercial Producer',
             strategy=FinitePowerPlant(energy_rate=30,
                                       max_available_power_kW=0.01),
             appliance=SwitchableAppliance()),
        Area('Commercial Energy Producer',
             strategy=CommercialStrategy(energy_rate=30),
             appliance=SimpleAppliance()),
    ],
                config=config)
    return area
Exemplo n.º 5
0
def get_setup(config):
    ConstSettings.IAASettings.MARKET_TYPE = 2
    area = Area(
        'Grid',
        children=[
            Area(
                'House 1',
                children=[
                    Area('H1 General Load',
                         strategy=DefinedLoadStrategy(daily_load_profile={0: 200, 12: 200},
                                                      initial_buying_rate=1,
                                                      final_buying_rate=37),
                         event_list=[StrategyEvents(12, {'daily_load_profile': {0: 200, 12: 400}}),
                                     StrategyEvents(15, {'initial_buying_rate': 24,
                                                         'fit_to_limit': False,
                                                         'update_interval': 10,
                                                         'energy_rate_increase_per_update': 1})]
                         )
                ]
            ),
            Area('Commercial Energy Producer',
                 strategy=CommercialStrategy(energy_rate=30)
                 ),

        ],
        config=config
    )
    return area
Exemplo n.º 6
0
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
Exemplo n.º 7
0
def get_setup(config):
    area = Area('Grid', [
        Area('House 1', [
            Area('H1 DefinedLoad',
                 strategy=DefinedLoadStrategy(daily_load_profile=user_profile,
                                              final_buying_rate=35)),
        ]),
        Area('Commercial Energy Producer', strategy=CommercialStrategy()),
    ],
                config=config)
    return area
def get_setup(config):
    area = Area('Grid', [
        Area('House 1', [
            Area('H1 DefinedLoad',
                 strategy=DefinedLoadStrategy(daily_load_profile=profile_path,
                                              final_buying_rate=36),
                 appliance=SwitchableAppliance()),
        ]),
        Area('Commercial Energy Producer',
             strategy=CommercialStrategy(),
             appliance=SimpleAppliance()),
    ],
                config=config)
    return area
Exemplo n.º 9
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)
Exemplo n.º 10
0
def get_setup(config):
    area = Area(
        'Grid',
        [
            Area(
                'House 1',
                [
                    Area('H1 General Load',
                         strategy=DefinedLoadStrategy(
                             daily_load_profile=os.path.join(d3a_path,
                                                             'resources', 'LOAD_DATA_1.csv'),
                             final_buying_rate=25),
                         ),
                    Area('H1 Storage1', strategy=StorageStrategy(initial_soc=50)
                         ),
                    Area('H1 Storage2', strategy=StorageStrategy(initial_soc=50)
                         ),
                ]
            ),
            Area(
                'House 2',
                [
                    Area('H2 General Load', strategy=LoadHoursStrategy(avg_power_W=200,
                                                                       hrs_per_day=4,
                                                                       hrs_of_day=list(
                                                                           range(12, 16)),
                                                                       final_buying_rate=35)
                         ),
                    Area('H2 PV', strategy=PVPredefinedStrategy(90, 5, cloud_coverage=0),
                         ),

                ]
            ),
            Area('Cell Tower', strategy=LoadHoursStrategy(avg_power_W=100,
                                                          hrs_per_day=24,
                                                          hrs_of_day=list(range(0, 24)),
                                                          final_buying_rate=35)
                 )
            # Area('Commercial Energy Producer',
            #      strategy=CommercialStrategy(energy_range_wh=(40, 120), energy_price=30)
            #      ),
        ],
        config=config
    )
    return area
Exemplo n.º 11
0
def get_setup(config):
    area = Area(
        'Grid',
        [
            Area('House 1', [
                Area('H1 General Load',
                     strategy=DefinedLoadStrategy(
                         daily_load_profile=os.path.join(
                             d3a_path, 'resources', 'LOAD_DATA_1.csv'),
                         max_energy_rate=35),
                     appliance=SwitchableAppliance()),
                Area('H1 Storage1',
                     strategy=StorageStrategy(initial_capacity_kWh=0.4),
                     appliance=SwitchableAppliance()),
            ]),
            Area('House 2', [
                Area('H2 General Load',
                     strategy=LoadHoursStrategy(avg_power_W=200,
                                                hrs_per_day=1,
                                                hrs_of_day=list(range(15, 16)),
                                                max_energy_rate=35),
                     appliance=SwitchableAppliance()),
                Area('H2 PV',
                     strategy=PVStrategy(2, 80),
                     appliance=PVAppliance()),
            ]),
            # Area('Cell Tower', strategy=CellTowerLoadHoursStrategy(avg_power_W=100,
            #                                                hrs_per_day=24,
            #                                               hrs_of_day=list(range(0, 24)),
            #                                             max_energy_rate=35),
            #  appliance=SwitchableAppliance())
            # Area('Commercial Energy Producer',
            #      strategy=CommercialStrategy(energy_range_wh=(40, 120), energy_price=30),
            #      appliance=SimpleAppliance()
            #      ),
        ],
        config=config)
    return area
Exemplo n.º 12
0
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
Exemplo n.º 13
0
def get_setup(config):
    config_file = "SAM_MF2_Summer_constant_6kw.csv"
    area = Area('Grid', [
        Area('House 1', [
            Area('H1 PV', strategy=PVStrategy(60, 80),
                 appliance=PVAppliance()),
            Area('H1 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=12 * 1.2,
                                          max_abs_battery_power_kW=12 * 1.2,
                                          initial_capacity_kWh=0.6 * 12 * 1.2),
                 appliance=SwitchableAppliance()),
            Area('H1 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 2', [
            Area('H2 PV', strategy=PVStrategy(30, 80),
                 appliance=PVAppliance()),
            Area('H2 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=6 * 1.2,
                                          max_abs_battery_power_kW=6 * 1.2,
                                          initial_capacity_kWh=0.6 * 6 * 1.2),
                 appliance=SwitchableAppliance()),
            Area('H2 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 3', [
            Area('H3 PV', strategy=PVStrategy(60, 80),
                 appliance=PVAppliance()),
            Area('H3 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 4', [
            Area('H4 PV', strategy=PVStrategy(30, 80),
                 appliance=PVAppliance()),
            Area('H4 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 5', [
            Area('H5 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=12 * 1.2,
                                          max_abs_battery_power_kW=12 * 1.2,
                                          initial_capacity_kWh=0.6 * 12 * 1.2),
                 appliance=SwitchableAppliance()),
            Area('H5 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 6', [
            Area('H6 Storage1',
                 strategy=StorageStrategy(battery_capacity_kWh=6 * 1.2,
                                          max_abs_battery_power_kW=6 * 1.2,
                                          initial_capacity_kWh=0.6 * 6 * 1.2),
                 appliance=SwitchableAppliance()),
            Area('H6 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 7', [
            Area('H7 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
        Area('House 8', [
            Area('H8 General Load',
                 strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                     d3a_path, 'resources', config_file),
                                              max_energy_rate=35),
                 appliance=SwitchableAppliance()),
        ]),
    ],
                config=config)
    return area
Exemplo n.º 14
0
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
Exemplo n.º 15
0
def get_setup(config):

    area = Area('Grid', [
        Area('House 1', [
            Area(
                'H1 PV',
                strategy=PVStrategy(60, 80),
            ),
            Area(
                'H1 Storage1',
                strategy=StorageStrategy(battery_capacity_kWh=12 * 1.2,
                                         max_abs_battery_power_kW=12 * 1.2,
                                         initial_soc=60),
            ),
            Area(
                'H1 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 2', [
            Area(
                'H2 PV',
                strategy=PVStrategy(30, 80),
            ),
            Area(
                'H2 Storage1',
                strategy=StorageStrategy(battery_capacity_kWh=6 * 1.2,
                                         max_abs_battery_power_kW=6 * 1.2,
                                         initial_soc=60),
            ),
            Area(
                'H2 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_SF_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 3', [
            Area(
                'H3 PV',
                strategy=PVStrategy(60, 80),
            ),
            Area(
                'H3 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 4', [
            Area(
                'H4 PV',
                strategy=PVStrategy(30, 80),
            ),
            Area(
                'H4 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_SF_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 5', [
            Area(
                'H5 Storage1',
                strategy=StorageStrategy(battery_capacity_kWh=12 * 1.2,
                                         max_abs_battery_power_kW=12 * 1.2,
                                         initial_soc=60),
            ),
            Area(
                'H5 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 6', [
            Area(
                'H6 Storage1',
                strategy=StorageStrategy(battery_capacity_kWh=6 * 1.2,
                                         max_abs_battery_power_kW=6 * 1.2,
                                         initial_soc=60),
            ),
            Area(
                'H6 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_SF_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 7', [
            Area(
                'H7 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_MF2_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
        Area('House 8', [
            Area(
                'H8 General Load',
                strategy=DefinedLoadStrategy(daily_load_profile=os.path.join(
                    d3a_path, 'resources', 'SAM_SF_Summer.csv'),
                                             final_buying_rate=35),
            ),
        ]),
    ],
                config=config)
    return area
Exemplo n.º 16
0
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