Skip to content

Commit

Permalink
Merge branch 'cost-calculation-corrections' of https://github.com/ass…
Browse files Browse the repository at this point in the history
…ume-framework/assume into cost-calculation-corrections
  • Loading branch information
Johanna Adams committed Sep 26, 2023
2 parents 7d0a4a1 + 5f87123 commit 0c05487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 4 additions & 7 deletions assume/strategies/learning_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,25 +271,22 @@ def create_observation(
/ scaling_factor_res_load
)

if end_excl + forecast_len > unit.forecaster["price_forecast"].index[-1]:
if end_excl + forecast_len > unit.forecaster["price_EOM"].index[-1]:
scaled_price_forecast = (
unit.forecaster["price_forecast"].loc[start:].values
/ scaling_factor_price
unit.forecaster["price_EOM"].loc[start:].values / scaling_factor_price
)
scaled_price_forecast = np.concatenate(
[
scaled_price_forecast,
unit.forecaster["price_forecast"].iloc[
unit.forecaster["price_EOM"].iloc[
: self.foresight - len(scaled_price_forecast)
],
]
)

else:
scaled_price_forecast = (
unit.forecaster["price_forecast"]
.loc[start : end_excl + forecast_len]
.values
unit.forecaster["price_EOM"].loc[start : end_excl + forecast_len].values
/ scaling_factor_price
)

Expand Down
2 changes: 2 additions & 0 deletions tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,14 @@ def test_execute_dispatch(storage_unit):
)
storage_unit.outputs["energy"][start] = 100
storage_unit.outputs["soc"][start] = 0.05
storage_unit.outputs["soc"][start] = 0.05
dispatched_energy = storage_unit.execute_current_dispatch(start, end)
assert math.isclose(
dispatched_energy.iloc[0], 50 * storage_unit.efficiency_discharge, abs_tol=0.1
)
storage_unit.outputs["energy"][start] = -100
storage_unit.outputs["soc"][start] = 0.95
storage_unit.outputs["soc"][start] = 0.95
dispatched_energy = storage_unit.execute_current_dispatch(start, end)
assert math.isclose(
dispatched_energy.iloc[0], -50 / storage_unit.efficiency_charge, abs_tol=0.1
Expand Down

0 comments on commit 0c05487

Please sign in to comment.