Skip to content

Commit 48df884

Browse files
virio-andreyanasophiabrlpre-commit-ci[bot]ekatefyerbol-akhmetov
authored
Bugfix: Avoid creating duplicate conventional generators by setting keep_existing_capacities to false (pypsa-meets-earth#1630)
* Bugfix: Avoid creating duplicate conventional generators by setting to Co-authored-by: sophiabrl <sophialunor@gmail.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add relase_notes * minor fixes, using older syntax for PyPSA * bugfix in add_brownfield: remove assets if name already exist in the new network * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: sophiabrl <sophialunor@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ekaterina <e.v.kasilova@gmail.com> Co-authored-by: Yerbol Akhmetov <113768325+yerbol-akhmetov@users.noreply.github.com>
1 parent 7da3617 commit 48df884

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

config.default.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,11 +749,12 @@ sector:
749749

750750
conventional_generation: # generator : carrier
751751
OCGT: gas
752+
CCGT: gas
752753
oil: oil
753754
coal: coal
754755
lignite: lignite
755756
biomass: biomass
756-
keep_existing_capacities: true
757+
keep_existing_capacities: false
757758

758759
solving:
759760
options:

doc/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ This part of documentation collects descriptive release notes to capture the mai
4040

4141
**Minor Changes and bug-fixing**
4242

43+
* Avoid creating duplicate conventional generators by setting `keep_existing_capacities` to `false`. Convert CCGT as links in `prepare_sector_network` `PR #1630 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1630>`__
44+
4345
* Refine load shedding capacity calculation to use bus-specific maximum loads instead of fixed large values, improving solver performance and numeric stability. Rename load shedding generator carrier to 'load shedding' (now) instead of just 'load' (previously) `PR #1581 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1581>`__
4446

4547
* The configuration setting for ``focus_weights`` has been moved from ``focus_weights:`` to ``cluster_options: focus_weights:``. Backwards compatibility to old config files is maintained `PR #1565 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1565>`__

scripts/add_brownfield.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def add_brownfield(n, n_p, year):
7373
c.df[f"{attr}_nom"] = c.df[f"{attr}_nom_opt"]
7474
c.df[f"{attr}_nom_extendable"] = False
7575

76+
# remove assets if name already exist in the new network
77+
n_p.mremove(c.name, c.df.index.intersection(getattr(n, c.list_name).index))
78+
7679
n.import_components_from_dataframe(c.df, c.name)
7780

7881
# copy time-dependent

scripts/prepare_sector_network.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def add_generation(
112112
# Not required, because nodes are already defined in "nodes"
113113
# nodes = pop_layout.index
114114

115-
fallback = {"OCGT": "gas"}
115+
fallback = {"OCGT": "gas", "CCGT": "gas"}
116116
conventionals = options.get("conventional_generation", fallback)
117117

118118
for generator, carrier in conventionals.items():
@@ -157,6 +157,12 @@ def add_generation(
157157
lifetime=costs.at[generator, "lifetime"],
158158
)
159159

160+
# remove newly added links that have no capacity and are not extendable
161+
to_remove = n.links.query(
162+
"carrier == @carrier & p_nom == 0 & not p_nom_extendable"
163+
).index
164+
n.mremove("Link", to_remove)
165+
160166
# set the "co2_emissions" of the carrier to 0, as emissions are accounted by link efficiency separately (efficiency to 'co2 atmosphere' bus)
161167
n.carriers.loc[carrier, "co2_emissions"] = 0
162168

0 commit comments

Comments
 (0)