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

Multi horizon #637

Merged
merged 77 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e5e7d5f
add rules for perfect foresight
lisazeyen Apr 3, 2023
00544ee
add lifetimes for perfect
lisazeyen Apr 3, 2023
952a6ba
add scripts for perfect foresight
lisazeyen Apr 3, 2023
247c504
adjust to new pypsa-eur syntax
lisazeyen Apr 3, 2023
57ef5cd
Merge remote-tracking branch 'origin' into perfect
lisazeyen Apr 5, 2023
d836970
always add load shedding with 1e2
lisazeyen Apr 5, 2023
b9c58db
remove slash
lisazeyen Apr 5, 2023
b50954a
remove snakemake from function
lisazeyen Apr 5, 2023
87135fd
remove more /
lisazeyen Apr 5, 2023
461ea66
add eea co2 emissions as input
lisazeyen Apr 5, 2023
f2ff8be
fix plot bugs
lisazeyen Apr 5, 2023
5989c28
adjust summary functions
lisazeyen Apr 5, 2023
f0d6d2b
add multi-deacde
lisazeyen Apr 5, 2023
c1cced4
add social discount rate
lisazeyen Apr 5, 2023
1a7e9c2
remove output capital cost
lisazeyen Apr 5, 2023
91d2a4a
adjust plotting
lisazeyen Apr 5, 2023
a72a620
add global constraints in concat, adjust bio stores
lisazeyen Apr 5, 2023
5f554ab
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 6, 2023
5c90083
merge master
lisazeyen Jul 21, 2023
e92fc4f
merge master
lisazeyen Aug 22, 2023
f595961
add *.orig to gitignore
lisazeyen Aug 22, 2023
890c80e
remove overrides
lisazeyen Aug 22, 2023
e567373
make plot_network conditional
lisazeyen Aug 22, 2023
c629476
adapt to new config path
lisazeyen Aug 22, 2023
a21b1f2
add params
lisazeyen Aug 23, 2023
f47ce1c
add lifetime
lisazeyen Aug 23, 2023
20bf1cd
deal with global constraints
lisazeyen Aug 23, 2023
6585e2c
adjust summary and plotting
lisazeyen Aug 23, 2023
ba589ac
add config for perfect foresight
lisazeyen Aug 23, 2023
60b1968
check for missing buses
lisazeyen Aug 23, 2023
a77f0f6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 21, 2023
8c5ca05
add carbon constraint to perfect
lisazeyen Aug 24, 2023
4b073b0
add co2 store lifetime
lisazeyen Aug 24, 2023
445216a
adjust co2 glcs
lisazeyen Aug 24, 2023
3679687
add co2 store lifetime
lisazeyen Aug 24, 2023
e41357e
update carbon plot
lisazeyen Aug 24, 2023
c10afdc
adjust co2_emission fct
lisazeyen Aug 24, 2023
49ec501
fix bug network dict
lisazeyen Aug 24, 2023
4fb2116
set shared_resoruces true
lisazeyen Aug 24, 2023
f2b01fb
plot summary with usual script
lisazeyen Aug 24, 2023
be23b5c
add network plot for perfect
lisazeyen Aug 24, 2023
73df378
add memory logger
lisazeyen Aug 24, 2023
6b07faf
intermediate solution glc transmission
lisazeyen Aug 24, 2023
ca0d671
add land use constraint
lisazeyen Aug 25, 2023
727aab9
rm intermediate solution
lisazeyen Aug 25, 2023
e6d779a
first step add max_growth
lisazeyen Aug 25, 2023
3fcf3f2
move max growth assumptions to config
lisazeyen Aug 25, 2023
d646c09
intermediate solution back
lisazeyen Aug 25, 2023
0cfd5fa
add carbon budget constraint
lisazeyen Aug 25, 2023
90b85fc
update to tsam performance
lisazeyen Aug 25, 2023
b362c00
drop nan with SEG
lisazeyen Aug 25, 2023
369eaf3
fix bug carbon budget
lisazeyen Aug 28, 2023
abb584d
add H2 boiler and constraint to avoid existing gas boiler back up
lisazeyen Aug 28, 2023
4cd492b
drop assets which reached end of lifetime
lisazeyen Aug 28, 2023
0c42ac4
remove min part for fischer tropsch
lisazeyen Aug 28, 2023
c35391d
move SEG aggregation later
lisazeyen Aug 29, 2023
22d61ad
add line expansion with DC links
lisazeyen Aug 30, 2023
498b225
add CI perfect
lisazeyen Aug 30, 2023
3247fb5
clean up
lisazeyen Aug 30, 2023
9ec7442
merge master
lisazeyen Aug 30, 2023
bdaa646
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2023
c278a31
add benchmark back
lisazeyen Aug 30, 2023
64cbfd6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 30, 2023
9d8dd81
add co2 store lifetime
lisazeyen Aug 30, 2023
c0152c2
first fixes for CI
lisazeyen Aug 30, 2023
457a9e2
fixes CI perfect
lisazeyen Aug 31, 2023
3187081
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 31, 2023
21d1109
Merge branch 'master' into multi-horizon
lisazeyen Sep 29, 2023
9765b24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 29, 2023
22fe244
Update scripts/solve_network.py
lisazeyen Sep 30, 2023
08f1a0f
remove comments for newer data version
lisazeyen Sep 30, 2023
213cec7
remove unrelated changes
lisazeyen Sep 30, 2023
117a7c1
update pypsa version to 0.25.2
lisazeyen Oct 4, 2023
0400f34
Merge branch 'master' into multi-horizon
lisazeyen Oct 4, 2023
51a90b3
Merge branch 'master' into multi-horizon
FabianHofmann Oct 5, 2023
be0214b
simplify config
lisazeyen Oct 5, 2023
1eed747
remove spelling mistakes
lisazeyen Oct 5, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
snakemake -call solve_elec_networks --configfile config/test/config.electricity.yaml --rerun-triggers=mtime
snakemake -call all --configfile config/test/config.overnight.yaml --rerun-triggers=mtime
snakemake -call all --configfile config/test/config.myopic.yaml --rerun-triggers=mtime
snakemake -call all --configfile config/test/config.perfect.yaml --rerun-triggers=mtime
- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__
*dconf
gurobi.log
.vscode
*.orig

