Skip to content

Commit b88c8cc

Browse files
JN-TBW-EXlkstrp
andauthored
Add an extra pandas.sort_values() to get an deterministic result of ordered strongly meshed buses. (PyPSA#1174)
* Update common.py add an extra pandas.sort_values() to get an deterministic result of ordered strongly meshed buses. * Update release-notes.rst add entry in the release-notes.rst * Update doc/references/release-notes.rst --------- Co-authored-by: Lukas Trippe <[email protected]>
1 parent 582e53c commit b88c8cc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

doc/references/release-notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Features
2929
expression (regex), enabling more flexible filtering options.
3030
(https://github.com/PyPSA/PyPSA/pull/1155)
3131

32+
Minor improvements
33+
------------------
34+
35+
* Ensuring that the created lp/mps file is deterministic by sorting the strongly meshed buses. (https://github.com/PyPSA/PyPSA/pull/1174)
3236

3337
`v0.33.2 <https://github.com/PyPSA/PyPSA/releases/tag/v0.33.2>`__ (12th March 2025)
3438
=======================================================================================

pypsa/optimization/common.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@ def get_strongly_meshed_buses(n: Network, threshold: int = 45) -> pd.Series:
6666
)
6767
all_buses = all_buses[all_buses != ""]
6868
counts = all_buses.value_counts()
69-
return counts.index[counts > threshold].rename("Bus-meshed")
69+
results = counts.index[counts > threshold].rename("Bus-meshed")
70+
results = results.sort_values()
71+
return results

0 commit comments

Comments
 (0)