Skip to content

feat(planning): export commodity_costs in StorageScheduler outputs and persist in job meta (#2416) - #2448

Open
taran-dev4u wants to merge 1 commit into
FlexMeasures:mainfrom
taran-dev4u:feat/export-per-commodity-costs
Open

feat(planning): export commodity_costs in StorageScheduler outputs and persist in job meta (#2416)#2448
taran-dev4u wants to merge 1 commit into
FlexMeasures:mainfrom
taran-dev4u:feat/export-per-commodity-costs

Conversation

@taran-dev4u

Copy link
Copy Markdown
Contributor

Description

Resolves #2416.

Both optimization backends (linear_optimization.py and highspy_optimization.py) compute per-commodity costs (model.commodity_costs), but StorageScheduler previously only exported flat commitment_costs, and the scheduling service handler only persisted commitment_costs into Redis job metadata.

This PR:

  1. Emits a commodity_costs schedule output dictionary in StorageScheduler when multiple commodities are present or when the commodity is not solely the default electricity, matching the currency unit.
  2. Updates make_schedule() in flexmeasures/data/services/scheduling.py to persist rq_job.meta["scheduler_info"]["commodity_costs"] = result["data"].
  3. Adds dedicated unit test test_commodity_costs_output_filtering in test_commitments.py, and updates assertions in test_commitments.py, test_storage.py, and test_scheduling_jobs.py.
  4. Adds a changelog entry in documentation/changelog.rst.

Validation

  • Ran unit tests in flexmeasures/data/models/planning/tests/test_commitments.py, flexmeasures/data/models/planning/tests/test_storage.py, and flexmeasures/data/tests/test_scheduling_jobs.py (266 passed).
  • Flake8 checks passed with 0 errors.

…d persist in job meta (FlexMeasures#2416)

Signed-off-by: Taran Mamidala <mamidalataran6333@gmail.com>
@taran-dev4u
taran-dev4u force-pushed the feat/export-per-commodity-costs branch from 291edf6 to 8c4ec5e Compare August 31, 2026 10:09
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #34309510 | 📁 Comparing 8c4ec5e against latest (c33bc71)

  🔍 Preview build  

2 files changed
± changelog.html
± api/v3_0.html

@taran-dev4u
taran-dev4u marked this pull request as ready for review September 1, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler computes per-commodity costs but never exports them (job meta only gets flat commitment_costs)

1 participant