From 9ea05d625e2f3c6617bddb5de73ca305a00f670d Mon Sep 17 00:00:00 2001 From: Nick Harder Date: Wed, 20 Nov 2024 14:03:06 +0100 Subject: [PATCH] -remove index from unit initialization -clean up index everywhere --- assume/common/base.py | 25 +++++++++------------- assume/scenario/loader_amiris.py | 21 +++++++++--------- assume/scenario/loader_csv.py | 3 --- assume/scenario/loader_oeds.py | 1 - assume/scenario/loader_pypsa.py | 1 - assume/units/demand.py | 7 +++--- assume/units/powerplant.py | 5 +++-- assume/units/steel_plant.py | 5 +++-- assume/units/storage.py | 9 ++++---- assume/world.py | 4 ---- examples/world_script.py | 1 - examples/world_script_policy.py | 1 - tests/conftest.py | 14 +++++++----- tests/test_advanced_order_strategy.py | 1 - tests/test_demand.py | 2 -- tests/test_dmas_powerplant.py | 2 -- tests/test_dmas_storage.py | 7 +++--- tests/test_drl_storage_strategy.py | 1 - tests/test_flexable_storage_strategies.py | 6 +++--- tests/test_policies.py | 2 +- tests/test_storage.py | 7 +++--- tests/test_units.py | 26 +++++++++++++++-------- tests/test_units_operator.py | 6 +++--- 23 files changed, 76 insertions(+), 81 deletions(-) diff --git a/assume/common/base.py b/assume/common/base.py index ee8981bbd..017e91adc 100644 --- a/assume/common/base.py +++ b/assume/common/base.py @@ -51,27 +51,24 @@ def __init__( unit_operator: str, technology: str, bidding_strategies: dict[str, BaseStrategy], - index: pd.DatetimeIndex, + forecaster: Forecaster, node: str = "node0", - forecaster: Forecaster = None, location: tuple[float, float] = (0.0, 0.0), **kwargs, ): self.id = id self.unit_operator = unit_operator self.technology = technology + self.bidding_strategies: dict[str, BaseStrategy] = bidding_strategies + self.forecaster = forecaster + self.index = forecaster.index + self.node = node self.location = location - self.bidding_strategies: dict[str, BaseStrategy] = bidding_strategies - self.index = index + self.outputs = defaultdict(lambda: FastSeries(value=0.0, index=self.index)) # series does not like to convert from tensor to float otherwise - # RL data stored as lists to simplify storing to the buffer - self.outputs["rl_observations"] = [] - self.outputs["rl_actions"] = [] - self.outputs["rl_rewards"] = [] - # some data is stored as series to allow to store it in the outputs # check if any bidding strategy is using the RL strategy if any( @@ -85,12 +82,10 @@ def __init__( ) self.outputs["reward"] = FastSeries(value=0.0, index=self.index) - if forecaster: - self.forecaster = forecaster - else: - self.forecaster = defaultdict( - lambda: FastSeries(value=0.0, index=self.index) - ) + # RL data stored as lists to simplify storing to the buffer + self.outputs["rl_observations"] = [] + self.outputs["rl_actions"] = [] + self.outputs["rl_rewards"] = [] def calculate_bids( self, diff --git a/assume/scenario/loader_amiris.py b/assume/scenario/loader_amiris.py index 535d9e97a..7c3b2246b 100644 --- a/assume/scenario/loader_amiris.py +++ b/assume/scenario/loader_amiris.py @@ -135,6 +135,7 @@ def add_agent_to_world( base_path: str, markups: dict = {}, supports: dict = {}, + index: pd.DatetimeIndex = None, ): """ Adds an agent from a amiris agent definition to the ASSUME world. @@ -175,7 +176,7 @@ def add_agent_to_world( "technology": "demand", "price": value, }, - NaiveForecast(world.index, demand=100000), + NaiveForecast(index, demand=100000), ) case "EnergyExchange" | "DayAheadMarketSingleZone": clearing_section = agent["Attributes"].get("Clearing", agent["Attributes"]) @@ -223,7 +224,7 @@ def add_agent_to_world( co2_price = agent["Attributes"]["Co2Prices"] if isinstance(co2_price, str): price_series = read_csv(base_path, co2_price) - co2_price = price_series.reindex(world.index).ffill().fillna(0) + co2_price = price_series.reindex(index).ffill().fillna(0) prices["co2"] = co2_price case "FuelsMarket": # fill prices for forecaster @@ -235,7 +236,7 @@ def add_agent_to_world( price_series.index = price_series.index.round("h") if not price_series.index.is_unique: price_series = price_series.groupby(level=0).last() - price = price_series.reindex(world.index).ffill() + price = price_series.reindex(index).ffill() prices[fuel_type] = price * fuel["ConversionFactor"] case "DemandTrader": world.add_unit_operator(agent["Id"]) @@ -253,7 +254,7 @@ def add_agent_to_world( "technology": "demand", "price": load["ValueOfLostLoad"], }, - NaiveForecast(world.index, demand=demand_series), + NaiveForecast(index, demand=demand_series), ) case "StorageTrader": @@ -270,7 +271,7 @@ def add_agent_to_world( forecast_price = prices.get("co2", 20) # TODO forecast should be calculated using calculate_EOM_price_forecast forecast = NaiveForecast( - world.index, + index, availability=1, co2_price=prices.get("co2", 2), # price_forecast is used for price_EOM @@ -336,11 +337,11 @@ def add_agent_to_world( availability = prototype["PlannedAvailability"] if isinstance(availability, str): availability = read_csv(base_path, availability) - availability = availability.reindex(world.index).ffill() + availability = availability.reindex(index).ffill() availability *= prototype.get("UnplannedAvailabilityFactor", 1) forecast = NaiveForecast( - world.index, + index, availability=availability, fuel_price=fuel_price, co2_price=prices.get("co2", 2), @@ -387,7 +388,7 @@ def add_agent_to_world( max_power = attr["InstalledPowerInMW"] if isinstance(availability, str): dispatch_profile = read_csv(base_path, availability) - availability = dispatch_profile.reindex(world.index).ffill().fillna(0) + availability = dispatch_profile.reindex(index).ffill().fillna(0) if availability.max() > 1: scale_value = availability.max() @@ -398,7 +399,7 @@ def add_agent_to_world( fuel_price = prices.get(translate_fuel_type[attr["EnergyCarrier"]], 0) fuel_price += attr.get("OpexVarInEURperMWH", 0) forecast = NaiveForecast( - world.index, + index, availability=availability, fuel_price=fuel_price, co2_price=prices.get("co2", 0), @@ -488,7 +489,6 @@ def load_amiris( end=end, save_frequency_hours=save_interval, simulation_id=sim_id, - index=index, ) # helper dict to map trader markups/markdowns to powerplants markups = {} @@ -523,6 +523,7 @@ def load_amiris( base_path, markups, supports, + index, ) # calculate market price before simulation world diff --git a/assume/scenario/loader_csv.py b/assume/scenario/loader_csv.py index bd60c9e77..19dffd186 100644 --- a/assume/scenario/loader_csv.py +++ b/assume/scenario/loader_csv.py @@ -522,7 +522,6 @@ def load_config_and_create_forecaster( "path": path, "start": start, "end": end, - "index": forecaster.index, "powerplant_units": powerplant_units, "storage_units": storage_units, "demand_units": demand_units, @@ -565,7 +564,6 @@ def setup_world( config = scenario_data["config"] start = scenario_data["start"] end = scenario_data["end"] - index = scenario_data["index"] powerplant_units = scenario_data["powerplant_units"] storage_units = scenario_data["storage_units"] demand_units = scenario_data["demand_units"] @@ -627,7 +625,6 @@ def setup_world( simulation_id=sim_id, learning_config=learning_config, bidding_params=bidding_strategy_params, - index=index, forecaster=forecaster, ) diff --git a/assume/scenario/loader_oeds.py b/assume/scenario/loader_oeds.py index 03de25f1b..5cecd78a9 100644 --- a/assume/scenario/loader_oeds.py +++ b/assume/scenario/loader_oeds.py @@ -61,7 +61,6 @@ def load_oeds( end=end, save_frequency_hours=48, simulation_id=sim_id, - index=index, ) # setup eom market diff --git a/assume/scenario/loader_pypsa.py b/assume/scenario/loader_pypsa.py index 8fc6e5e74..d5bec3230 100644 --- a/assume/scenario/loader_pypsa.py +++ b/assume/scenario/loader_pypsa.py @@ -49,7 +49,6 @@ def load_pypsa( end=end, save_frequency_hours=save_frequency_hours, simulation_id=sim_id, - index=index, ) # setup eom market diff --git a/assume/units/demand.py b/assume/units/demand.py index 8a2c4671d..189876752 100644 --- a/assume/units/demand.py +++ b/assume/units/demand.py @@ -8,6 +8,7 @@ from assume.common.base import SupportsMinMax from assume.common.fast_pandas import FastSeries +from assume.common.forecasts import Forecaster class Demand(SupportsMinMax): @@ -36,9 +37,9 @@ def __init__( unit_operator: str, technology: str, bidding_strategies: dict, - index: pd.DatetimeIndex, max_power: float, min_power: float, + forecaster: Forecaster, node: str = "node0", price: float | pd.Series = 3000.0, location: tuple[float, float] = (0.0, 0.0), @@ -49,7 +50,7 @@ def __init__( unit_operator=unit_operator, technology=technology, bidding_strategies=bidding_strategies, - index=index, + forecaster=forecaster, node=node, location=location, **kwargs, @@ -65,7 +66,7 @@ def __init__( volume = self.forecaster[self.id] self.volume = -volume # demand is negative if isinstance(price, numbers.Real): - price = FastSeries(index=index, value=price) + price = FastSeries(index=self.index, value=price) self.price = price def execute_current_dispatch( diff --git a/assume/units/powerplant.py b/assume/units/powerplant.py index bf84f7e66..24b2efe14 100644 --- a/assume/units/powerplant.py +++ b/assume/units/powerplant.py @@ -9,6 +9,7 @@ import pandas as pd from assume.common.base import SupportsMinMax +from assume.common.forecasts import Forecaster from assume.common.market_objects import MarketConfig, Orderbook from assume.common.utils import get_products_index @@ -54,7 +55,7 @@ def __init__( unit_operator: str, technology: str, bidding_strategies: dict, - index: pd.DatetimeIndex, + forecaster: Forecaster, max_power: float, min_power: float = 0.0, efficiency: float = 1.0, @@ -82,7 +83,7 @@ def __init__( unit_operator=unit_operator, technology=technology, bidding_strategies=bidding_strategies, - index=index, + forecaster=forecaster, node=node, location=location, **kwargs, diff --git a/assume/units/steel_plant.py b/assume/units/steel_plant.py index 2dcfa06c3..52391334d 100644 --- a/assume/units/steel_plant.py +++ b/assume/units/steel_plant.py @@ -14,6 +14,7 @@ ) from assume.common.base import SupportsMinMax +from assume.common.forecasts import Forecaster from assume.common.market_objects import MarketConfig, Orderbook from assume.common.utils import get_products_index from assume.units.dsm_load_shift import DSMFlex @@ -53,9 +54,9 @@ def __init__( id: str, unit_operator: str, bidding_strategies: dict, + forecaster: Forecaster, technology: str = "steel_plant", node: str = "node0", - index: pd.DatetimeIndex = None, location: tuple[float, float] = (0.0, 0.0), components: dict[str, dict] = None, objective: str = None, @@ -70,7 +71,7 @@ def __init__( technology=technology, components=components, bidding_strategies=bidding_strategies, - index=index, + forecaster=forecaster, node=node, location=location, **kwargs, diff --git a/assume/units/storage.py b/assume/units/storage.py index d29aaeeb5..2531fc044 100644 --- a/assume/units/storage.py +++ b/assume/units/storage.py @@ -11,6 +11,7 @@ from assume.common.base import SupportsMinMaxCharge from assume.common.fast_pandas import FastSeries +from assume.common.forecasts import Forecaster from assume.common.market_objects import MarketConfig, Orderbook from assume.common.utils import get_products_index @@ -59,6 +60,7 @@ def __init__( unit_operator: str, technology: str, bidding_strategies: dict, + forecaster: Forecaster, max_power_charge: float | pd.Series, max_power_discharge: float | pd.Series, max_soc: float, @@ -82,19 +84,18 @@ def __init__( min_down_time: float = 0, downtime_hot_start: int = 8, # hours downtime_warm_start: int = 48, # hours - index: pd.DatetimeIndex = None, location: tuple[float, float] = (0, 0), node: str = "node0", **kwargs, ): super().__init__( id=id, + unit_operator=unit_operator, technology=technology, + bidding_strategies=bidding_strategies, + forecaster=forecaster, node=node, location=location, - bidding_strategies=bidding_strategies, - index=index, - unit_operator=unit_operator, **kwargs, ) diff --git a/assume/world.py b/assume/world.py index 797f5e3f4..2597ebcad 100644 --- a/assume/world.py +++ b/assume/world.py @@ -9,7 +9,6 @@ from datetime import datetime from pathlib import Path -import pandas as pd from mango import ( RoleAgent, activate, @@ -157,7 +156,6 @@ def setup( start: datetime, end: datetime, simulation_id: str, - index: pd.Series, save_frequency_hours: int = 24, bidding_params: dict = {}, learning_config: LearningConfig = {}, @@ -195,7 +193,6 @@ def setup( self.forecaster = forecaster self.bidding_params = bidding_params - self.index = index # create new container container_kwargs = {} @@ -474,7 +471,6 @@ def create_unit( return unit_class( id=id, unit_operator=unit_operator_id, - index=self.index, forecaster=forecaster, **unit_params, ) diff --git a/examples/world_script.py b/examples/world_script.py index d7963d11d..9cddd34bb 100644 --- a/examples/world_script.py +++ b/examples/world_script.py @@ -30,7 +30,6 @@ def init(world, n=1): end=end, save_frequency_hours=48, simulation_id=sim_id, - index=index, ) marketdesign = [ diff --git a/examples/world_script_policy.py b/examples/world_script_policy.py index 2fe93fd77..b78f5c590 100644 --- a/examples/world_script_policy.py +++ b/examples/world_script_policy.py @@ -40,7 +40,6 @@ def init(world: World): end=end, save_frequency_hours=48, simulation_id=sim_id, - index=index, ) marketdesign = [ diff --git a/tests/conftest.py b/tests/conftest.py index 27b5f4544..34dc37965 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,7 +8,8 @@ import pytest from assume.common.base import SupportsMinMax -from assume.common.fast_pandas import FastIndex, FastSeries +from assume.common.fast_pandas import FastSeries +from assume.common.forecasts import NaiveForecast class MockMarketConfig: @@ -18,8 +19,8 @@ class MockMarketConfig: class MockMinMaxUnit(SupportsMinMax): - def __init__(self, index, **kwargs): - super().__init__("", "", "", {}, index, None, **kwargs) + def __init__(self, forecaster, **kwargs): + super().__init__("", "", "", {}, forecaster, None, **kwargs) self.max_power = 1000 self.min_power = 0 self.ramp_down = 200 @@ -43,5 +44,8 @@ def mock_market_config(): @pytest.fixture def mock_supports_minmax(): - index = FastIndex(start=datetime(2023, 7, 1), end=datetime(2023, 7, 2), freq="1h") - return MockMinMaxUnit(index) + index = pd.date_range( + start=datetime(2023, 7, 1), end=datetime(2023, 7, 2), freq="1h" + ) + forecaster = NaiveForecast(index, demand=150) + return MockMinMaxUnit(forecaster=forecaster) diff --git a/tests/test_advanced_order_strategy.py b/tests/test_advanced_order_strategy.py index 82388bf57..6378f95c5 100644 --- a/tests/test_advanced_order_strategy.py +++ b/tests/test_advanced_order_strategy.py @@ -27,7 +27,6 @@ def power_plant() -> PowerPlant: id="test_pp", unit_operator="test_operator", technology="coal", - index=ff.index, max_power=1000, min_power=200, efficiency=0.5, diff --git a/tests/test_demand.py b/tests/test_demand.py index 64709ef26..0032bf234 100644 --- a/tests/test_demand.py +++ b/tests/test_demand.py @@ -32,7 +32,6 @@ def test_demand(): unit_operator="UO1", technology="energy", bidding_strategies=strategies, - index=forecaster.index, max_power=150, min_power=0, forecaster=forecaster, @@ -88,7 +87,6 @@ def test_demand_series(): unit_operator="UO1", technology="energy", bidding_strategies=strategies, - index=forecaster.index, max_power=150, min_power=0, forecaster=forecaster, diff --git a/tests/test_dmas_powerplant.py b/tests/test_dmas_powerplant.py index 47f8d5b77..2def19b1f 100644 --- a/tests/test_dmas_powerplant.py +++ b/tests/test_dmas_powerplant.py @@ -33,7 +33,6 @@ def power_plant_1() -> PowerPlant: unit_operator="test_operator", technology="hard coal", bidding_strategies={"EOM": DmasPowerplantStrategy()}, - index=ff.index, max_power=1000, min_power=200, efficiency=0.5, @@ -63,7 +62,6 @@ def power_plant_day(fuel_type="lignite") -> PowerPlant: unit_operator="test_operator", technology="hard coal", bidding_strategies={"EOM": DmasPowerplantStrategy()}, - index=ff.index, max_power=1000, min_power=200, efficiency=0.5, diff --git a/tests/test_dmas_storage.py b/tests/test_dmas_storage.py index 9f64557b3..e4d08f988 100644 --- a/tests/test_dmas_storage.py +++ b/tests/test_dmas_storage.py @@ -8,7 +8,6 @@ import pytest from dateutil import rrule as rr -from assume.common.fast_pandas import FastIndex from assume.common.forecasts import NaiveForecast from assume.common.market_objects import MarketConfig, MarketProduct from assume.common.utils import get_available_products @@ -21,20 +20,21 @@ @pytest.fixture def storage_unit() -> Storage: - index = FastIndex(start="2022-01-01", periods=4, freq="1h") + index = pd.date_range("2022-01-01", periods=4, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) return Storage( id="Test_Storage", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={"EOM": NaiveSingleBidStrategy()}, + forecaster=forecaster, max_power_charge=100, max_power_discharge=100, max_soc=1000, initial_soc=500, efficiency_charge=0.9, efficiency_discharge=0.95, - index=index, ramp_down_charge=-50, ramp_down_discharge=50, ramp_up_charge=-60, @@ -67,7 +67,6 @@ def storage_day() -> Storage: initial_soc=500, efficiency_charge=0.9, efficiency_discharge=0.95, - index=ff.index, ramp_down_charge=-50, ramp_down_discharge=50, ramp_up_charge=-60, diff --git a/tests/test_drl_storage_strategy.py b/tests/test_drl_storage_strategy.py index b8fa78e86..53583fbb7 100644 --- a/tests/test_drl_storage_strategy.py +++ b/tests/test_drl_storage_strategy.py @@ -56,7 +56,6 @@ def storage_unit() -> Storage: efficiency_discharge=0.9, additional_cost_charge=5, additional_cost_discharge=5, - index=ff.index, forecaster=ff, ) diff --git a/tests/test_flexable_storage_strategies.py b/tests/test_flexable_storage_strategies.py index 19cf2a95a..85bb98f7e 100644 --- a/tests/test_flexable_storage_strategies.py +++ b/tests/test_flexable_storage_strategies.py @@ -9,7 +9,6 @@ import pandas as pd import pytest -from assume.common.fast_pandas import FastIndex from assume.common.forecasts import NaiveForecast from assume.strategies import ( flexableEOMStorage, @@ -22,19 +21,20 @@ @pytest.fixture def storage() -> Storage: # Create a PowerPlant instance with some example parameters - index = FastIndex(start=datetime(2023, 7, 1), periods=48, freq="1h") + index = pd.date_range("2023-07-01", periods=48, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) return Storage( id="Test_Storage", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={}, + forecaster=forecaster, max_power_charge=-100, max_power_discharge=100, max_soc=1000, initial_soc=500, efficiency_charge=0.9, efficiency_discharge=0.95, - index=index, ramp_down_charge=-50, ramp_down_discharge=50, ramp_up_charge=-60, diff --git a/tests/test_policies.py b/tests/test_policies.py index fde737453..62c3bd52d 100644 --- a/tests/test_policies.py +++ b/tests/test_policies.py @@ -85,7 +85,7 @@ async def test_request_messages(): "min_power": 0, "forecaster": NaiveForecast(index, demand=1000), } - unit = Demand("testdemand", index=index, **params_dict) + unit = Demand("testdemand", **params_dict) units_role.add_unit(unit) market_role = MarketRole(marketconfig) diff --git a/tests/test_storage.py b/tests/test_storage.py index 2c72180b9..9e930b472 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -8,7 +8,7 @@ import pandas as pd import pytest -from assume.common.fast_pandas import FastIndex +from assume.common.forecasts import NaiveForecast from assume.strategies.flexable_storage import flexableEOMStorage from assume.strategies.naive_strategies import NaiveSingleBidStrategy from assume.units import Storage @@ -16,18 +16,19 @@ @pytest.fixture def storage_unit() -> Storage: - index = FastIndex(start="2022-01-01", periods=4, freq="1h") + index = pd.date_range("2022-01-01", periods=4, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) return Storage( id="Test_Storage", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={"EOM": NaiveSingleBidStrategy()}, + forecaster=forecaster, max_power_charge=-100, max_power_discharge=100, max_soc=1000, efficiency_charge=0.9, efficiency_discharge=0.95, - index=index, ramp_down_charge=-50, ramp_down_discharge=50, ramp_up_charge=-60, diff --git a/tests/test_units.py b/tests/test_units.py index 4ed0a4d7e..5b951035c 100644 --- a/tests/test_units.py +++ b/tests/test_units.py @@ -4,19 +4,22 @@ from datetime import datetime +import pandas as pd + from assume.common.base import SupportsMinMax, SupportsMinMaxCharge -from assume.common.fast_pandas import FastIndex +from assume.common.forecasts import NaiveForecast def test_minmax(): - index = FastIndex(start="2022-01-01 00:00", periods=24, freq="h") + index = pd.date_range("2022-01-01", periods=24, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) mm = SupportsMinMax( id="Test", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={}, - index=index, + forecaster=forecaster, node="empty", ) @@ -113,14 +116,15 @@ def test_minmax(): def test_minmaxcharge(): - index = FastIndex(start="2022-01-01 00:00", periods=24, freq="h") + index = pd.date_range("2022-01-01", periods=24, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) mmc = SupportsMinMaxCharge( id="Test", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={}, - index=index, + forecaster=forecaster, node="empty", ) @@ -156,14 +160,15 @@ def test_minmaxcharge(): def test_minmaxcharge_unconstrained(): - index = FastIndex(start="2022-01-01 00:00", periods=24, freq="h") + index = pd.date_range("2022-01-01", periods=24, freq="h") + forecaster = NaiveForecast(index, availability=1, price_forecast=50) mmc = SupportsMinMaxCharge( id="Test", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={}, - index=index, + forecaster=forecaster, node="empty", ) @@ -191,14 +196,17 @@ def test_minmaxcharge_unconstrained(): def test_minmax_operationtime(): - index = FastIndex(start=datetime(2023, 7, 1), end=datetime(2023, 7, 2), freq="1h") + index = pd.date_range( + start=datetime(2023, 7, 1), end=datetime(2023, 7, 2), freq="1h" + ) + forecaster = NaiveForecast(index, availability=1, price_forecast=50) mm = SupportsMinMax( id="Test", unit_operator="TestOperator", technology="TestTechnology", bidding_strategies={}, - index=index, + forecaster=forecaster, node="empty", ) diff --git a/tests/test_units_operator.py b/tests/test_units_operator.py index 1bd965b96..0f939ec15 100644 --- a/tests/test_units_operator.py +++ b/tests/test_units_operator.py @@ -58,7 +58,7 @@ async def units_operator() -> UnitsOperator: "min_power": 0, "forecaster": NaiveForecast(index, demand=1000), } - unit = Demand("testdemand", index=index, **params_dict) + unit = Demand("testdemand", **params_dict) units_role.add_unit(unit) start_ts = datetime2timestamp(start) @@ -98,7 +98,7 @@ async def rl_units_operator() -> RLUnitsOperator: "min_power": 0, "forecaster": NaiveForecast(index, demand=1000), } - unit = Demand("testdemand", index=index, **params_dict) + unit = Demand("testdemand", **params_dict) units_role.add_unit(unit) start_ts = datetime2timestamp(start) @@ -184,7 +184,7 @@ async def test_write_learning_params(rl_units_operator: RLUnitsOperator): "min_power": 0, "forecaster": NaiveForecast(index, powerplant=1000), } - unit = PowerPlant("testplant", index=index, **params_dict) + unit = PowerPlant("testplant", **params_dict) rl_units_operator.add_unit(unit) rl_units_operator.learning_mode = True