-
Notifications
You must be signed in to change notification settings - Fork 3
feat: H2 myopic compatibility #61
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,6 +33,7 @@ def add_brownfield( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_retrofit=False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_retrofit_capacity_per_ch4=None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
capacity_threshold=None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_topology_tyndp=False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add brownfield capacity from previous network. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -51,6 +52,8 @@ def add_brownfield( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ratio of hydrogen to methane capacity for pipeline retrofitting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
capacity_threshold : float | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Threshold for removing assets with low capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_topology_tyndp : bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Whether to TYNDP H2 topology is used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
logger.info(f"Preparing brownfield for the year {year}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -110,6 +113,36 @@ def add_brownfield( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for tattr in n.component_attrs[c.name].index[selection]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
n.import_series_from_dataframe(c.pnl[tattr], c.name, tattr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# adjust TYNDP H2 pipeline expansion by subtracting existing capacity from previous years from current year total capacity and potential | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if h2_topology_tyndp: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipelines_fixed_i = n.links[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(n.links.carrier == "H2 pipeline") & (n.links.build_year != year) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
].index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipelines = n.links[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(n.links.carrier == "H2 pipeline") & (n.links.build_year == year) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
].index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+118
to
+123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably too restrictive, given that the maximum capacity of the electrolysers is also specified in the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipe_capacity = n.links.loc[h2_pipelines, "p_nom"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipe_potential = n.links.loc[h2_pipelines, "p_nom_max"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
existing_capacity_p = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
n.links.loc[h2_pipelines_fixed_i, "p_nom_opt"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.rename(lambda x: x.split("-2")[0] + f"-{year}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.groupby(level=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
.sum() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remaining_capacity = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipe_capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- existing_capacity_p.reindex(index=h2_pipe_capacity.index).fillna(0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).clip(lower=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
remaining_potential = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_pipe_potential | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- existing_capacity_p.reindex(index=h2_pipe_capacity.index).fillna(0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
).clip( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lower=0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) # this should anyway never be negative. We will still clip to account for rounding errors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+133
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
n.links.loc[h2_pipelines, ["p_nom_min", "p_nom"]] = remaining_capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+127
to
+143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
n.links.loc[h2_pipelines, "p_nom_max"] = remaining_potential | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# deal with gas network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if h2_retrofit: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# subtract the already retrofitted from the maximum capacity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -367,6 +400,7 @@ def update_dynamic_ptes_capacity( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_retrofit=snakemake.params.H2_retrofit, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_retrofit_capacity_per_ch4=snakemake.params.H2_retrofit_capacity_per_CH4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
capacity_threshold=snakemake.params.threshold_capacity, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
h2_topology_tyndp=snakemake.params.h2_topology_tyndp, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
disable_grid_expansion_if_limit_hit(n) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.