Conversation
4 tasks
There was a problem hiding this comment.
Pull Request Overview
This pull request expands the operational expenditure calculation by incorporating all operational cost components (marginal, quadratic marginal, storage-related, spill, start-up, shut-down, and stand-by costs) into the n.statistics.opex() function with a new cost_types parameter.
- Expanded n.statistics.opex() to conditionally include a variety of cost components.
- Updated the function’s documentation and added comprehensive tests to verify new behaviors.
- Adjusted the optimization objective to correctly reference quadratic cost entries.
Reviewed Changes
Copilot reviewed 3 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/test_statistics.py | Added test_opex() to validate the operational expenditure calculations. |
| pypsa/statistics/expressions.py | Updated opex() to dynamically include various cost components based on cost_types. |
| pypsa/optimization/optimize.py | Modified the cost lookup loop to reference marginal_cost_quadratic for quadratic costs. |
Files not reviewed (4)
- doc/references/release-notes.rst: Language not supported
- pypsa/data/component_attrs/generators.csv: Language not supported
- pypsa/data/component_attrs/links.csv: Language not supported
- pypsa/data/variables.csv: Language not supported
lkstrp
approved these changes
Mar 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1185.
Changes proposed in this Pull Request
The function
n.statistics.opex()now includes all operational costcomponents: marginal costs, quadratic marginal costs, storage costs, spill
costs, start-up costs, shut-down costs, and stand-by costs. Previously, only
marginal costs were considered. A new parameter,
cost_types, allows for selecting which cost components to include.In this way,
n.statistics.opex() + n.statistics.capex()gives total system costs (all terms from objective function. See #1183.Checklist
doc.doc/release_notes.rstof the upcoming release is included.