/bak
/resources
Expand Down
5 changes: 5 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ if config["foresight"] == "myopic":
include: "rules/solve_myopic.smk"


if config["foresight"] == "perfect":

include: "rules/solve_perfect.smk"


rule all:
input:
RESULTS + "graphs/costs.pdf",
Expand Down
19 changes: 19 additions & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ sector:
years_of_storage: 25
co2_sequestration_potential: 200
co2_sequestration_cost: 10
co2_sequestration_lifetime: 50
co2_spatial: false
co2network: false
cc_fraction: 0.9
Expand Down Expand Up @@ -491,6 +492,20 @@ sector:
OCGT: gas
biomass_to_liquid: false
biosng: false
limit_max_growth:
enable: false
# allowing 30% larger than max historic growth
factor: 1.3
max_growth: # unit GW
onwind: 16 # onshore max grow so far 16 GW in Europe https://www.iea.org/reports/renewables-2020/wind
solar: 28 # solar max grow so far 28 GW in Europe https://www.iea.org/reports/renewables-2020/solar-pv
offwind-ac: 35 # offshore max grow so far 3.5 GW in Europe https://windeurope.org/about-wind/statistics/offshore/european-offshore-wind-industry-key-trends-statistics-2019/
offwind-dc: 35
max_relative_growth:
onwind: 3
solar: 3
offwind-ac: 3
offwind-dc: 3

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#industry
industry:
Expand Down Expand Up @@ -543,11 +558,13 @@ industry:
hotmaps_locate_missing: false
reference_year: 2015


# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs
costs:
year: 2030
version: v0.6.0
rooftop_share: 0.14 # based on the potentials, assuming (0.1 kW/m2 and 10 m2/person)
social_discountrate: 0.02
fill_values:
FOM: 0
VOM: 0
Expand Down Expand Up @@ -761,6 +778,7 @@ plotting:
gas pipeline new: '#a87c62'
# oil
oil: '#c9c9c9'
imported oil: '#a3a3a3'
oil boiler: '#adadad'
residential rural oil boiler: '#a9a9a9'
services rural oil boiler: '#a5a5a5'
Expand Down Expand Up @@ -892,6 +910,7 @@ plotting:
H2 for shipping: "#ebaee0"
H2: '#bf13a0'
hydrogen: '#bf13a0'
retrofitted H2 boiler: '#e5a0d9'
SMR: '#870c71'
SMR CC: '#4f1745'
H2 liquefaction: '#d647bd'
Expand Down
43 changes: 43 additions & 0 deletions config/config.perfect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0
run:
name: "perfect"

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#foresight
foresight: perfect

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#scenario
# Wildcard docs in https://pypsa-eur.readthedocs.io/en/latest/wildcards.html
scenario:
simpl:
- ''
ll:
- v1.0
clusters:
- 37
opts:
- ''
sector_opts:
- 1p5-4380H-T-H-B-I-A-solar+p3-dist1
- 1p7-4380H-T-H-B-I-A-solar+p3-dist1
- 2p0-4380H-T-H-B-I-A-solar+p3-dist1
planning_horizons:
- 2020
- 2030
- 2040
- 2050


# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#co2-budget
co2_budget:
# update of IPCC 6th AR compared to the 1.5SR. (discussed here: https://twitter.com/JoeriRogelj/status/1424743828339167233)
1p5: 34.2 # 25.7 # Budget in Gt CO2 for 1.5 for Europe, global 420 Gt, assuming per capita share
1p6: 43.259666 # 35 # Budget in Gt CO2 for 1.6 for Europe, global 580 Gt
1p7: 51.4 # 45 # Budget in Gt CO2 for 1.7 for Europe, global 800 Gt
2p0: 69.778 # 73.9 # Budget in Gt CO2 for 2 for Europe, global 1170 Gt


