diff --git a/assume/markets/clearing_algorithms/complex_clearing.py b/assume/markets/clearing_algorithms/complex_clearing.py index 808e8cba..9bad8a87 100644 --- a/assume/markets/clearing_algorithms/complex_clearing.py +++ b/assume/markets/clearing_algorithms/complex_clearing.py @@ -322,8 +322,8 @@ def extract_results( meta.append( { "supply_volume": supply_volume, - "demand_volume": demand_volume, - "demand_volume_energy": demand_volume * duration_hours, + "demand_volume": -demand_volume, + "demand_volume_energy": -demand_volume * duration_hours, "supply_volume_energy": supply_volume * duration_hours, "price": clear_price, "max_price": clear_price, diff --git a/assume/strategies/learning_strategies.py b/assume/strategies/learning_strategies.py index d1f52187..f32a0939 100644 --- a/assume/strategies/learning_strategies.py +++ b/assume/strategies/learning_strategies.py @@ -271,14 +271,15 @@ def create_observation( / scaling_factor_res_load ) - if end_excl + forecast_len > unit.forecaster["price_EOM"].index[-1]: + if end_excl + forecast_len > unit.forecaster["price_forecast"].index[-1]: scaled_price_forecast = ( - unit.forecaster["price_EOM"].loc[start:].values / scaling_factor_price + unit.forecaster["price_forecast"].loc[start:].values + / scaling_factor_price ) scaled_price_forecast = np.concatenate( [ scaled_price_forecast, - unit.forecaster["price_EOM"].iloc[ + unit.forecaster["price_forecast"].iloc[ : self.foresight - len(scaled_price_forecast) ], ] @@ -286,7 +287,9 @@ def create_observation( else: scaled_price_forecast = ( - unit.forecaster["price_EOM"].loc[start : end_excl + forecast_len].values + unit.forecaster["price_forecast"] + .loc[start : end_excl + forecast_len] + .values / scaling_factor_price ) diff --git a/tests/test_complex_market_mechanisms.py b/tests/test_complex_market_mechanisms.py index 6d417a25..0b58fc72 100644 --- a/tests/test_complex_market_mechanisms.py +++ b/tests/test_complex_market_mechanisms.py @@ -57,7 +57,7 @@ def test_complex_clearing(): accepted_orders, rejected_orders, meta = mr.clear(orderbook, products) assert math.isclose(meta[0]["supply_volume"], 1000, abs_tol=eps) - assert math.isclose(meta[0]["demand_volume"], -1000, abs_tol=eps) + assert math.isclose(meta[0]["demand_volume"], 1000, abs_tol=eps) assert math.isclose(meta[0]["price"], 100, abs_tol=eps) assert rejected_orders == [] assert accepted_orders[0]["agent_id"] == "dem1" diff --git a/tests/test_storage.py b/tests/test_storage.py index 216f6717..27a83f92 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -45,7 +45,6 @@ def test_init_function(storage_unit): assert storage_unit.ramp_up_charge == -60 assert storage_unit.ramp_up_discharge == 60 assert storage_unit.initial_soc == 0.5 - assert storage_unit.outputs["soc"][0] == 0.5 def test_reset_function(storage_unit):