Add integer capacity extension#344
Conversation
updates: - [github.com/astral-sh/uv-pre-commit: 0.11.19 → 0.11.21](astral-sh/uv-pre-commit@0.11.19...0.11.21) - [github.com/astral-sh/ruff-pre-commit: v0.15.16 → v0.15.17](astral-sh/ruff-pre-commit@v0.15.16...v0.15.17)
updates: - [github.com/astral-sh/uv-pre-commit: 0.11.21 → 0.11.23](astral-sh/uv-pre-commit@0.11.21...0.11.23) - [github.com/astral-sh/ruff-pre-commit: v0.15.17 → v0.15.18](astral-sh/ruff-pre-commit@v0.15.17...v0.15.18)
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
…counting purposes Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
…ly retirement, and growth rate constraints all together Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
…capacities Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
Signed-off-by: Davey Elder <iandavidelder@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (71)
WalkthroughIntroduces a pluggable ChangesExtension Framework and Bundled Extensions
Myopic Capacity Retirement Adjustments
Dependency and Tooling Updates
Sequence DiagramsequenceDiagram
participant User
participant TemoaConfig
participant framework as extensions/framework.py
participant HybridLoader
participant TemoaModel
participant SQLite
User->>TemoaConfig: extensions=["growth_rates"]
TemoaConfig->>framework: normalize_extension_ids(["growth_rates"])
TemoaConfig->>framework: resolve_extension_specs(ids)
framework-->>TemoaConfig: tuple[ExtensionSpec]
User->>HybridLoader: __init__(config)
HybridLoader->>framework: resolve_extension_specs(config.extensions)
HybridLoader->>TemoaModel: TemoaModel(extensions=config.extensions)
TemoaModel->>framework: apply_model_extension_hooks(self, specs)
note over TemoaModel: growth_rates Params, Sets, Constraints attached
HybridLoader->>framework: merge_regional_group_tables(base, specs)
HybridLoader->>framework: ensure_enabled_extension_tables_exist(con, specs)
framework->>SQLite: _table_exists / _append_extension_schema
HybridLoader->>framework: assert_disabled_extension_tables_are_empty(con, all_specs)
HybridLoader->>HybridLoader: build_manifest(model, extension_ids=config.extensions)
framework-->>HybridLoader: manifest with extension LoadItems appended
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
NOTE currently based on top of PR #343. This is also different from but compatible with a future unit commitment extension, except that unit commitment divides capacity within a technology into subunits (e.g., gas turbines are each divided into 100 MW sub units) whereas this applies integer capacity units at the technology or tech-group/region summation level, for things like chunky investment/retirement.
Integer Capacity
The integer_capacity extension adds optional constraints that force the
capacity of a technology or technology group to be deployed in discrete,
indivisible units rather than as a continuous quantity. This is useful for
modeling lumpy investments or retirements such as a power plant, reactor, or
other facility that can only exist in whole units of a fixed size.
Enabling the extension introduces integer decision variables, which turns the
model into a mixed-integer program (MIP). It is disabled by default and enabled
per run through configuration:
extensions = ["integer_capacity"]Its parameters live in the extension-owned tables of the same name and are loaded
only when the extension is enabled. See :ref:
extensionsfor how the extensionframework wires these components into the model.
Parameters
Decision Variables
Enabling the extension adds two integer decision variables, one per constraint.
Each counts the number of discrete units, which is multiplied by the
corresponding unit size to recover the capacity quantity.
Constraints
Summary by CodeRabbit
New Features
Bug Fixes
Documentation