Skip to content

Update opf.py for spillage variables#3

Merged
nworbmot merged 1 commit intoPyPSA:masterfrom
jdedecca:master
Mar 30, 2016
Merged

Update opf.py for spillage variables#3
nworbmot merged 1 commit intoPyPSA:masterfrom
jdedecca:master

Conversation

@jdedecca
Copy link
Copy Markdown
Contributor

Pyomo does not recognize the spill_index dictionary tuples, but does recognize it as a list instead.
Not passing it as a list results in the following error (example of storage unit 31, snapshot 0):

ERROR: Constructing component 'storage_p_spill_index' from data=None failed:
File "C:\Anaconda3\lib\site-packages\pypsa\opf.py", line 768, in network_lopf
ValueError: The value=('31', 0) is a tuple for set=storage_p_spill_index, which has dimen=1

@nworbmot nworbmot merged commit c8544ba into PyPSA:master Mar 30, 2016
@nworbmot
Copy link
Copy Markdown
Member

Hi, this was a Python 2 versus Python 3 issue (pyomo doesn't seem to deal with iterators gracefully) - thanks for the heads up and sorry for the Easter-related delay in pulling it. Ideally we need a unit test that uses the inflow/spillage so that we would have caught this.

@jdedecca
Copy link
Copy Markdown
Contributor Author

Glad to help! Indeed more test cases would be useful - I'll be using inflows regularly so may keep an eye out on it in future versions.

FabianHofmann added a commit that referenced this pull request Oct 16, 2025
- Add Network.unique_carriers property to collect all carriers from components
- Create Carriers.assign_colors() method for flexible color assignment
- Refactor add_missing_carriers() to use new assign_colors() method
- Simplify API: replace assign_colors/color_palette params with single palette param
- Update all tests to match new API (palette instead of assign_colors/color_palette)

Addresses review comments #1 and #3:
- Issue #1: Create separate assign_colors() method instead of parameters
- Issue #3: Add c.unique_carriers property similar to c.ports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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.

3 participants