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

[DNMY] Remove pre- and post- prefixes in sector coupled networks #716

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions doc/foresight.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,21 @@ The myopic code solves the network for the time steps included in
baseyear=2020, capacities installed before 2020 are added. In addition, the
network comprises additional generator, storage, and link capacities with
p_nom_extendable=True. The non-solved network is saved in
``results/run_name/networks/prenetworks-brownfield``.
``resources/run_name/networks/networks-brownfield``.

The base year is the first element in ``planning_horizons``. Step 1 is
implemented with the rule add_baseyear for the base year and with the rule
add_brownfield for the remaining planning_horizons.

2. The 2020 network is optimized. The solved network is saved in
``results/run_name/networks/postnetworks``
``results/run_name/networks/networks``

3. For the next planning horizon, e.g. 2030, the capacities from a previous time
step are added if they are still in operation (i.e., if they fulfil planning
horizon <= commissioned year + lifetime). In addition, the network comprises
additional generator, storage, and link capacities with
p_nom_extendable=True. The non-solved network is saved in
``results/run_name/networks/prenetworks-brownfield``.
``resources/run_name/networks/networks-brownfield``.

Steps 2 and 3 are solved recursively for all the planning_horizons included in
``config/config.yaml``.
Expand Down Expand Up @@ -260,17 +260,17 @@ Rule overview
2045.

Then, the resulting network is saved in
``results/run_name/networks/prenetworks-brownfield``.
``resources/run_name/networks/networks-brownfield``.

- rule add_brownfield

The rule add_brownfield loads the network in
``results/run_name/networks/prenetworks`` and performs the following
``resources/run_name/networks/networks`` and performs the following
operation:

1. Read the capacities optimized in the previous time step and add them to the
network if they are still in operation (i.e., if they fulfill planning
horizon < commissioned year + lifetime)

Then, the resulting network is saved in
``results/run_name/networks/prenetworks_brownfield``.
``resources/run_name/networks/networks_brownfield``.
4 changes: 4 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Release Notes
Upcoming Release
================

* Networks that are stored in results/prenetworks are now stored in resources/networks.
Remove the prefix of post- and pre- in network names originating from PyPSA-Eur-Sec to match PyPSA-Eur conventions.
Brownfield networks are appended with the word _brownfield in their filename and placed in resources/networks.

* Updated Global Energy Monitor LNG terminal data to March 2023 version.

* For industry distribution, use EPRTR as fallback if ETS data is not available.
Expand Down
4 changes: 2 additions & 2 deletions rules/build_sector.smk
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,8 @@ rule prepare_sector_network:
if config["sector"]["solar_thermal"]
else [],
output:
RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
threads: 1
resources:
mem_mb=2000,
Expand Down
6 changes: 3 additions & 3 deletions rules/collect.smk
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ rule prepare_elec_networks:
rule prepare_sector_networks:
input:
expand(
RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"]
),

Expand All @@ -61,7 +61,7 @@ rule solve_sector_networks:
input:
expand(
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"]
),

Expand Down
2 changes: 1 addition & 1 deletion rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def solved_previous_horizon(wildcards):
planning_horizon_p = str(planning_horizons[i - 1])
return (
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_"
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_"
+ planning_horizon_p
+ ".nc"
)
4 changes: 2 additions & 2 deletions rules/postprocess.smk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rule plot_network:
plotting=config["plotting"],
input:
network=RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
regions=RESOURCES + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
output:
map=RESULTS
Expand Down Expand Up @@ -61,7 +61,7 @@ rule make_summary:
input:
networks=expand(
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
**config["scenario"]
),
costs="data/costs_{}.csv".format(config["costs"]["year"])
Expand Down
22 changes: 11 additions & 11 deletions rules/solve_myopic.smk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ rule add_existing_baseyear:
existing_capacities=config["existing_capacities"],
costs=config["costs"],
input:
network=RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network=RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
powerplants=RESOURCES + "powerplants.csv",
busmap_s=RESOURCES + "busmap_elec_s{simpl}.csv",
busmap=RESOURCES + "busmap_elec_s{simpl}_{clusters}.csv",
Expand All @@ -24,8 +24,8 @@ rule add_existing_baseyear:
existing_onwind="data/existing_infrastructure/onwind_capacity_IRENA.csv",
existing_offwind="data/existing_infrastructure/offwind_capacity_IRENA.csv",
output:
RESULTS
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_brownfield.nc",
wildcard_constraints:
planning_horizons=config["scenario"]["planning_horizons"][0], #only applies to baseyear
threads: 1
Expand All @@ -51,15 +51,15 @@ rule add_brownfield:
H2_retrofit_capacity_per_CH4=config["sector"]["H2_retrofit_capacity_per_CH4"],
threshold_capacity=config["existing_capacities"]["threshold_capacity"],
input:
network=RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network=RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network_p=solved_previous_horizon, #solved network at previous time step
costs="data/costs_{planning_horizons}.csv",
cop_soil_total=RESOURCES + "cop_soil_total_elec_s{simpl}_{clusters}.nc",
cop_air_total=RESOURCES + "cop_air_total_elec_s{simpl}_{clusters}.nc",
output:
RESULTS
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_brownfield.nc",
threads: 4
resources:
mem_mb=10000,
Expand Down Expand Up @@ -89,13 +89,13 @@ rule solve_sector_network_myopic:
"co2_sequestration_potential", 200
),
input:
network=RESULTS
+ "prenetworks-brownfield/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network=RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}_brownfield.nc",
costs="data/costs_{planning_horizons}.csv",
config=RESULTS + "config.yaml",
output:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
shadow:
"shallow"
log:
Expand Down
6 changes: 3 additions & 3 deletions rules/solve_overnight.smk
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ rule solve_sector_network:
"co2_sequestration_potential", 200
),
input:
network=RESULTS
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
network=RESOURCES
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
config=RESULTS + "config.yaml",
output:
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
+ "networks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
shadow:
"shallow"
log:
Expand Down
2 changes: 1 addition & 1 deletion scripts/make_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def to_csv(df):
networks_dict = {
(cluster, ll, opt + sector_opt, planning_horizon): "results/"
+ snakemake.params.RDIR
+ f"/postnetworks/elec_s{simpl}_{cluster}_l{ll}_{opt}_{sector_opt}_{planning_horizon}.nc"
+ f"/networks/elec_s{simpl}_{cluster}_l{ll}_{opt}_{sector_opt}_{planning_horizon}.nc"
for simpl in snakemake.params.scenario["simpl"]
for cluster in snakemake.params.scenario["clusters"]
for opt in snakemake.params.scenario["opts"]
Expand Down