Skip to content

Commit

Permalink
Merge branch 'features/#877_non_entendable_gas_links' in 'features/#779
Browse files Browse the repository at this point in the history
…-eGon100RE-gas-stores

'
  • Loading branch information
AmeliaNadal committed Sep 13, 2022
2 parents ab6cf7d + 25594a5 commit 607e442
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ Changed
`#817 <https://github.com/openego/eGon-data/issues/817>`_
* Integrate new data bundle using zenodo sandbox
`#866 <https://github.com/openego/eGon-data/issues/866>`_
* Set non extendable gas links from p-e-s as so for eGon100RE
`#877 <https://github.com/openego/eGon-data/issues/877>`_
* Add noflex scenario for motorized individual travel
`#821 <https://github.com/openego/eGon-data/issues/821>`_
* Parallelize sanity checks
Expand Down
Empty file.
127 changes: 105 additions & 22 deletions src/egon/data/datasets/pypsaeursec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,27 +672,87 @@ def lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE"):
lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE")
lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon2035")

# prepare and write neighboring crossborder links to etrago tables
def links_to_etrago(neighbor_links, scn="eGon100RE"):
def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True):
"""Prepare and write neighboring crossborder links to eTraGo table
This function prepare the neighboring crossborder links
generated the PyPSA-eur-sec (p-e-s) run by:
* Delete the useless columns
* If extendable is false only (non default case):
* Replace p_nom = 0 with the p_nom_op values (arrising
from the p-e-s optimisation)
* Setting p_nom_extendable to false
* Add geomtry to the links: 'geom' and 'topo' columns
* Change the name of the carriers to have the consistent in
eGon-data
The function insert then the link to the eTraGo table and has
no return.
Parameters
----------
neighbor_links : pandas.DataFrame
Dataframe containing the neighboring crossborder links
scn_name : str
Name of the scenario
extendable : bool
Boolean expressing if the links should be extendable or not
Returns
-------
None
"""
neighbor_links["scn_name"] = scn

for i in [
"name",
"geometry",
"tags",
"under_construction",
"underground",
"underwater_fraction",
"bus2",
"bus3",
"bus4",
"efficiency2",
"efficiency3",
"efficiency4",
"lifetime",
"p_nom_opt",
]:
neighbor_links = neighbor_links.drop(i, axis=1)
if extendable is True:
neighbor_links = neighbor_links.drop(
columns=[
"name",
"geometry",
"tags",
"under_construction",
"underground",
"underwater_fraction",
"bus2",
"bus3",
"bus4",
"efficiency2",
"efficiency3",
"efficiency4",
"lifetime",
"p_nom_opt",
"pipe_retrofit",
],
errors="ignore",
)

elif extendable is False:
neighbor_links = neighbor_links.drop(
columns=[
"name",
"geometry",
"tags",
"under_construction",
"underground",
"underwater_fraction",
"bus2",
"bus3",
"bus4",
"efficiency2",
"efficiency3",
"efficiency4",
"lifetime",
"p_nom",
"p_nom_extendable",
"pipe_retrofit",
],
errors="ignore",
)
neighbor_links = neighbor_links.rename(
columns={"p_nom_opt": "p_nom"}
)
neighbor_links["p_nom_extendable"] = False

# Define geometry and add to lines dataframe as 'topo'
gdf = gpd.GeoDataFrame(index=neighbor_links.index)
Expand All @@ -717,10 +777,8 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"):
"H2_Fuel_Cell": "H2_to_power",
"H2_pipeline_retrofitted": "H2_retrofit",
"SMR": "CH4_to_H2",
"SMR_CC": "CH4_to_H2_CC",
"Sabatier": "H2_to_CH4",
"gas_for_industry": "CH4_for_industry",
"gas_for_industry_CC": "CH4_for_industry_CC",
"gas_pipeline": "CH4",
},
inplace=True,
Expand All @@ -735,7 +793,32 @@ def links_to_etrago(neighbor_links, scn="eGon100RE"):
index_label="link_id",
)

links_to_etrago(neighbor_links, "eGon100RE")
non_extendable_links_carriers = [
"H2 pipeline retrofitted",
"gas pipeline",
"biogas to gas",
]

# delete unwanted carriers for eTraGo
excluded_carriers = ["gas for industry CC", "SMR CC"]
neighbor_links = neighbor_links[
~neighbor_links.carrier.isin(excluded_carriers)
]

links_to_etrago(
neighbor_links[
~neighbor_links.carrier.isin(non_extendable_links_carriers)
],
"eGon100RE",
)
links_to_etrago(
neighbor_links[
neighbor_links.carrier.isin(non_extendable_links_carriers)
],
"eGon100RE",
extendable=False,
)

links_to_etrago(neighbor_links[neighbor_links.carrier == "DC"], "eGon2035")

# prepare neighboring generators for etrago tables
Expand Down

0 comments on commit 607e442

Please sign in to comment.