2024-02-19 15:21:48 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2023-2024 The PyPSA-Eur Authors
|
2023-04-03 14:09:50 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
rule add_existing_baseyear:
|
2023-08-22 09:01:51 +00:00
|
|
|
params:
|
2024-02-10 17:09:23 +00:00
|
|
|
baseyear=config_provider("scenario", "planning_horizons", 0),
|
|
|
|
sector=config_provider("sector"),
|
|
|
|
existing_capacities=config_provider("existing_capacities"),
|
|
|
|
costs=config_provider("costs"),
|
2024-08-05 10:19:43 +00:00
|
|
|
heat_pump_sources=config_provider("sector", "heat_pump_sources"),
|
2024-09-11 13:06:32 +00:00
|
|
|
energy_totals_year=config_provider("energy", "energy_totals_year"),
|
2023-04-03 14:09:50 +00:00
|
|
|
input:
|
|
|
|
network=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "prenetworks/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
|
|
|
powerplants=resources("powerplants_s_{clusters}.csv"),
|
|
|
|
busmap_s=resources("busmap_base_s.csv"),
|
|
|
|
busmap=resources("busmap_base_s_{clusters}.csv"),
|
|
|
|
clustered_pop_layout=resources("pop_layout_base_s_{clusters}.csv"),
|
2024-02-17 16:55:35 +00:00
|
|
|
costs=lambda w: resources(
|
|
|
|
"costs_{}.csv".format(
|
2024-02-17 16:51:26 +00:00
|
|
|
config_provider("scenario", "planning_horizons", 0)(w)
|
2024-02-17 16:56:01 +00:00
|
|
|
)
|
2024-02-16 10:17:00 +00:00
|
|
|
),
|
2024-09-13 13:37:01 +00:00
|
|
|
cop_profiles=resources("cop_profiles_base_s_{clusters}.nc"),
|
2024-02-10 17:09:23 +00:00
|
|
|
existing_heating_distribution=resources(
|
2024-09-13 13:37:01 +00:00
|
|
|
"existing_heating_distribution_base_s_{clusters}_{planning_horizons}.csv"
|
2024-02-10 17:09:23 +00:00
|
|
|
),
|
2023-04-03 14:09:50 +00:00
|
|
|
existing_heating="data/existing_infrastructure/existing_heating_raw.csv",
|
2024-09-03 11:34:27 +00:00
|
|
|
heating_efficiencies=resources("heating_efficiencies.csv"),
|
2023-04-03 14:09:50 +00:00
|
|
|
output:
|
|
|
|
RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "prenetworks-brownfield/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
|
2023-04-03 14:09:50 +00:00
|
|
|
wildcard_constraints:
|
2024-02-17 22:36:46 +00:00
|
|
|
planning_horizons=config["scenario"]["planning_horizons"][0], #only applies to baseyear
|
2023-04-03 14:09:50 +00:00
|
|
|
threads: 1
|
|
|
|
resources:
|
2024-04-02 14:48:37 +00:00
|
|
|
mem_mb=config_provider("solving", "mem_mb"),
|
|
|
|
runtime=config_provider("solving", "runtime", default="24h"),
|
2023-04-03 14:09:50 +00:00
|
|
|
log:
|
2024-02-10 17:09:23 +00:00
|
|
|
logs(
|
2024-09-13 13:37:01 +00:00
|
|
|
"add_existing_baseyear_base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log"
|
2024-02-10 17:09:23 +00:00
|
|
|
),
|
2023-04-03 14:09:50 +00:00
|
|
|
benchmark:
|
2024-02-10 17:09:23 +00:00
|
|
|
benchmarks(
|
2024-09-13 13:37:01 +00:00
|
|
|
"add_existing_baseyear/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
|
2024-02-10 17:09:23 +00:00
|
|
|
)
|
2023-04-03 14:09:50 +00:00
|
|
|
conda:
|
|
|
|
"../envs/environment.yaml"
|
|
|
|
script:
|
|
|
|
"../scripts/add_existing_baseyear.py"
|
|
|
|
|
|
|
|
|
2024-02-12 15:56:00 +00:00
|
|
|
def input_network_year(w):
|
|
|
|
return {
|
|
|
|
f"network_{year}": RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "prenetworks/base_s_{clusters}_l{ll}_{opts}_{sector_opts}"
|
2024-02-17 22:36:46 +00:00
|
|
|
+ f"_{year}.nc"
|
2024-02-12 15:56:00 +00:00
|
|
|
for year in config_provider("scenario", "planning_horizons")(w)[1:]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-03 14:09:50 +00:00
|
|
|
rule prepare_perfect_foresight:
|
2024-02-17 10:57:16 +00:00
|
|
|
params:
|
2024-02-17 16:38:46 +00:00
|
|
|
costs=config_provider("costs"),
|
2024-02-17 22:36:46 +00:00
|
|
|
time_resolution=config_provider("clustering", "temporal", "sector"),
|
2023-04-03 14:09:50 +00:00
|
|
|
input:
|
2024-02-12 15:56:00 +00:00
|
|
|
unpack(input_network_year),
|
2023-04-03 14:09:50 +00:00
|
|
|
brownfield_network=lambda w: (
|
2023-04-03 15:39:47 +00:00
|
|
|
RESULTS
|
2023-04-05 08:41:21 +00:00
|
|
|
+ "prenetworks-brownfield/"
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "base_s_{clusters}_l{ll}_{opts}_{sector_opts}_"
|
2024-02-17 16:38:46 +00:00
|
|
|
+ "{}.nc".format(
|
|
|
|
str(config_provider("scenario", "planning_horizons", 0)(w))
|
2024-02-17 16:39:10 +00:00
|
|
|
)
|
2023-04-03 14:09:50 +00:00
|
|
|
),
|
|
|
|
output:
|
2023-04-03 15:39:47 +00:00
|
|
|
RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "prenetworks-brownfield/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc",
|
2023-04-03 14:09:50 +00:00
|
|
|
threads: 2
|
|
|
|
resources:
|
|
|
|
mem_mb=10000,
|
|
|
|
log:
|
2024-09-13 13:37:01 +00:00
|
|
|
logs("prepare_perfect_foresight_{clusters}_l{ll}_{opts}_{sector_opts}.log"),
|
2023-04-03 14:09:50 +00:00
|
|
|
benchmark:
|
2024-09-13 13:37:01 +00:00
|
|
|
benchmarks("prepare_perfect_foresight_{clusters}_l{ll}_{opts}_{sector_opts}")
|
2023-04-03 14:09:50 +00:00
|
|
|
conda:
|
|
|
|
"../envs/environment.yaml"
|
|
|
|
script:
|
|
|
|
"../scripts/prepare_perfect_foresight.py"
|
|
|
|
|
|
|
|
|
2023-04-03 15:39:47 +00:00
|
|
|
rule solve_sector_network_perfect:
|
2023-08-23 11:23:27 +00:00
|
|
|
params:
|
2024-02-10 17:09:23 +00:00
|
|
|
solving=config_provider("solving"),
|
|
|
|
foresight=config_provider("foresight"),
|
|
|
|
sector=config_provider("sector"),
|
|
|
|
planning_horizons=config_provider("scenario", "planning_horizons"),
|
|
|
|
co2_sequestration_potential=config_provider(
|
2024-02-17 22:36:46 +00:00
|
|
|
"sector", "co2_sequestration_potential", default=200
|
2024-02-10 17:09:23 +00:00
|
|
|
),
|
2024-01-04 08:00:31 +00:00
|
|
|
custom_extra_functionality=input_custom_extra_functionality,
|
2023-04-03 14:09:50 +00:00
|
|
|
input:
|
2023-04-03 15:39:47 +00:00
|
|
|
network=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "prenetworks-brownfield/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc",
|
2024-02-16 10:17:00 +00:00
|
|
|
costs=resources("costs_2030.csv"),
|
2023-04-03 14:09:50 +00:00
|
|
|
output:
|
2024-03-13 07:57:57 +00:00
|
|
|
network=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "postnetworks/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc",
|
2024-03-19 10:26:36 +00:00
|
|
|
config=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "configs/config.base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.yaml",
|
2024-01-22 08:28:51 +00:00
|
|
|
threads: solver_threads
|
2023-04-03 14:09:50 +00:00
|
|
|
resources:
|
2024-02-10 17:09:23 +00:00
|
|
|
mem_mb=config_provider("solving", "mem"),
|
2023-04-03 15:39:47 +00:00
|
|
|
shadow:
|
|
|
|
"shallow"
|
|
|
|
log:
|
|
|
|
solver=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "logs/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years_solver.log",
|
2023-04-03 15:39:47 +00:00
|
|
|
python=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "logs/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years_python.log",
|
2023-04-03 15:39:47 +00:00
|
|
|
memory=RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "logs/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years_memory.log",
|
2023-04-03 14:09:50 +00:00
|
|
|
benchmark:
|
2024-02-17 22:36:46 +00:00
|
|
|
(
|
|
|
|
RESULTS
|
2024-09-13 13:37:01 +00:00
|
|
|
+ "benchmarks/solve_sector_network/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years}"
|
2024-02-10 17:09:23 +00:00
|
|
|
)
|
2023-04-03 14:09:50 +00:00
|
|
|
conda:
|
|
|
|
"../envs/environment.yaml"
|
2023-04-03 15:39:47 +00:00
|
|
|
script:
|
|
|
|
"../scripts/solve_network.py"
|
2023-04-03 14:09:50 +00:00
|
|
|
|
|
|
|
|
2024-02-12 15:56:00 +00:00
|
|
|
def input_networks_make_summary_perfect(w):
|
|
|
|
return {
|
2024-09-13 13:37:01 +00:00
|
|
|
f"networks_s_{clusters}_l{ll}_{opts}_{sector_opts}": RESULTS
|
|
|
|
+ f"postnetworks/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc"
|
2024-02-12 15:56:00 +00:00
|
|
|
for clusters in config_provider("scenario", "clusters")(w)
|
|
|
|
for opts in config_provider("scenario", "opts")(w)
|
|
|
|
for sector_opts in config_provider("scenario", "sector_opts")(w)
|
|
|
|
for ll in config_provider("scenario", "ll")(w)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-03 14:09:50 +00:00
|
|
|
rule make_summary_perfect:
|
|
|
|
input:
|
2024-02-12 15:56:00 +00:00
|
|
|
unpack(input_networks_make_summary_perfect),
|
2024-02-16 10:17:00 +00:00
|
|
|
costs=resources("costs_2020.csv"),
|
2023-04-03 14:09:50 +00:00
|
|
|
output:
|
2023-04-05 08:41:21 +00:00
|
|
|
nodal_costs=RESULTS + "csvs/nodal_costs.csv",
|
|
|
|
nodal_capacities=RESULTS + "csvs/nodal_capacities.csv",
|
|
|
|
nodal_cfs=RESULTS + "csvs/nodal_cfs.csv",
|
|
|
|
cfs=RESULTS + "csvs/cfs.csv",
|
|
|
|
costs=RESULTS + "csvs/costs.csv",
|
|
|
|
capacities=RESULTS + "csvs/capacities.csv",
|
|
|
|
curtailment=RESULTS + "csvs/curtailment.csv",
|
|
|
|
energy=RESULTS + "csvs/energy.csv",
|
|
|
|
supply=RESULTS + "csvs/supply.csv",
|
|
|
|
supply_energy=RESULTS + "csvs/supply_energy.csv",
|
|
|
|
prices=RESULTS + "csvs/prices.csv",
|
|
|
|
weighted_prices=RESULTS + "csvs/weighted_prices.csv",
|
|
|
|
market_values=RESULTS + "csvs/market_values.csv",
|
|
|
|
price_statistics=RESULTS + "csvs/price_statistics.csv",
|
|
|
|
metrics=RESULTS + "csvs/metrics.csv",
|
|
|
|
co2_emissions=RESULTS + "csvs/co2_emissions.csv",
|
2023-04-03 14:09:50 +00:00
|
|
|
threads: 2
|
|
|
|
resources:
|
|
|
|
mem_mb=10000,
|
|
|
|
log:
|
2024-02-10 17:09:23 +00:00
|
|
|
logs("make_summary_perfect.log"),
|
2023-04-03 14:09:50 +00:00
|
|
|
benchmark:
|
2024-02-10 17:09:23 +00:00
|
|
|
benchmarks("make_summary_perfect")
|
2023-04-03 14:09:50 +00:00
|
|
|
conda:
|
|
|
|
"../envs/environment.yaml"
|
2023-04-03 15:39:47 +00:00
|
|
|
script:
|
|
|
|
"../scripts/make_summary_perfect.py"
|