sector:
min_part_load_fischer_tropsch: 0
min_part_load_methanolisation: 0
91 changes: 91 additions & 0 deletions config/test/config.perfect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
#
# SPDX-License-Identifier: CC0-1.0

tutorial: true

run:
name: "test-sector-perfect"
disable_progressbar: true
shared_resources: true
shared_cutouts: true

foresight: perfect

scenario:
ll:
- v1.0
clusters:
- 5
sector_opts:
- 8760H-T-H-B-I-A-solar+p3-dist1
planning_horizons:
- 2030
- 2040
- 2050

countries: ['BE']

snapshots:
start: "2013-03-01"
end: "2013-03-08"

electricity:
co2limit: 100.e+6

extendable_carriers:
Generator: [OCGT]
StorageUnit: [battery]
Store: [H2]
Link: [H2 pipeline]

renewable_carriers: [solar, onwind, offwind-ac, offwind-dc]

sector:
min_part_load_fischer_tropsch: 0
min_part_load_methanolisation: 0
atlite:
default_cutout: be-03-2013-era5
cutouts:
be-03-2013-era5:
module: era5
x: [4., 15.]
y: [46., 56.]
time: ["2013-03-01", "2013-03-08"]

renewable:
onwind:
cutout: be-03-2013-era5
offwind-ac:
cutout: be-03-2013-era5
max_depth: false
offwind-dc:
cutout: be-03-2013-era5
max_depth: false
solar:
cutout: be-03-2013-era5

industry:
St_primary_fraction:
2020: 0.8
2030: 0.6
2040: 0.5
2050: 0.4

solving:
solver:
name: glpk
options: glpk-default
mem: 4000

plotting:
map:
boundaries:
eu_node_location:
x: -5.5
y: 46.
costs_max: 1000
costs_threshold: 0.0000001
energy_max:
energy_min:
energy_threshold: 0.000001
6 changes: 3 additions & 3 deletions doc/foresight.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Perfect foresight scenarios

.. warning::

Perfect foresight is currently under development and not yet implemented.
Perfect foresight is currently implemented as a first test version.

For running perfect foresight scenarios, in future versions you will be able to
set in the ``config/config.yaml``:
For running perfect foresight scenarios, you can adjust the
``config/config.perfect.yaml``:

.. code:: yaml
Expand Down
3 changes: 3 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Upcoming Release

* Files extracted from sector-coupled data bundle have been moved from ``data/`` to ``data/sector-bundle``.

* New feature multi-decade optimisation with perfect foresight.

* It is now possible to specify years for biomass potentials which do not exist
in the JRC-ENSPRESO database, e.g. 2037. These are linearly interpolated.

Expand All @@ -32,6 +34,7 @@ Upcoming Release

* A bug preventing custom powerplants specified in ``data/custom_powerplants.csv`` was fixed. (https://github.com/PyPSA/pypsa-eur/pull/732)


PyPSA-Eur 0.8.1 (27th July 2023)
================================

Expand Down
4 changes: 2 additions & 2 deletions envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ dependencies:


- pip:
- tsam>=1.1.0
- pypsa>=0.25.1
- git+https://github.com/fneum/tsam.git@performance
- pypsa>=0.25.2
9 changes: 9 additions & 0 deletions rules/collect.smk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ rule solve_sector_networks:
),


rule solve_sector_networks_perfect:
input:
expand(
RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc",
**config["scenario"]
),


rule plot_networks:
input:
expand(
Expand Down
79 changes: 55 additions & 24 deletions rules/postprocess.smk
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,62 @@ localrules:
copy_conda_env,


rule plot_network:
params:
foresight=config["foresight"],
plotting=config["plotting"],
input:
network=RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
regions=RESOURCES + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
output:
map=RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",
today=RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}-today.pdf",
threads: 2
resources:
mem_mb=10000,
benchmark:
(
if config["foresight"] != "perfect":

rule plot_network:
params:
foresight=config["foresight"],
plotting=config["plotting"],
input:
network=RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
regions=RESOURCES + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
output:
map=RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_{planning_horizons}.pdf",
today=RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}-today.pdf",
threads: 2
resources:
mem_mb=10000,
benchmark:
(
BENCHMARKS
+ "plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
)
conda:
"../envs/environment.yaml"
script:
"../scripts/plot_network.py"


if config["foresight"] == "perfect":

rule plot_network:
params:
foresight=config["foresight"],
plotting=config["plotting"],
input:
network=RESULTS
+ "postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years.nc",
regions=RESOURCES + "regions_onshore_elec_s{simpl}_{clusters}.geojson",
output:
**{
f"map_{year}": RESULTS
+ "maps/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}-costs-all_"
+ f"{year}.pdf"
for year in config["scenario"]["planning_horizons"]
},
threads: 2
resources:
mem_mb=10000,
benchmark:
BENCHMARKS
+ "plot_network/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}"
)
conda:
"../envs/environment.yaml"
script:
"../scripts/plot_network.py"
+"postnetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_brownfield_all_years_benchmark"
conda:
"../envs/environment.yaml"
script:
"../scripts/plot_network.py"


rule copy_config:
Expand Down
Loading