Skip to content

Commit

Permalink
remove "price_EOM" from learning_strategies.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Johanna Adams committed Sep 26, 2023
1 parent c4389ea commit 05ff19e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions assume/markets/clearing_algorithms/complex_clearing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 7 additions & 4 deletions assume/strategies/learning_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,22 +271,25 @@ 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)
],
]
)

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
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_complex_market_mechanisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 05ff19e

Please sign in to comment.