Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/linemaxext-config' into import-t…
Browse files Browse the repository at this point in the history
…rial
  • Loading branch information
fneum committed May 12, 2023
2 parents 32d5101 + 3343394 commit 0f32abf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,14 @@ lines:
380.: "Al/St 240/40 4-bundle 380.0"
s_max_pu: 0.7
s_nom_max: .inf
max_extension: .inf
length_factor: 1.25
under_construction: 'zero' # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity

links:
p_max_pu: 1.0
p_nom_max: .inf
max_extension: .inf
include_tyndp: true
under_construction: 'zero' # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity

Expand Down
1 change: 1 addition & 0 deletions doc/configtables/lines.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
types,--,"Values should specify a `line type in PyPSA <https://pypsa.readthedocs.io/en/latest/components.html#line-types>`_. Keys should specify the corresponding voltage level (e.g. 220., 300. and 380. kV)","Specifies line types to assume for the different voltage levels of the ENTSO-E grid extraction. Should normally handle voltage levels 220, 300, and 380 kV"
s_max_pu,--,"Value in [0.,1.]","Correction factor for line capacities (``s_nom``) to approximate :math:`N-1` security and reserve capacity for reactive power flows"
s_nom_max,MW,"float","Global upper limit for the maximum capacity of each extendable line."
max_extension,MW,"float","Upper limit for the extended capacity of each extendable line."
length_factor,--,float,"Correction factor to account for the fact that buses are *not* connected by lines through air-line distance."
under_construction,--,"One of {'zero': set capacity to zero, 'remove': remove completely, 'keep': keep with full capacity}","Specifies how to handle lines which are currently under construction."
1 change: 1 addition & 0 deletions doc/configtables/links.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
,Unit,Values,Description
p_max_pu,--,"Value in [0.,1.]","Correction factor for link capacities ``p_nom``."
p_nom_max,MW,"float","Global upper limit for the maximum capacity of each extendable DC link."
max_extension,MW,"float","Upper limit for the extended capacity of each extendable DC link."
include_tyndp,bool,"{'true', 'false'}","Specifies whether to add HVDC link projects from the `TYNDP 2018 <https://tyndp.entsoe.eu/tyndp2018/projects/>`_ which are at least in permitting."
under_construction,--,"One of {'zero': set capacity to zero, 'remove': remove completely, 'keep': keep with full capacity}","Specifies how to handle lines which are currently under construction."
4 changes: 4 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Upcoming Release
e.g. by setting ``solving: options: transmission_losses: 2`` for an
approximation with two tangents.

* Added configuration option ``lines: max_extension:`` and ``links:
max_extension:``` to control the maximum capacity addition per line or link in
MW.

PyPSA-Eur 0.8.0 (18th March 2023)
=================================

Expand Down
23 changes: 20 additions & 3 deletions scripts/prepare_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,22 @@ def enforce_autarky(n, only_crossborder=False):
n.mremove("Link", links_rm)


def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):
def set_line_nom_max(
n,
s_nom_max_set=np.inf,
p_nom_max_set=np.inf,
s_nom_max_ext=np.inf,
p_nom_max_ext=np.inf,
):
if np.isfinite(s_nom_max_ext) and s_nom_max_ext > 0:
logger.info(f"Limiting line extensions to {s_nom_max_ext} MW")
n.lines["s_nom_max"] = n.lines["s_nom"] + s_nom_max_ext

if np.isfinite(p_nom_max_ext) and p_nom_max_ext > 0:
logger.info(f"Limiting line extensions to {p_nom_max_ext} MW")
hvdc = n.links.index[n.links.carrier == "DC"]
n.links.loc[hvdc, "p_nom_max"] = n.links.loc[hvdc, "p_nom"] + p_nom_max_ext

n.lines.s_nom_max.clip(upper=s_nom_max_set, inplace=True)
n.links.p_nom_max.clip(upper=p_nom_max_set, inplace=True)

Expand Down Expand Up @@ -330,8 +345,10 @@ def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):

set_line_nom_max(
n,
s_nom_max_set=snakemake.config["lines"].get("s_nom_max,", np.inf),
p_nom_max_set=snakemake.config["links"].get("p_nom_max,", np.inf),
s_nom_max_set=snakemake.config["lines"]["s_nom_max,"],
p_nom_max_set=snakemake.config["links"]["p_nom_max,"],
s_nom_max_ext=snakemake.config["lines"]["max_extension,"],
p_nom_max_ext=snakemake.config["links"]["max_extension,"],
)

if "ATK" in opts:
Expand Down
1 change: 0 additions & 1 deletion scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,6 @@ def maybe_adjust_costs_and_potentials(n, opts):
logger.info(f"changing {attr} for {carrier} by factor {factor}")


# TODO this should rather be a config no wildcard
def limit_individual_line_extension(n, maxext):
logger.info(f"Limiting new HVAC and HVDC extensions to {maxext} MW")
n.lines["s_nom_max"] = n.lines["s_nom"] + maxext
Expand Down

0 comments on commit 0f32abf

Please sign in to comment.