Skip to content

Add v_storage_init variable for non-seasonal storage#275

Open
SutubraResearch wants to merge 2 commits intoTemoaProject:unstablefrom
SutubraResearch:pr/storage-init
Open

Add v_storage_init variable for non-seasonal storage#275
SutubraResearch wants to merge 2 commits intoTemoaProject:unstablefrom
SutubraResearch:pr/storage-init

Conversation

@SutubraResearch
Copy link
Collaborator

Summary

Rewrite storage energy balance from a circular formulation to an open-chain topology:

  • v_storage_init variable: Introduce a free variable that anchors the storage level at the start of each period. Rewrite storage_energy_constraint so each timeslice's storage level depends on the previous one starting from v_storage_init, rather than looping the last timeslice back to the first.
  • Last-timeslice tie-back: Add a constraint setting v_storage_level[d_last] equal to v_storage_init for non-seasonal storage, ensuring storage begins and ends each period at the same level.

The circular formulation created a dense dependency cycle in the constraint matrix that increased barrier factorization time. The open-chain topology provides equivalent results while improving solver performance on models with many storage technologies.

Files changed

File Change
temoa/components/storage.py New constraint functions, rewritten storage energy logic
temoa/core/model.py v_storage_init variable declaration, constraint wiring
tests/legacy_test_values.py Updated variable/constraint counts
tests/test_storage.py Updated storage unit tests

Test plan

  • All 190 tests pass
  • Storage results validated against mip-dev reference
  • Set cache JSON files regenerated
  • seasonal_storage test scenario passes with updated counts

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@SutubraResearch has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fb94d824-03f0-4edf-a100-a4098196d50a

📥 Commits

Reviewing files that changed from the base of the PR and between 7f7ff86 and d4c7cbf.

📒 Files selected for processing (7)
  • temoa/components/storage.py
  • temoa/core/model.py
  • tests/legacy_test_values.py
  • tests/test_storage.py
  • tests/testing_data/mediumville_sets.json
  • tests/testing_data/test_system_sets.json
  • tests/testing_data/utopia_sets.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Introduce a hub variable (v_storage_init) at the daily cycle wrap point
that replaces v_storage_level on the LHS at d_last. A tie-back constraint
(SL[d_last] = SI) keeps the formulation equivalent to a closed cycle.
Empirically this improved barrier solve time ~25% on a 16-region national
model, though the structural reason is not fully understood.
@SutubraResearch SutubraResearch changed the title Add v_storage_init for open-chain storage Add v_storage_init variable for non-seasonal storage Mar 12, 2026
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.

1 participant