Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix min capacity myopic #728

Merged
merged 5 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Upcoming Release

* For industry distribution, use EPRTR as fallback if ETS data is not available.

* The minimum capacity for renewable generators when using the myopic option has been fixed.

PyPSA-Eur 0.8.1 (27th July 2023)
================================

Expand Down
27 changes: 15 additions & 12 deletions scripts/solve_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def _add_land_use_constraint(n):
# warning: this will miss existing offwind which is not classed AC-DC and has carrier 'offwind'

for carrier in ["solar", "onwind", "offwind-ac", "offwind-dc"]:
extendable_i = (n.generators.carrier == carrier) & n.generators.p_nom_extendable
n.generators.loc[extendable_i, "p_nom_min"] = 0

ext_i = (n.generators.carrier == carrier) & ~n.generators.p_nom_extendable
existing = (
n.generators.loc[ext_i, "p_nom"]
Expand All @@ -60,18 +63,18 @@ def _add_land_use_constraint(n):
existing.index += " " + carrier + "-" + snakemake.wildcards.planning_horizons
n.generators.loc[existing.index, "p_nom_max"] -= existing

# check if existing capacities are larger than technical potential
existing_large = n.generators[
n.generators["p_nom_min"] > n.generators["p_nom_max"]
].index
if len(existing_large):
logger.warning(
f"Existing capacities larger than technical potential for {existing_large},\
adjust technical potential to existing capacities"
)
n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[
existing_large, "p_nom_min"
]
# # check if existing capacities are larger than technical potential
# existing_large = n.generators[
# n.generators["p_nom_min"] > n.generators["p_nom_max"]
# ].index
# if len(existing_large):
# logger.warning(
# f"Existing capacities larger than technical potential for {existing_large},\
# adjust technical potential to existing capacities"
# )
# n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[
# existing_large, "p_nom_min"
# ]

n.generators.p_nom_max.clip(lower=0, inplace=True)

Expand Down