diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7aabf0e6..bad6039f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ on: - cron: "0 5 * * TUE" env: - DATA_CACHE_NUMBER: 1 + DATA_CACHE_NUMBER: 2 jobs: build: @@ -31,7 +31,7 @@ jobs: os: - ubuntu-latest - macos-latest -# - windows-latest + - windows-latest inhouse: - stable - master diff --git a/.gitignore b/.gitignore index 3336fca7..21062dd3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: CC0-1.0 +master + .snakemake* .ipynb_checkpoints __pycache__ @@ -37,18 +39,16 @@ dconf /data/links_p_nom.csv /data/*totals.csv /data/biomass* -/data/bundle-sector/emobility/ -/data/bundle-sector/eea* -/data/bundle-sector/jrc* +/data/bundle/emobility/ +/data/bundle/eea* +/data/bundle/jrc* /data/heating/ -/data/bundle-sector/eurostat* +/data/bundle/eurostat* /data/odyssee/ /data/transport_data.csv -/data/bundle-sector/switzerland* /data/.nfs* -/data/bundle-sector/Industrial_Database.csv -/data/retro/tabula-calculator-calcsetbuilding.csv -/data/bundle-sector/nuts* +/data/retro/* +/data/bundle/nuts* data/gas_network/scigrid-gas/ data/costs_*.csv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a3aab9ed..7acbef9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -51,7 +51,7 @@ repos: # Formatting with "black" coding style - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.0 + rev: 24.4.2 hooks: # Format Python files - id: black @@ -74,7 +74,7 @@ repos: # Format Snakemake rule / workflow files - repo: https://github.com/snakemake/snakefmt - rev: v0.10.1 + rev: v0.10.2 hooks: - id: snakefmt diff --git a/.reuse/dep5 b/.reuse/dep5 index 27edd808..a40d090a 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -30,7 +30,3 @@ License: CC0-1.0 Files: borg-it Copyright: 2017-2024 The PyPSA-Eur Authors License: CC0-1.0 - -Files: graphics/* -Copyright: 2017-2024 The PyPSA-Eur Authors -License: CC-BY-4.0 diff --git a/README.md b/README.md index b4c03574..d5a72b77 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ all greenhouse gas emitters except waste management and land use. This diagram gives an overview of the sectors and the links between them: -![sector diagram](graphics/multisector_figure.png) +![sector diagram](doc/img/multisector_figure.png) Each of these sectors is built up on the transmission network nodes from [PyPSA-Eur](https://github.com/PyPSA/pypsa-eur): diff --git a/Snakefile b/Snakefile index ba93a869..412d520d 100644 --- a/Snakefile +++ b/Snakefile @@ -8,7 +8,7 @@ from os.path import normpath, exists from shutil import copyfile, move, rmtree from snakemake.utils import min_version -min_version("8.5") +min_version("8.11") from scripts._helpers import path_provider, copy_default_files, get_scenarios, get_rdir @@ -24,9 +24,11 @@ run = config["run"] scenarios = get_scenarios(run) RDIR = get_rdir(run) -logs = path_provider("logs/", RDIR, run["shared_resources"]) -benchmarks = path_provider("benchmarks/", RDIR, run["shared_resources"]) -resources = path_provider("resources/", RDIR, run["shared_resources"]) +shared_resources = run["shared_resources"]["policy"] +exclude_from_shared = run["shared_resources"]["exclude"] +logs = path_provider("logs/", RDIR, shared_resources, exclude_from_shared) +benchmarks = path_provider("benchmarks/", RDIR, shared_resources, exclude_from_shared) +resources = path_provider("resources/", RDIR, shared_resources, exclude_from_shared) CDIR = "" if run["shared_cutouts"] else RDIR RESULTS = "results/" + RDIR diff --git a/config/config.default.yaml b/config/config.default.yaml index 0db6dc03..6974d382 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -26,7 +26,9 @@ run: enable: false file: config/scenarios.yaml disable_progressbar: false - shared_resources: false + shared_resources: + policy: false + exclude: [] shared_cutouts: true # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#foresight @@ -38,17 +40,15 @@ scenario: simpl: - '' ll: - - v1.5 + - vopt clusters: - 37 - 128 - 256 - - 512 - - 1024 opts: - '' sector_opts: - - Co2L0-3H-T-H-B-I-A-dist1 + - '' planning_horizons: # - 2020 # - 2030 @@ -69,13 +69,9 @@ enable: retrieve: auto prepare_links_p_nom: false retrieve_databundle: true - retrieve_sector_databundle: true retrieve_cost_data: true build_cutout: false - retrieve_irena: false retrieve_cutout: true - build_natura_raster: false - retrieve_natura_raster: true custom_busmap: false drop_leap_day: true @@ -98,7 +94,6 @@ electricity: co2limit_enable: false co2limit: 7.75e+7 co2base: 1.487e+9 - agg_p_nom_limits: data/agg_p_nom_minmax.csv operational_reserve: activate: false @@ -111,7 +106,7 @@ electricity: H2: 168 extendable_carriers: - Generator: [solar, onwind, offwind-ac, offwind-dc, OCGT] + Generator: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float, OCGT, CCGT] StorageUnit: [] # battery, H2 Store: [battery, H2] Link: [] # H2 pipeline @@ -121,7 +116,7 @@ electricity: everywhere_powerplants: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass] conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass] - renewable_carriers: [solar, onwind, offwind-ac, offwind-dc, hydro] + renewable_carriers: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float, hydro] estimate_renewable_capacities: enable: true @@ -129,7 +124,7 @@ electricity: year: 2020 expansion_limit: false technology_mapping: - Offshore: [offwind-ac, offwind-dc] + Offshore: [offwind-ac, offwind-dc, offwind-float] Onshore: [onwind] PV: [solar] @@ -197,7 +192,7 @@ renewable: luisa: false # [0, 5230] natura: true ship_threshold: 400 - max_depth: 50 + max_depth: 60 max_shore_distance: 30000 excluder_resolution: 200 clip_p_max_pu: 1.e-2 @@ -213,10 +208,28 @@ renewable: luisa: false # [0, 5230] natura: true ship_threshold: 400 - max_depth: 50 + max_depth: 60 min_shore_distance: 30000 excluder_resolution: 200 clip_p_max_pu: 1.e-2 + offwind-float: + cutout: europe-2013-era5 + resource: + method: wind + turbine: NREL_ReferenceTurbine_5MW_offshore + # ScholzPhd Tab 4.3.1: 10MW/km^2 + capacity_per_sqkm: 2 + correction_factor: 0.8855 + # proxy for wake losses + # from 10.1016/j.energy.2018.08.153 + # until done more rigorously in #153 + corine: [44, 255] + natura: true + ship_threshold: 400 + excluder_resolution: 200 + min_depth: 60 + max_depth: 1000 + clip_p_max_pu: 1.e-2 solar: cutout: europe-2013-sarah resource: @@ -232,6 +245,21 @@ renewable: natura: true excluder_resolution: 100 clip_p_max_pu: 1.e-2 + solar-hsat: + cutout: europe-2013-sarah + resource: + method: pv + panel: CSi + orientation: + slope: 35. + azimuth: 180. + tracking: horizontal + capacity_per_sqkm: 4.43 # 15% higher land usage acc. to NREL + corine: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 26, 31, 32] + luisa: false # [1111, 1121, 1122, 1123, 1130, 1210, 1221, 1222, 1230, 1241, 1242, 1310, 1320, 1330, 1410, 1421, 1422, 2110, 2120, 2130, 2210, 2220, 2230, 2310, 2410, 2420, 3210, 3320, 3330] + natura: true + excluder_resolution: 100 + clip_p_max_pu: 1.e-2 hydro: cutout: europe-2013-era5 carriers: [ror, PHS, hydro] @@ -264,7 +292,7 @@ lines: max_extension: 20000 #MW length_factor: 1.25 reconnect_crimea: true - under_construction: 'zero' # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity + under_construction: 'keep' # 'zero': set capacity to zero, 'remove': remove, 'keep': with full capacity dynamic_line_rating: activate: false cutout: europe-2013-era5 @@ -310,6 +338,8 @@ pypsa_eur: - onwind - offwind-ac - offwind-dc + - offwind-float + - solar-hsat - solar - ror - nuclear @@ -402,7 +432,6 @@ sector: bev_availability: 0.5 bev_energy: 0.05 bev_charge_efficiency: 0.9 - bev_plug_to_wheel_efficiency: 0.2 bev_charge_rate: 0.011 bev_avail_max: 0.95 bev_avail_mean: 0.8 @@ -431,8 +460,9 @@ sector: 2040: 0.3 2045: 0.15 2050: 0 - transport_fuel_cell_efficiency: 0.5 - transport_internal_combustion_efficiency: 0.3 + transport_electric_efficiency: 53.19 # 1 MWh_el = 53.19*100 km + transport_fuel_cell_efficiency: 30.003 # 1 MWh_H2 = 30.003*100 km + transport_ice_efficiency: 16.0712 # 1 MWh_oil = 16.0712 * 100 km agriculture_machinery_electric_share: 0 agriculture_machinery_oil_share: 1 agriculture_machinery_fuel_efficiency: 0.7 @@ -538,7 +568,7 @@ sector: - nearshore # within 50 km of sea # - offshore ammonia: false - min_part_load_fischer_tropsch: 0.7 + min_part_load_fischer_tropsch: 0.5 min_part_load_methanolisation: 0.3 min_part_load_methanation: 0.3 use_fischer_tropsch_waste_heat: true @@ -561,6 +591,8 @@ sector: gas pipeline: efficiency_per_1000km: 1 #0.977 compression_per_1000km: 0.01 + electricity distribution grid: + efficiency_static: 0.97 H2_network: true gas_network: false H2_retrofit: false @@ -654,6 +686,9 @@ industry: 2040: 0.12 2045: 0.16 2050: 0.20 + HVC_environment_sequestration_fraction: 0. + waste_to_energy: false + waste_to_energy_cc: false sector_ratios_fraction_future: 2020: 0.0 2025: 0.1 @@ -672,6 +707,7 @@ industry: methanol_production_today: 1.5 MWh_elec_per_tMeOH: 0.167 MWh_CH4_per_tMeOH: 10.25 + MWh_MeOH_per_tMeOH: 5.528 hotmaps_locate_missing: false reference_year: 2015 @@ -679,8 +715,7 @@ industry: # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs costs: year: 2030 - version: v0.8.1 - rooftop_share: 0.14 # based on the potentials, assuming (0.1 kW/m2 and 10 m2/person) + version: v0.9.0 social_discountrate: 0.02 fill_values: FOM: 0 @@ -752,11 +787,28 @@ solving: # io_api: "direct" # Increases performance but only supported for the highs and gurobi solvers # options that go into the optimize function track_iterations: false - min_iterations: 4 - max_iterations: 6 + min_iterations: 2 + max_iterations: 3 transmission_losses: 2 linearized_unit_commitment: true horizon: 365 + post_discretization: + enable: false + line_unit_size: 1700 + line_threshold: 0.3 + link_unit_size: + DC: 2000 + H2 pipeline: 1200 + gas pipeline: 1500 + link_threshold: + DC: 0.3 + H2 pipeline: 0.3 + gas pipeline: 0.3 + + agg_p_nom_limits: + agg_offwind: false + include_existing: false + file: data/agg_p_nom_minmax.csv constraints: CCL: false @@ -855,6 +907,7 @@ plotting: CCGT: "Combined-Cycle Gas" offwind-ac: "Offshore Wind (AC)" offwind-dc: "Offshore Wind (DC)" + offwind-float: "Offshore Wind (Floating)" onwind: "Onshore Wind" solar: "Solar" PHS: "Pumped Hydro Storage" @@ -879,6 +932,9 @@ plotting: offwind-dc: "#74c6f2" offshore wind (DC): "#74c6f2" offshore wind dc: "#74c6f2" + offwind-float: "#b5e2fa" + offshore wind (Float): "#b5e2fa" + offshore wind float: "#b5e2fa" # water hydro: '#298c81' hydro reservoir: '#298c81' @@ -890,6 +946,7 @@ plotting: # solar solar: "#f9d002" solar PV: "#f9d002" + solar-hsat: "#fdb915" solar thermal: '#ffbf2b' residential rural solar thermal: '#f1c069' services rural solar thermal: '#eabf61' @@ -991,6 +1048,7 @@ plotting: BEV charger: '#baf238' V2G: '#e5ffa8' land transport EV: '#baf238' + land transport demand: '#38baf2' Li ion: '#baf238' # hot water storage water tanks: '#e69487' @@ -1095,6 +1153,7 @@ plotting: methanolisation: '#83d6d5' methanol: '#468c8b' shipping methanol: '#468c8b' + industry methanol: '#468c8b' # co2 CC: '#f29dae' CCS: '#f29dae' @@ -1134,3 +1193,6 @@ plotting: DC-DC: "#8a1caf" DC link: "#8a1caf" load: "#dd2e23" + waste CHP: '#e3d37d' + waste CHP CC: '#e3d3ff' + HVC to air: 'k' diff --git a/config/config.entsoe-all.yaml b/config/config.entsoe-all.yaml index 40e3c0a5..4e7edd03 100644 --- a/config/config.entsoe-all.yaml +++ b/config/config.entsoe-all.yaml @@ -5,7 +5,8 @@ run: name: "entsoe-all" disable_progressbar: true - shared_resources: false + shared_resources: + policy: false shared_cutouts: true scenario: @@ -38,6 +39,5 @@ lines: enable: retrieve: true retrieve_databundle: true - retrieve_sector_databundle: false retrieve_cost_data: true retrieve_cutout: true diff --git a/config/test/config.electricity.yaml b/config/test/config.electricity.yaml index 57964415..38fa31ab 100644 --- a/config/test/config.electricity.yaml +++ b/config/test/config.electricity.yaml @@ -8,14 +8,15 @@ tutorial: true run: name: "test-elec" # use this to keep track of runs with different settings disable_progressbar: true - shared_resources: "test" + shared_resources: + policy: "test" shared_cutouts: true scenario: clusters: - 5 opts: - - Co2L-24h + - '' countries: ['BE'] @@ -24,6 +25,7 @@ snapshots: end: "2013-03-08" electricity: + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: @@ -32,7 +34,7 @@ electricity: Store: [H2] Link: [H2 pipeline] - renewable_carriers: [solar, onwind, offwind-ac, offwind-dc] + renewable_carriers: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float] atlite: @@ -53,12 +55,20 @@ renewable: offwind-dc: cutout: be-03-2013-era5 max_depth: false + offwind-float: + cutout: be-03-2013-era5 + max_depth: false + min_depth: false solar: cutout: be-03-2013-era5 + solar-hsat: + cutout: be-03-2013-era5 clustering: exclude_carriers: ["OCGT", "offwind-ac", "coal"] + temporal: + resolution_elec: 24h lines: dynamic_line_rating: diff --git a/config/test/config.myopic.yaml b/config/test/config.myopic.yaml index 5abae36d..3a3a7856 100644 --- a/config/test/config.myopic.yaml +++ b/config/test/config.myopic.yaml @@ -7,7 +7,8 @@ tutorial: true run: name: "test-sector-myopic" disable_progressbar: true - shared_resources: "test" + shared_resources: + policy: "test" shared_cutouts: true foresight: myopic @@ -18,7 +19,7 @@ scenario: clusters: - 5 sector_opts: - - 24h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 - 2040 @@ -34,7 +35,6 @@ sector: central_heat_vent: true electricity: - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] @@ -42,7 +42,7 @@ electricity: Store: [H2] Link: [H2 pipeline] - renewable_carriers: [solar, onwind, offwind-ac, offwind-dc] + renewable_carriers: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float] atlite: default_cutout: be-03-2013-era5 @@ -62,8 +62,18 @@ renewable: offwind-dc: cutout: be-03-2013-era5 max_depth: false + offwind-float: + cutout: be-03-2013-era5 + max_depth: false + min_depth: false solar: cutout: be-03-2013-era5 + solar-hsat: + cutout: be-03-2013-era5 + +clustering: + temporal: + resolution_sector: 24h industry: St_primary_fraction: diff --git a/config/test/config.overnight.yaml b/config/test/config.overnight.yaml index 7fb53e42..92379ae2 100644 --- a/config/test/config.overnight.yaml +++ b/config/test/config.overnight.yaml @@ -7,7 +7,8 @@ tutorial: true run: name: "test-sector-overnight" disable_progressbar: true - shared_resources: "test" + shared_resources: + policy: "test" shared_cutouts: true @@ -17,7 +18,7 @@ scenario: clusters: - 5 sector_opts: - - CO2L0-24h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 @@ -28,7 +29,6 @@ snapshots: end: "2013-03-08" electricity: - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] @@ -36,7 +36,7 @@ electricity: Store: [H2] Link: [H2 pipeline] - renewable_carriers: [solar, onwind, offwind-ac, offwind-dc] + renewable_carriers: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float] atlite: default_cutout: be-03-2013-era5 @@ -56,13 +56,28 @@ renewable: offwind-dc: cutout: be-03-2013-era5 max_depth: false + offwind-float: + cutout: be-03-2013-era5 + max_depth: false + min_depth: false solar: cutout: be-03-2013-era5 + solar-hsat: + cutout: be-03-2013-era5 + +clustering: + temporal: + resolution_sector: 24h sector: gas_network: true H2_retrofit: true +industry: + HVC_environment_sequestration_fraction: 0.5 + waste_to_energy: true + waste_to_energy_cc: true + solving: solver: name: glpk diff --git a/config/test/config.perfect.yaml b/config/test/config.perfect.yaml index 5d77c9c5..781b3fd4 100644 --- a/config/test/config.perfect.yaml +++ b/config/test/config.perfect.yaml @@ -7,7 +7,8 @@ tutorial: true run: name: "test-sector-perfect" disable_progressbar: true - shared_resources: "test" + shared_resources: + policy: "test" shared_cutouts: true foresight: perfect @@ -18,7 +19,7 @@ scenario: clusters: - 5 sector_opts: - - 8760h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 - 2040 @@ -31,7 +32,6 @@ snapshots: end: "2013-03-08" electricity: - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] @@ -39,7 +39,7 @@ electricity: Store: [H2] Link: [H2 pipeline] - renewable_carriers: [solar, onwind, offwind-ac, offwind-dc] + renewable_carriers: [solar, solar-hsat, onwind, offwind-ac, offwind-dc, offwind-float] sector: min_part_load_fischer_tropsch: 0 @@ -63,8 +63,18 @@ renewable: offwind-dc: cutout: be-03-2013-era5 max_depth: false + offwind-float: + cutout: be-03-2013-era5 + max_depth: false + min_depth: false solar: cutout: be-03-2013-era5 + solar-hsat: + cutout: be-03-2013-era5 + +clustering: + temporal: + resolution_sector: 8760h industry: St_primary_fraction: diff --git a/config/test/config.scenarios.yaml b/config/test/config.scenarios.yaml index 8ecbb91b..a9a826fd 100644 --- a/config/test/config.scenarios.yaml +++ b/config/test/config.scenarios.yaml @@ -12,14 +12,15 @@ run: enable: true file: "config/test/scenarios.yaml" disable_progressbar: true - shared_resources: base + shared_resources: + policy: base shared_cutouts: true scenario: clusters: - 5 opts: - - Co2L-24H + - '' countries: ['BE'] diff --git a/data/agg_p_nom_minmax.csv b/data/agg_p_nom_minmax.csv index 111215bc..a3a10dc2 100644 --- a/data/agg_p_nom_minmax.csv +++ b/data/agg_p_nom_minmax.csv @@ -1,31 +1,33 @@ -country,carrier,min,max -DE,onwind,0.1, -DE,offwind-ac,0.1, -DE,offwind-dc,0.1, -DE,solar,0.2, -LU,onwind,, -LU,solar,, -NL,onwind,, -NL,offwind-ac,, -NL,offwind-dc,, -NL,solar,, -GB,onwind,, -GB,offwind-ac,, -GB,offwind-dc,, -GB,solar,, -IE,onwind,, -IE,offwind-ac,, -IE,offwind-dc,, -IE,solar,, -FR,onwind,, -FR,offwind-ac,, -FR,offwind-dc,, -FR,solar,, -DK,onwind,, -DK,offwind-ac,, -DK,offwind-dc,, -DK,solar,, -BE,onwind,, -BE,offwind-ac,, -BE,offwind-dc,, -BE,solar,, +,,2030,2030,2040,2040,2050,2050 +,,min,max,min,max,min,max +country,carrier,,,,,, +DE,onwind,0.1,,0.1,,0.1, +DE,offwind-ac,0.1,,0.1,,0.1, +DE,offwind-dc,0.1,,0.1,,0.1, +DE,solar,0.2,,0.2,,0.2, +LU,onwind,,,,,, +LU,solar,,,,,, +NL,onwind,,,,,, +NL,offwind-ac,,,,,, +NL,offwind-dc,,,,,, +NL,solar,,,,,, +GB,onwind,,,,,, +GB,offwind-ac,,,,,, +GB,offwind-dc,,,,,, +GB,solar,,,,,, +IE,onwind,,,,,, +IE,offwind-ac,,,,,, +IE,offwind-dc,,,,,, +IE,solar,,,,,, +FR,onwind,,,,,, +FR,offwind-ac,,,,,, +FR,offwind-dc,,,,,, +FR,solar,,,,,, +DK,onwind,,,,,, +DK,offwind-ac,,,,,, +DK,offwind-dc,,,,,, +DK,solar,,,,,, +BE,onwind,,,,,, +BE,offwind-ac,,,,,, +BE,offwind-dc,,,,,, +BE,solar,,,,,, diff --git a/data/ch_cantons.csv b/data/ch_cantons.csv new file mode 100644 index 00000000..22711274 --- /dev/null +++ b/data/ch_cantons.csv @@ -0,0 +1,27 @@ +Canton,HASC,NUTS +Aargau,CH.AG,CH033 +Appenzell Inner Rhodes,CH.AI,CH054 +Appenzell Outer Rhodes,CH.AR,CH053 +Basel-Landschaft,CH.BL,CH032 +Basel-Stadt,CH.BS,CH031 +Bern,CH.BE,CH021 +Fribourg,CH.FR,CH022 +Geneva,CH.GE,CH013 +Glarus,CH.GL,CH051 +Graubünden,CH.GR,CH056 +Jura,CH.JU,CH025 +Lucerne,CH.LU,CH061 +Neuchâtel,CH.NE,CH024 +Nidwalden,CH.NW,CH065 +Obwalden,CH.OW,CH064 +Sankt Gallen,CH.SG,CH055 +Schaffhausen,CH.SH,CH052 +Schwyz,CH.SZ,CH063 +Solothurn,CH.SO,CH023 +Thurgau,CH.TG,CH057 +Ticino,CH.TI,CH07 +Uri,CH.UR,CH062 +Valais,CH.VS,CH012 +Vaud,CH.VD,CH011 +Zug,CH.ZG,CH066 +Zurich,CH.ZH,CH04 diff --git a/data/existing_infrastructure/offwind_capacity_IRENA.csv b/data/existing_infrastructure/offwind_capacity_IRENA.csv deleted file mode 100644 index d2a3f0f1..00000000 --- a/data/existing_infrastructure/offwind_capacity_IRENA.csv +++ /dev/null @@ -1,34 +0,0 @@ -Country/area,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022 -Albania,,,,,,,,,,,,,,,,,,,,,,, -Austria,,,,,,,,,,,,,,,,,,,,,,, -Belgium,,,,,,,,,,31.5,196.5,196.5,381.0,707.7,707.7,712.0,712.2,877.2,1185.9,1555.5,2261.8,2261.8,2261.8 -Bosnia Herzg,,,,,,,,,,,,,,,,,,,,,,, -Bulgaria,,,,,,,,,,,,,,,,,,,,,,, -Croatia,,,,,,,,,,,,,,,,,,,,,,, -Czechia,,,,,,,,,,,,,,,,,,,,,,, -Denmark,49.95,49.95,213.95,423.35,423.35,423.35,423.35,423.35,423.35,660.85,867.85,871.45,921.85,1271.05,1271.05,1271.05,1271.05,1263.8,1700.8,1700.8,1700.8,2305.6,2305.6 -Estonia,,,,,,,,,,,,,,,,,,,,,,, -Finland,,,,,,,,,24.0,24.0,26.3,26.3,26.3,26.3,26.3,32.0,32.0,72.7,72.7,73.0,73.0,73.0,73.0 -France,,,,,,,,,,,,,,,,,,2.0,2.0,2.0,2.0,2.0,482.0 -Germany,,,,,,,,,,35.0,80.0,188.0,268.0,508.0,994.0,3283.0,4132.0,5406.0,6393.0,7555.0,7787.0,7787.0,8129.0 -Greece,,,,,,,,,,,,,,,,,,,,,,, -Hungary,,,,,,,,,,,,,,,,,,,,,,, -Ireland,,,,,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2,25.2 -Italy,,,,,,,,,,,,,,,,,,,,,,,30.0 -Latvia,,,,,,,,,,,,,,,,,,,,,,, -Lithuania,,,,,,,,,,,,,,,,,,,,,,, -Luxembourg,,,,,,,,,,,,,,,,,,,,,,, -Montenegro,,,,,,,,,,,,,,,,,,,,,,, -Netherlands,,,,,,,108.0,108.0,228.0,228.0,228.0,228.0,228.0,228.0,228.0,357.0,957.0,957.0,957.0,957.0,2459.5,2459.5,2571.0 -North Macedonia,,,,,,,,,,,,,,,,,,,,,,, -Norway,,,,,,,,,,2.3,2.3,2.3,2.3,2.3,2.3,2.3,2.3,2.3,2.3,2.3,2.3,6.3,66.3 -Poland,,,,,,,,,,,,,,,,,,,,,,, -Portugal,,,,,,,,,,,,1.86,2.0,2.0,2.0,2.0,,,,,25.0,25.0,25.0 -Romania,,,,,,,,,,,,,,,,,,,,,,, -Serbia,,,,,,,,,,,,,,,,,,,,,,, -Slovakia,,,,,,,,,,,,,,,,,,,,,,, -Slovenia,,,,,,,,,,,,,,,,,,,,,,, -Spain,,,,,,,,,,,,,,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0,5.0 -Sweden,13.0,22.0,22.0,22.0,22.0,22.0,22.0,131.0,133.0,163.0,163.0,163.0,163.0,212.0,213.0,213.0,203.0,203.0,203.0,203.0,203.0,193.0,193.0 -Switzerland,,,,,,,,,,,,,,,,,,,,,,, -UK,4.0,4.0,4.0,64.0,124.0,214.0,304.0,394.0,596.2,951.0,1341.0,1838.0,2995.0,3696.0,4501.0,5093.0,5293.0,6988.0,8181.0,9888.0,10383.0,11255.0,13928.0 diff --git a/data/existing_infrastructure/onwind_capacity_IRENA.csv b/data/existing_infrastructure/onwind_capacity_IRENA.csv deleted file mode 100644 index cd5ac19c..00000000 --- a/data/existing_infrastructure/onwind_capacity_IRENA.csv +++ /dev/null @@ -1,34 +0,0 @@ -Country/area,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022 -Albania,,,,,,,,,,,,,,,,,,,,,,, -Austria,50.0,67.0,109.0,322.0,581.0,825.22,968.27,991.16,991.97,1000.99,1015.83,1105.97,1337.15,1674.54,2110.28,2488.73,2730.0,2886.7,3132.71,3224.12,3225.98,3407.81,3735.81 -Belgium,14.0,26.0,31.0,67.0,96.0,167.0,212.0,276.0,324.0,576.5,715.5,872.5,985.9,1061.3,1225.0,1469.3,1621.6,1902.2,2119.0,2308.0,2410.9,2686.6,2989.6 -Bosnia Herzg,,,,,,,,,,,,0.3,0.3,0.3,0.3,0.3,0.3,0.3,51.0,87.0,87.0,135.0,135.0 -Bulgaria,,,,,1.0,8.0,27.0,30.0,114.0,333.0,488.0,541.0,677.0,683.0,699.0,699.0,699.0,698.39,698.92,703.12,702.8,704.38,704.38 -Croatia,,,,,6.0,6.0,17.0,17.0,17.0,70.0,79.0,130.0,180.0,254.0,339.0,418.0,483.0,576.1,586.3,646.3,801.3,986.9,1042.9 -Czechia,2.0,,6.4,10.6,16.5,22.0,43.5,113.8,150.0,193.0,213.0,213.0,258.0,262.0,278.0,281.0,282.0,308.21,316.2,339.41,339.42,339.41,339.41 -Denmark,2340.07,2447.2,2680.58,2696.57,2700.36,2704.49,2712.35,2700.86,2739.52,2821.24,2933.98,3080.53,3240.09,3547.87,3615.35,3805.92,3974.09,4225.15,4421.86,4409.74,4566.23,4715.24,4782.24 -Estonia,,,1.0,3.0,7.0,31.0,31.0,50.0,77.0,104.0,108.0,180.0,266.0,248.0,275.0,300.0,310.0,311.8,310.0,316.0,317.0,315.0,315.0 -Finland,38.0,39.0,43.0,52.0,82.0,82.0,86.0,110.0,119.0,123.0,170.7,172.7,230.7,420.7,600.7,973.0,1533.0,1971.3,1968.3,2211.0,2513.0,3184.0,5541.0 -France,38.0,66.0,138.0,218.0,358.0,690.0,1412.0,2223.0,3403.0,4582.0,5912.0,6758.02,7607.5,8155.96,9201.42,10298.18,11566.56,13497.35,14898.14,16424.85,17512.0,18737.98,20637.98 -Germany,6095.0,8754.0,12001.0,14381.0,16419.0,18248.0,20474.0,22116.0,22794.0,25697.0,26823.0,28524.0,30711.0,32969.0,37620.0,41297.0,45303.0,50174.0,52328.0,53187.0,54414.0,56046.0,58165.0 -Greece,226.0,270.0,287.0,371.0,470.0,491.0,749.0,846.0,1022.0,1171.0,1298.0,1640.0,1753.0,1809.0,1978.0,2091.0,2370.0,2624.0,2877.5,3589.0,4119.25,4649.13,4879.13 -Hungary,,1.0,1.0,3.0,3.0,17.0,33.0,61.0,134.0,203.0,293.0,331.0,325.0,329.0,329.0,329.0,329.0,329.0,329.0,323.0,323.0,324.0,324.0 -Ireland,116.5,122.9,134.8,210.3,311.2,468.1,651.3,715.3,917.1,1226.1,1365.2,1559.4,1679.15,1898.1,2258.05,2425.95,2776.45,3293.95,3648.65,4101.25,4281.5,4313.84,4593.84 -Italy,363.0,664.0,780.0,874.0,1127.0,1635.0,1902.0,2702.0,3525.0,4879.0,5794.0,6918.0,8102.0,8542.0,8683.0,9137.0,9384.0,9736.58,10230.25,10679.46,10870.62,11253.73,11749.73 -Latvia,2.0,2.0,22.0,26.0,26.0,26.0,26.0,26.0,28.0,29.0,30.0,36.0,59.0,65.89,68.92,68.17,69.91,77.11,78.17,78.07,78.07,77.13,136.13 -Lithuania,,,,,1.0,1.0,31.0,47.0,54.0,98.0,133.0,202.0,275.0,279.0,288.0,436.0,509.0,518.0,533.0,534.0,540.0,671.0,814.0 -Luxembourg,14.0,13.9,13.9,20.5,34.9,34.9,34.9,34.9,42.92,42.93,43.73,44.53,58.33,58.33,58.34,63.79,119.69,119.69,122.89,135.79,152.74,136.44,165.44 -Montenegro,,,,,,,,,,,,,,,,,,72.0,72.0,118.0,118.0,118.0,118.0 -Netherlands,447.0,486.0,672.0,905.0,1075.0,1224.0,1453.0,1641.0,1921.0,1994.0,2009.0,2088.0,2205.0,2485.0,2637.0,3033.84,3300.12,3245.0,3436.11,3527.16,4188.38,5309.87,6176.0 -North Macedonia,,,,,,,,,,,,,,,37.0,37.0,37.0,37.0,37.0,37.0,37.0,37.0,37.0 -Norway,13.0,13.0,97.0,97.0,152.0,265.0,284.0,348.0,395.0,420.7,422.7,509.7,702.7,815.7,856.7,864.7,880.7,1204.7,1707.7,2911.7,4027.7,5042.7,5067.7 -Poland,4.0,19.0,32.0,35.0,40.0,121.0,172.0,306.0,526.0,709.0,1108.0,1800.0,2564.0,3429.0,3836.0,4886.0,5747.0,5759.36,5766.08,5837.76,6298.25,6967.34,7987.34 -Portugal,83.0,125.0,190.0,268.0,553.0,1064.0,1681.0,2201.0,2857.0,3326.0,3796.0,4254.35,4409.55,4607.95,4854.56,4934.84,5124.1,5124.1,5172.36,5222.75,5097.26,5402.33,5430.33 -Romania,,,,,,1.0,1.0,3.0,5.0,15.0,389.0,988.0,1822.0,2773.0,3244.0,3130.0,3025.0,3029.8,3032.26,3037.52,3012.53,3014.96,3014.96 -Serbia,,,,,,,,,,,,,0.5,0.5,0.5,10.4,17.0,25.0,227.0,398.0,398.0,398.0,398.0 -Slovakia,,,,3.0,3.0,5.0,5.0,5.0,5.0,3.0,3.0,3.0,3.0,5.0,3.0,3.0,3.0,4.0,3.0,4.0,4.0,4.0,4.0 -Slovenia,,,,,,,,,,,,,2.0,2.0,3.0,3.0,3.0,3.3,3.3,3.3,3.3,3.33,3.33 -Spain,2206.0,3397.0,4891.0,5945.0,8317.0,9918.0,11722.0,14820.0,16555.0,19176.0,20693.0,21529.0,22789.0,22953.0,22920.0,22938.0,22985.0,23119.48,23400.06,25585.08,26814.19,27902.65,29302.84 -Sweden,196.0,273.0,335.0,395.0,453.0,500.0,563.0,692.0,956.0,1312.0,1854.0,2601.0,3443.0,3982.0,4875.0,5606.0,6232.0,6408.0,7097.0,8478.0,9773.0,11923.0,14364.0 -Switzerland,3.0,5.0,5.0,5.0,9.0,12.0,12.0,12.0,14.0,18.0,42.0,46.0,49.0,60.0,60.0,60.0,75.0,75.0,75.0,75.0,87.0,87.0,87.0 -UK,431.0,490.0,531.0,678.0,809.0,1351.0,1651.0,2083.0,2849.8,3468.0,4080.0,4758.0,6035.0,7586.0,8573.0,9212.0,10833.0,12597.0,13425.0,13999.0,14075.0,14492.0,14832.0 diff --git a/data/existing_infrastructure/solar_capacity_IRENA.csv b/data/existing_infrastructure/solar_capacity_IRENA.csv deleted file mode 100644 index 01683f8d..00000000 --- a/data/existing_infrastructure/solar_capacity_IRENA.csv +++ /dev/null @@ -1,34 +0,0 @@ -Country/area,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022 -Albania,,0.1,0.2,0.2,0.2,0.2,0.2,0.2,0.2,0.3,0.4,0.56,0.68,0.76,0.87,1.05,1.0,1.0,1.0,14.0,21.0,23.0,28.6 -Austria,5.0,7.0,9.0,23.0,27.0,18.49,19.61,21.42,27.0,45.56,85.27,169.88,333.09,620.78,779.76,931.56,1089.53,1262.01,1447.94,1694.4,2034.74,2773.91,3538.91 -Belgium,,,1.0,1.0,1.0,2.0,2.0,20.0,62.0,386.0,1006.6,1978.6,2646.6,2901.6,3015.0,3131.6,3328.8,3620.6,4000.0,4636.6,5572.8,6012.4,6898.4 -Bosnia Herzg,,,,0.1,0.2,0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.35,1.34,7.17,8.17,14.12,16.0,18.15,22.35,34.89,56.51,107.47 -Bulgaria,,,,,,,,0.03,0.1,2.0,25.0,154.0,921.99,1038.54,1028.92,1027.89,1029.89,1030.7,1033.06,1044.39,1100.21,1274.71,1948.36 -Croatia,,,,,,,,,,0.3,0.3,0.3,4.0,19.0,33.0,47.8,55.8,60.0,67.7,84.8,108.5,138.3,182.3 -Czechia,0.1,0.1,0.2,0.3,0.4,0.59,0.84,3.96,39.5,464.6,1727.0,1913.0,2022.0,2063.5,2067.4,2074.9,2067.9,2075.44,2081.05,2110.67,2171.96,2246.09,2627.09 -Denmark,1.0,1.0,2.0,2.0,2.0,3.0,3.0,3.0,3.0,5.0,7.0,17.0,402.0,571.0,607.0,782.11,850.95,906.35,998.0,1080.0,1304.29,1704.04,3122.04 -Estonia,,,,,,,,,,0.1,0.1,0.2,0.38,1.5,3.34,6.5,10.0,15.0,31.9,120.6,207.67,394.77,534.77 -Finland,2.0,3.0,3.0,3.0,4.0,4.0,5.0,5.0,6.0,6.0,7.0,7.0,8.0,9.0,11.0,17.0,39.0,82.0,140.0,222.0,318.0,425.0,590.6 -France,7.0,7.0,8.0,9.0,11.0,13.0,15.0,26.0,80.0,277.0,1044.0,3003.57,4358.75,5277.29,6034.42,7137.52,7702.08,8610.44,9638.88,10738.39,11812.2,14436.97,17036.97 -Germany,114.0,195.0,260.0,435.0,1105.0,2056.0,2899.0,4170.0,6120.0,10564.0,18004.0,25914.0,34075.0,36708.0,37898.0,39222.0,40677.0,42291.0,45156.0,48912.0,53669.0,59371.0,66662.0 -Greece,,1.0,1.0,1.0,1.0,1.0,5.0,9.0,12.0,46.0,202.0,612.0,1536.0,2579.0,2596.0,2604.0,2604.0,2605.53,2651.57,2833.79,3287.72,4277.42,5557.42 -Hungary,,,,,,,,0.4,1.0,1.0,2.0,4.0,12.0,35.0,89.0,172.0,235.0,344.0,728.0,1400.0,2131.0,2968.0,2988.0 -Ireland,,,,,,,,,,,,,,,,,,,,,,, -Italy,19.0,20.0,22.0,26.0,31.0,34.0,45.0,110.0,483.0,1264.0,3592.0,13131.0,16785.0,18185.0,18594.0,18901.0,19283.0,19682.29,20107.59,20865.28,21650.04,22594.26,25076.56 -Latvia,,,,,,,,,,,,,,,,,0.69,0.69,1.96,3.3,5.1,7.16,56.16 -Lithuania,,,,,,,,,0.1,0.1,0.1,0.3,7.0,68.0,69.0,69.0,70.0,70.08,72.0,73.0,80.0,84.0,397.0 -Luxembourg,,0.16,1.59,14.17,23.56,23.58,23.7,23.93,24.56,26.36,29.45,40.67,74.65,95.02,109.93,116.27,121.9,128.1,130.62,159.74,186.64,277.16,319.16 -Montenegro,,,,,,,,,,,,,,,,,,,,,2.57,2.57,22.2 -Netherlands,13.0,21.0,26.0,46.0,50.0,51.0,53.0,54.0,59.0,69.0,90.0,149.0,287.0,650.0,1007.0,1526.26,2135.02,2910.89,4608.0,7226.0,11108.43,14910.69,18848.69 -North Macedonia,,,,,,,,,,,,2.0,4.0,7.0,15.0,17.0,16.7,16.7,16.7,16.71,84.93,84.93,84.93 -Norway,6.0,6.0,6.0,7.0,7.0,7.0,8.0,8.0,8.3,8.7,9.1,9.5,10.0,11.0,13.0,15.0,26.7,44.9,53.11,102.53,141.53,186.53,302.53 -Poland,,,,,,,,,,,,1.11,1.3,2.39,27.15,107.78,187.25,287.09,561.98,1539.26,3954.96,7415.52,11166.52 -Portugal,1.0,1.0,1.0,2.0,2.0,2.0,3.0,24.0,59.0,115.0,134.0,169.6,235.6,293.6,412.6,441.75,493.05,539.42,617.85,832.74,1010.07,1474.78,2364.78 -Romania,,,,,,,,,0.1,0.1,0.1,1.0,41.0,761.0,1293.0,1326.0,1372.0,1374.13,1385.82,1397.71,1382.54,1393.92,1413.92 -Serbia,,,,,,0.1,0.2,0.4,0.9,1.2,1.3,1.5,3.1,4.7,6.0,9.0,11.0,10.0,11.0,11.0,11.5,11.94,11.94 -Slovakia,,,,,,,,,,,19.0,496.0,513.0,533.0,533.0,533.0,533.0,528.0,472.0,590.0,535.0,537.0,537.0 -Slovenia,1.0,1.0,,,,0.05,0.19,0.59,1.0,4.0,12.0,57.0,142.0,187.0,223.0,238.0,233.0,246.8,246.8,277.88,369.78,461.16,632.16 -Spain,1.0,3.0,6.0,10.0,19.0,37.0,113.0,476.0,3365.0,3403.0,3851.0,4260.0,4545.0,4665.0,4672.0,4677.0,4687.0,4696.0,4730.7,8772.02,10100.42,13678.4,18176.73 -Sweden,3.0,3.0,3.0,4.0,4.0,4.0,5.0,6.0,8.0,9.0,11.0,12.0,24.0,43.0,60.0,104.0,153.0,231.0,411.0,698.0,1090.0,1587.0,2587.0 -Switzerland,16.0,18.0,20.0,22.0,24.0,28.0,30.0,37.0,49.0,79.0,125.0,223.0,437.0,756.0,1061.0,1394.0,1664.0,1906.0,2173.0,2498.0,2973.0,3655.0,4339.92 -UK,2.0,3.0,4.0,6.0,8.0,11.0,14.0,18.0,23.0,27.0,95.0,1000.0,1753.0,2937.0,5528.0,9601.0,11914.0,12760.0,13059.0,13345.0,13579.0,13965.0,14660.0 diff --git a/data/hydro_capacities.csv b/data/hydro_capacities.csv new file mode 100644 index 00000000..1b39f731 --- /dev/null +++ b/data/hydro_capacities.csv @@ -0,0 +1,31 @@ +Country,p_nom_discharge[GW],p_nom_store[GW],E_store[TWh],InflowHourlyAvg[GWh] +AT,13.08,3.8,3.2,4.02 +BE,1.42,1.31,0,0.04 +BA,2.05,0.62,2.5,0.71 +BG,3.13,0.86,4,0.53 +HR,2,0.61,2.8,0.57 +CZ,2.21,0.68,1.5,0.24 +DK,0.01,0,0,0 +EE,0.01,0,0,0 +FI,3.2,0,5.5,1.59 +FR,25.37,6.99,9.8,7.82 +DE,11.26,6.8,0.3,1.93 +GB,4.43,2.74,0,0.46 +GR,3.24,0.7,2.3,0.26 +HU,0.06,0,0.1,0.02 +IE,0.53,0.29,0,0.08 +IT,21.88,7.55,7.9,5.19 +LV,1.58,0,1.8,0.3 +LT,0.88,0.76,0.2,0.05 +LU,1.13,1.29,0,0 +NL,0.04,0,0,0.01 +NO,30.51,1.35,84.4,14 +PL,2.35,1.4,1.6,0.23 +PT,5.72,1.03,2.6,1.37 +RO,6.55,0.09,12.1,1.95 +RS,2.14,0.61,0,1.18 +SK,2.52,0.92,2.2,0.49 +SI,1.25,0.18,2.2,0.36 +ES,18.55,2.75,18.4,2.61 +SE,16.41,0.1,33.8,7.8 +CH,13.3,4.03,8.4,4.29 diff --git a/doc/configtables/co2_budget.csv b/doc/configtables/co2_budget.csv index 21b42f05..8f11f9c6 100644 --- a/doc/configtables/co2_budget.csv +++ b/doc/configtables/co2_budget.csv @@ -1,2 +1,2 @@ ,Unit,Values,Description -co2_budget,--,Dictionary with planning horizons as keys.,CO2 budget as a fraction of 1990 emissions. Overwritten if ``CO2Lx`` or ``cb`` are set in ``{sector_opts}`` wildcard"doc/configtables/othertoplevel.csv +co2_budget,--,Dictionary with planning horizons as keys.,CO2 budget as a fraction of 1990 emissions. Overwritten if ``Co2Lx`` or ``cb`` are set in ``{sector_opts}`` wildcard"doc/configtables/othertoplevel.csv diff --git a/doc/configtables/costs.csv b/doc/configtables/costs.csv index 03933c18..38079e34 100644 --- a/doc/configtables/costs.csv +++ b/doc/configtables/costs.csv @@ -1,7 +1,6 @@ ,Unit,Values,Description year,--,YYYY; e.g. '2030',Year for which to retrieve cost assumptions of ``resources/costs.csv``. version,--,vX.X.X or //vX.X.X; e.g. 'v0.5.0',Version of ``technology-data`` repository to use. If this string is of the form // then costs are instead retrieved from ``github.com//`` at the tag. -rooftop_share,--,float,Share of rooftop PV when calculating capital cost of solar (joint rooftop and utility-scale PV). social_discountrate,p.u.,float,Social discount rate to compare costs in different investment periods. 0.02 corresponds to a social discount rate of 2%. fill_values,--,float,Default values if not specified for a technology in ``resources/costs.csv``. capital_cost,EUR/MW,Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.,"For the given technologies, assumptions about their capital investment costs are set to the corresponding value. Optional; overwrites cost assumptions from ``resources/costs.csv``." diff --git a/doc/configtables/electricity.csv b/doc/configtables/electricity.csv index 22a22d57..e94af44a 100644 --- a/doc/configtables/electricity.csv +++ b/doc/configtables/electricity.csv @@ -2,10 +2,9 @@ voltages,kV,"Any subset of {220., 300., 380.}",Voltage levels to consider gaslimit_enable,bool,true or false,Add an overall absolute gas limit configured in ``electricity: gaslimit``. gaslimit,MWhth,float or false,Global gas usage limit -co2limit_enable,bool,true or false,Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. +co2limit_enable,bool,true or false,Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit`` in :mod:`prepare_network`. **Warning:** This option should currently only be used with electricity-only networks, not for sector-coupled networks.. co2limit,:math:`t_{CO_2-eq}/a`,float,Cap on total annual system carbon dioxide emissions co2base,:math:`t_{CO_2-eq}/a`,float,Reference value of total annual system carbon dioxide emissions if relative emission reduction target is specified in ``{opts}`` wildcard. -agg_p_nom_limits,file,path,Reference to ``.csv`` file specifying per carrier generator nominal capacity constraints for individual countries if ``'CCL'`` is in ``{opts}`` wildcard. Defaults to ``data/agg_p_nom_minmax.csv``. operational_reserve,,,Settings for reserve requirements following `GenX `_ ,,, -- activate,bool,true or false,Whether to take operational reserve requirements into account during optimisation @@ -28,14 +27,14 @@ everywhere_powerplants,--,"Any subset of {nuclear, oil, OCGT, CCGT, coal, lignit ,,, conventional_carriers,--,"Any subset of {nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass}","List of conventional power plants to include in the model from ``resources/powerplants.csv``. If an included carrier is also listed in ``extendable_carriers``, the capacity is taken as a lower bound." ,,, -renewable_carriers,--,"Any subset of {solar, onwind, offwind-ac, offwind-dc, hydro}",List of renewable generators to include in the model. +renewable_carriers,--,"Any subset of {solar, onwind, offwind-ac, offwind-dc, offwind-float, hydro}",List of renewable generators to include in the model. estimate_renewable_capacities,,, -- enable,,bool,Activate routine to estimate renewable capacities -- from_opsd,--,bool,Add renewable capacities from `OPSD database `_. The value is depreciated but still can be used. -- year,--,bool,Renewable capacities are based on existing capacities reported by IRENA (IRENASTAT) for the specified year -- expansion_limit,--,float or false,"Artificially limit maximum IRENA capacities to a factor. For example, an ``expansion_limit: 1.1`` means 110% of capacities . If false are chosen, the estimated renewable potentials determine by the workflow are used." -- technology_mapping,,,Mapping between PyPSA-Eur and powerplantmatching technology names --- -- Offshore,--,"Any subset of {offwind-ac, offwind-dc}","List of PyPSA-Eur carriers that is considered as (IRENA, OPSD) onshore technology." +-- -- Offshore,--,"Any subset of {offwind-ac, offwind-dc, offwind-float}","List of PyPSA-Eur carriers that is considered as (IRENA, OPSD) onshore technology." -- -- Offshore,--,{onwind},"List of PyPSA-Eur carriers that is considered as (IRENA, OPSD) offshore technology." -- -- PV,--,{solar},"List of PyPSA-Eur carriers that is considered as (IRENA, OPSD) PV technology." autarky,,, diff --git a/doc/configtables/enable.csv b/doc/configtables/enable.csv index 1e5571b3..c74d0eff 100644 --- a/doc/configtables/enable.csv +++ b/doc/configtables/enable.csv @@ -2,12 +2,8 @@ enable,str or bool,"{auto, true, false}","Switch to include (true) or exclude (false) the retrieve_* rules of snakemake into the workflow; 'auto' sets true|false based on availability of an internet connection to prevent issues with snakemake failing due to lack of internet connection." prepare_links_p_nom,bool,"{true, false}","Switch to retrieve current HVDC projects from `Wikipedia `_" retrieve_databundle,bool,"{true, false}","Switch to retrieve databundle from zenodo via the rule :mod:`retrieve_databundle` or whether to keep a custom databundle located in the corresponding folder." -retrieve_sector_databundle,bool,"{true, false}","Switch to retrieve sector databundle from zenodo via the rule :mod:`retrieve_sector_databundle` or whether to keep a custom databundle located in the corresponding folder." retrieve_cost_data,bool,"{true, false}","Switch to retrieve technology cost data from `technology-data repository `_." build_cutout,bool,"{true, false}","Switch to enable the building of cutouts via the rule :mod:`build_cutout`." -retrieve_irena,bool,"{true, false}",Switch to enable the retrieval of ``existing_capacities`` from IRENASTAT with :mod:`retrieve_irena`. retrieve_cutout,bool,"{true, false}","Switch to enable the retrieval of cutouts from zenodo with :mod:`retrieve_cutout`." -build_natura_raster,bool,"{true, false}","Switch to enable the creation of the raster ``natura.tiff`` via the rule :mod:`build_natura_raster`." -retrieve_natura_raster,bool,"{true, false}","Switch to enable the retrieval of ``natura.tiff`` from zenodo with :mod:`retrieve_natura_raster`." custom_busmap,bool,"{true, false}","Switch to enable the use of custom busmaps in rule :mod:`cluster_network`. If activated the rule looks for provided busmaps at ``data/custom_busmap_elec_s{simpl}_{clusters}.csv`` which should have the same format as ``resources/busmap_elec_s{simpl}_{clusters}.csv``, i.e. the index should contain the buses of ``networks/elec_s{simpl}.nc``." drop_leap_day,bool,"{true, false}","Switch to drop February 29 from all time-dependent data in leap years" diff --git a/doc/configtables/industry.csv b/doc/configtables/industry.csv index d1b560ed..4187e118 100644 --- a/doc/configtables/industry.csv +++ b/doc/configtables/industry.csv @@ -16,6 +16,9 @@ petrochemical_process _emissions,MtCO2/a,float,The emission of petrochemical pro HVC_primary_fraction,--,float,The fraction of high value chemicals (HVC) produced via primary route HVC_mechanical_recycling _fraction,--,float,The fraction of high value chemicals (HVC) produced using mechanical recycling HVC_chemical_recycling _fraction,--,float,The fraction of high value chemicals (HVC) produced using chemical recycling +HVC_environment_sequestration_fraction,--,float,The fraction of high value chemicals (HVC) put into landfill resulting in additional carbon sequestration. The default value is 0. +waste_to_energy,--,bool,Switch to enable expansion of waste to energy CHPs for conversion of plastics. Default is false. +waste_to_energy_cc,--,bool,Switch to enable expansion of waste to energy CHPs for conversion of plastics with carbon capture. Default is false. ,,, sector_ratios_fraction_future,--,Dictionary with planning horizons as keys.,The fraction of total progress in fuel and process switching achieved in the industry sector. basic_chemicals_without_NH3_production_today,Mt/a,float,"The amount of basic chemicals produced without ammonia (= 86 Mtethylene-equiv - 17 MtNH3)." @@ -29,5 +32,6 @@ MWh_H2_per_tCl,MWhH2/tCl,float,"The energy amount of hydrogen needed to produce methanol_production _today,MtMeOH/a,float,"The amount of methanol produced. From `DECHEMA (2017) `_, page 62" MWh_elec_per_tMeOH,MWh/tMeOH,float,"The energy amount of electricity needed to produce a ton of methanol. From `DECHEMA (2017) `_, Table 14, page 65" MWh_CH4_per_tMeOH,MWhCH4/tMeOH,float,"The energy amount of methane needed to produce a ton of methanol. From `DECHEMA (2017) `_, Table 14, page 65" +MWh_MeOH_per_tMeOH,LHV,float,"The energy amount per ton of methanol. From `DECHEMA (2017) `_, page 74." hotmaps_locate_missing,--,"{true,false}",Locate industrial sites without valid locations based on city and countries. reference_year,year,YYYY,The year used as the baseline for industrial energy demand and production. Data extracted from `JRC-IDEES 2015 `_ diff --git a/doc/configtables/licenses.csv b/doc/configtables/licenses.csv index 37f46cd0..d1fa4aa8 100644 --- a/doc/configtables/licenses.csv +++ b/doc/configtables/licenses.csv @@ -5,10 +5,8 @@ "naturalearth/*",,,,,http://www.naturalearthdata.com/about/terms-of-use/ "NUTS_2013 _60M_SH/*","x","x",,"x",https://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/administrative-units-statistical-units "cantons.csv","x",,"x",,https://en.wikipedia.org/wiki/Data_codes_for_Switzerland -"eia_hydro_annual_generation.csv","x",,,,https://www.eia.gov/about/copyrights_reuse.php -"GEBCO_2014_2D.nc","x",,,,https://www.gebco.net/data_and_products/gridded_bathymetry_data/documents/gebco_2014_historic.pdf +"gebco/GEBCO_2014_2D.nc","x",,,,https://www.gebco.net/data_and_products/gridded_bathymetry_data/documents/gebco_2014_historic.pdf "hydro_capacities.csv","x",,,, "je-e-21.03.02.xls","x","x",,,https://www.bfs.admin.ch/bfs/en/home/fso/swiss-federal-statistical-office/terms-of-use.html "nama_10r_3 gdp.tsv.gz","x",,,"x",https://ec.europa.eu/eurostat/about/policies/copyright "nama_10r_3 popgdp.tsv.gz","x",,,"x",https://ec.europa.eu/eurostat/about/policies/copyright -"time_series_60min _singleindex_filtered.csv","x",,,,https://data.open-power-system-data.org/time_series/2019-06-05/README.md diff --git a/doc/configtables/load.csv b/doc/configtables/load.csv index 34d73dc5..9ebfea32 100644 --- a/doc/configtables/load.csv +++ b/doc/configtables/load.csv @@ -4,4 +4,4 @@ time_shift_for_large_gaps,string,string,"Periods which are used for copying time manual_adjustments,bool,"{true, false}","Whether to adjust the load data manually according to the function in :func:`manual_adjustment`." scaling_factor,--,float,"Global correction factor for the load time series." fixed_year,--,Year or False,"To specify a fixed year for the load time series that deviates from the snapshots' year" -supplement_synthetic,bool,"{true, false}","Whether to supplement missing data for selected time period should be supplemented by synthetic data from https://zenodo.org/record/10820928." +supplement_synthetic,bool,"{true, false}","Whether to supplement missing data for selected time period should be supplemented by synthetic data from https://zenodo.org/records/10820928." diff --git a/doc/configtables/run.csv b/doc/configtables/run.csv index 44f06165..f11a8d96 100644 --- a/doc/configtables/run.csv +++ b/doc/configtables/run.csv @@ -5,5 +5,7 @@ scenarios,,, -- enable,bool,"{true, false}","Switch to select whether workflow should generate scenarios based on ``file``." -- file,str,,"Path to the scenario yaml file. The scenario file contains config overrides for each scenario. In order to be taken account, ``run: scenarios`` has to be set to ``true`` and ``run: name`` has to be a subset of top level keys given in the scenario file. In order to automatically create a `scenario.yaml` file based on a combination of settings, alter and use the ``config/create_scenarios.py`` script in the ``config`` directory." disable_progressbar,bool,"{true, false}","Switch to select whether progressbar should be disabled." -shared_resources,bool/str,,"Switch to select whether resources should be shared across runs. If a string is passed, this is used as a subdirectory name for shared resources. If set to 'base', only resources before creating the elec.nc file are shared." +shared_resources,,, +-- policy,bool/str,,"Boolean switch to select whether resources should be shared across runs. If a string is passed, this is used as a subdirectory name for shared resources. If set to 'base', only resources before creating the elec.nc file are shared." +-- exclude,str,"For the case shared_resources=base, specify additional files that should not be shared across runs." shared_cutouts,bool,"{true, false}","Switch to select whether cutouts should be shared across runs." diff --git a/doc/configtables/sector-opts.csv b/doc/configtables/sector-opts.csv index fc9e8c10..afe631fa 100644 --- a/doc/configtables/sector-opts.csv +++ b/doc/configtables/sector-opts.csv @@ -1,6 +1,6 @@ Trigger, Description, Definition, Status -``nH``, i.e. ``2H``-``6H``, "Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__)", In active use -``Co2L``, Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. If a float is appended an overall emission limit relative to the emission level given in ``electricity: co2base`` is added (e.g. ``Co2L0.05`` limits emissisions to 5% of what is given in ``electricity: co2base``), ``prepare_network``: `add_co2limit() `_ and its `caller `__, In active use +``nH``, i.e. ``2h``-``6h``, "Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__)", In active use +``Co2L`` + ``n``, Add an overall absolute carbon-dioxide emissions limit of ``n`` times of the 1990 base emissions (e.g. ``Co2L0.05`` limits emissisions to 5% of what is calculated in the rule :mod:``prepare_sector_network`` in the function ``co2_emissions_year()``),:mod:``prepare_sector_network`` in the function ``co2_emissions_year()`` , In active use ``carrier+{c|p|m}factor``,"Alter the capital cost (``c``), installable potential (``p``) or marginal costs (``m``) of a carrier by a factor. Example: ``solar+c0.5`` reduces the capital cost of solar to 50\% of original values.", ``prepare_network``, In active use ``T``,Add land transport sector,,In active use ``H``,Add heating sector,,In active use diff --git a/doc/configtables/sector.csv b/doc/configtables/sector.csv index 58ccd9bf..90168888 100644 --- a/doc/configtables/sector.csv +++ b/doc/configtables/sector.csv @@ -24,7 +24,6 @@ bev_dsm,--,"{true, false}",Add the option for battery electric vehicles (BEV) to bev_availability,--,float,The share for battery electric vehicles (BEV) that are able to do demand side management (DSM) bev_energy,--,float,The average size of battery electric vehicles (BEV) in MWh bev_charge_efficiency,--,float,Battery electric vehicles (BEV) charge and discharge efficiency -bev_plug_to_wheel _efficiency,km/kWh,float,The distance battery electric vehicles (BEV) can travel in km per kWh of energy charge in battery. Base value comes from `Tesla Model S `_ bev_charge_rate,MWh,float,The power consumption for one electric vehicle (EV) in MWh. Value derived from 3-phase charger with 11 kW. bev_avail_max,--,float,The maximum share plugged-in availability for passenger electric vehicles. bev_avail_mean,--,float,The average share plugged-in availability for passenger electric vehicles. @@ -32,14 +31,15 @@ v2g,--,"{true, false}",Allows feed-in to grid from EV battery land_transport_fuel_cell _share,--,Dictionary with planning horizons as keys.,The share of vehicles that uses fuel cells in a given year land_transport_electric _share,--,Dictionary with planning horizons as keys.,The share of vehicles that uses electric vehicles (EV) in a given year land_transport_ice _share,--,Dictionary with planning horizons as keys.,The share of vehicles that uses internal combustion engines (ICE) in a given year. What is not EV or FCEV is oil-fuelled ICE. -transport_fuel_cell _efficiency,--,float,The H2 conversion efficiencies of fuel cells in transport -transport_internal _combustion_efficiency,--,float,The oil conversion efficiencies of internal combustion engine (ICE) in transport +transport_electric_efficiency,MWh/100km,float,The conversion efficiencies of electric vehicles in transport +transport_fuel_cell_efficiency,MWh/100km,float,The H2 conversion efficiencies of fuel cells in transport +transport_ice_efficiency,MWh/100km,float,The oil conversion efficiencies of internal combustion engine (ICE) in transport agriculture_machinery _electric_share,--,float,The share for agricultural machinery that uses electricity agriculture_machinery _oil_share,--,float,The share for agricultural machinery that uses oil agriculture_machinery _fuel_efficiency,--,float,The efficiency of electric-powered machinery in the conversion of electricity to meet agricultural needs. agriculture_machinery _electric_efficiency,--,float,The efficiency of oil-powered machinery in the conversion of oil to meet agricultural needs. Mwh_MeOH_per_MWh_H2,LHV,float,"The energy amount of the produced methanol per energy amount of hydrogen. From `DECHEMA (2017) `_, page 64." -MWh_MeOH_per_tCO2,LHV,float,"The energy amount of the produced methanol per ton of CO2. From `DECHEMA (2017) `_, page 64." +MWh_MeOH_per_tCO2,LHV,float,"The energy amount of the produced methanol per ton of CO2. From `DECHEMA (2017) `_, page 66." MWh_MeOH_per_MWh_e,LHV,float,"The energy amount of the produced methanol per energy amount of electricity. From `DECHEMA (2017) `_, page 64." shipping_hydrogen _liquefaction,--,"{true, false}",Whether to include liquefaction costs for hydrogen demand in shipping. ,,, diff --git a/doc/configtables/solving.csv b/doc/configtables/solving.csv index 4d245195..4cfb9065 100644 --- a/doc/configtables/solving.csv +++ b/doc/configtables/solving.csv @@ -4,7 +4,7 @@ options,,, -- load_shedding,bool/float,"{'true','false', float}","Add generators with very high marginal cost to simulate load shedding and avoid problem infeasibilities. If load shedding is a float, it denotes the marginal cost in EUR/kWh." -- noisy_costs,bool,"{'true','false'}","Add random noise to marginal cost of generators by :math:`\mathcal{U}(0.009,0,011)` and capital cost of lines and links by :math:`\mathcal{U}(0.09,0,11)`." -- skip_iterations,bool,"{'true','false'}","Skip iterating, do not update impedances of branches. Defaults to true." --- rolling_horizon,bool,"{'true','false'}","Whether to optimize the network in a rolling horizon manner, where the snapshot range is split into slices of size `horizon` which are solved consecutively." +-- rolling_horizon,bool,"{'true','false'}","Switch for rule :mod:`solve_operations_network` whether to optimize the network in a rolling horizon manner, where the snapshot range is split into slices of size `horizon` which are solved consecutively. This setting has currently no effect on sector-coupled networks." -- seed,--,int,Random seed for increased deterministic behaviour. -- custom_extra_functionality,--,str,Path to a Python file with custom extra functionality code to be injected into the solving rules of the workflow relative to ``rules`` directory. -- io_api,string,"{'lp','mps','direct'}",Passed to linopy and determines the API used to communicate with the solver. With the ``'lp'`` and ``'mps'`` options linopy passes a file to the solver; with the ``'direct'`` option (only supported for HIGHS and Gurobi) linopy uses an in-memory python API resulting in better performance. @@ -14,6 +14,18 @@ options,,, -- transmission_losses,int,[0-9],"Add piecewise linear approximation of transmission losses based on n tangents. Defaults to 0, which means losses are ignored." -- linearized_unit_commitment,bool,"{'true','false'}",Whether to optimise using the linearized unit commitment formulation. -- horizon,--,int,Number of snapshots to consider in each iteration. Defaults to 100. +-- post_discretization,,, +-- -- enable,bool,"{'true','false'}",Switch to enable post-discretization of the network. Disabled by default. +-- -- line_unit_size,MW,float,Discrete unit size of lines in MW. +-- -- line_threshold,,float,The threshold relative to the discrete line unit size beyond which to round up to the next unit. +-- -- link_unit_size,MW,float,Discrete unit size of links in MW by carrier (given in dictionary style). +-- -- -- {carrier},,, +-- -- link_threshold,,float,The threshold relative to the discrete link unit size beyond which to round up to the next unit by carrier (given in dictionary style). +-- -- -- {carrier},,, +agg_p_nom_limits,,,Configure per carrier generator nominal capacity constraints for individual countries if ``'CCL'`` is in ``{opts}`` wildcard. +-- agg_offwind,bool,"{'true','false'}",Aggregate together all the types of offwind when writing the constraint. Default is false. +-- include_existing,bool,"{'true','false'}",Take existing capacities into account when writing the constraint. Default is false. +-- file,file,path,Reference to ``.csv`` file specifying per carrier generator nominal capacity constraints for individual countries and planning horizons. Defaults to ``data/agg_p_nom_minmax.csv``. constraints ,,, -- CCL,bool,"{'true','false'}",Add minimum and maximum levels of generator nominal capacity per carrier for individual countries. These can be specified in the file linked at ``electricity: agg_p_nom_limits`` in the configuration. File defaults to ``data/agg_p_nom_minmax.csv``. -- EQ,bool/string,"{'false',`n(c| )``; i.e. ``0.5``-``0.7c``}",Require each country or node to on average produce a minimal share of its total consumption itself. Example: ``EQ0.5c`` demands each country to produce on average at least 50% of its consumption; ``EQ0.5`` demands each node to produce on average at least 50% of its consumption. diff --git a/doc/configuration.rst b/doc/configuration.rst index d531ee66..8695d4bb 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -31,7 +31,7 @@ Top-level configuration .. _run_cf: ``run`` -======= +============= It is common conduct to analyse energy system optimisation models for **multiple scenarios** for a variety of reasons, e.g. assessing their sensitivity towards changing the temporal and/or geographical resolution or investigating how @@ -174,7 +174,7 @@ Switches for some rules and optional features. :file: configtables/co2_budget.csv .. note:: - this parameter is over-ridden if ``CO2Lx`` or ``cb`` is set in + this parameter is over-ridden if ``Co2Lx`` or ``cb`` is set in sector_opts. .. _electricity_cf: @@ -265,7 +265,7 @@ Define and specify the ``atlite.Cutout`` used for calculating renewable potentia .. literalinclude:: ../config/config.default.yaml :language: yaml :start-at: offwind-dc: - :end-before: solar: + :end-before: offwind-float: .. csv-table:: :header-rows: 1 @@ -273,9 +273,25 @@ Define and specify the ``atlite.Cutout`` used for calculating renewable potentia :file: configtables/offwind-dc.csv .. note:: - both ``offwind-ac`` and ``offwind-dc`` have the same assumption on + Both ``offwind-ac`` and ``offwind-dc`` have the same assumption on ``capacity_per_sqkm`` and ``correction_factor``. +``offwind-float`` +--------------- + +.. literalinclude:: ../config/config.default.yaml + :language: yaml + :start-at: offwind-float: + :end-before: solar: + +.. csv-table:: + :header-rows: 1 + :widths: 22,7,22,33 + :file: configtables/offwind-float.csv + +.. note:: + ``offwind-ac``, ``offwind-dc`` , ``offwind-float`` have the same assumption on + ``capacity_per_sqkm`` and ``correction_factor``. ``solar`` --------------- @@ -534,9 +550,6 @@ The list of available biomass is given by the category in `ENSPRESO_BIOMASS `__. -.. csv-table:: - :header-rows: 1 - :file: configtables/licenses.csv - * BY: Attribute Source * NC: Non-Commercial Use Only * SA: Share Alike -Sector-Coupled Systems Databundle -================================= +.. csv-table:: + :header-rows: 1 + :file: configtables/licenses.csv .. csv-table:: :header-rows: 1 diff --git a/doc/preparation.rst b/doc/preparation.rst index f608e031..06e8b19b 100644 --- a/doc/preparation.rst +++ b/doc/preparation.rst @@ -21,13 +21,11 @@ Having downloaded the necessary data, With these and the externally extracted ENTSO-E online map topology (``data/entsoegridkit``), it can build a base PyPSA network with the following rules: -- :mod:`base_network` builds and stores the base network with all buses, HVAC lines and HVDC links, while -- :mod:`build_bus_regions` determines `Voronoi cells `__ for all substations. +- :mod:`base_network` builds and stores the base network with all buses, HVAC lines and HVDC links, and determines `Voronoi cells `__ for all substations. Then the process continues by calculating conventional power plant capacities, potentials, and per-unit availability time series for variable renewable energy carriers and hydro power plants with the following rules: - :mod:`build_powerplants` for today's thermal power plant capacities using `powerplantmatching `__ allocating these to the closest substation for each powerplant, -- :mod:`build_natura_raster` for rasterising NATURA2000 natural protection areas, - :mod:`build_ship_raster` for building shipping traffic density, - :mod:`build_renewable_profiles` for the hourly capacity factors and installation potentials constrained by land-use in each substation's Voronoi cell for PV, onshore and offshore wind, and - :mod:`build_hydro_profile` for the hourly per-unit hydro power availability time series. @@ -35,13 +33,6 @@ Then the process continues by calculating conventional power plant capacities, p The central rule :mod:`add_electricity` then ties all the different data inputs together into a detailed PyPSA network stored in ``networks/elec.nc``. -.. _busregions: - -Rule ``build_bus_regions`` -============================= - -.. automodule:: build_bus_regions - .. _cutout: Rule ``build_cutout`` @@ -55,14 +46,6 @@ Rule ``prepare_links_p_nom`` .. automodule:: prepare_links_p_nom -.. _natura: - -Rule ``build_natura_raster`` -=============================== - -.. automodule:: build_natura_raster - - .. _base: Rule ``base_network`` diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 712bde49..49249a30 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -9,14 +9,102 @@ Release Notes Upcoming Release ================ + +* Bugfix: Make sure that gas-fired power plants are correctly added as OCGT or + CCGT in :mod:`add_electricity`. Previously they were always added as OCGT. + +* Added default values for power distribution losses, assuming uniform losses of + 3% on distribution grid links (cf. ``sector: transmission_efficiency: + electricity distribution grid: efficiency_static: 0.97``). Since distribution + losses are included in national load reports (cf. `this report + `_), + these are deducted from the national load time series to avoid double counting + of losses. Further extensions to country-specific loss factors and + developments by planning horizon are planned. + +* Doubled solar rooftop potentials to roughly 1 TW for Europe based on `recent + European Commission reports + `_. + +* Remove exogenously set share of rooftop PV (``costs: rooftop_share:``). + Rooftop and utility-scale PV are now largely handled as separate technologies + with endogenous shares. + +* New technology, solar PV with single-axis horizontal tracking (on a N-S axis), + with a carrier called ``solar-hsat`` to the networks. The default option for adding + this technology is set to ``true`` in the ``config.yaml``. + +* The technology-data version was updated to v0.9.0. + +* Bugfix to avoid duplicated offshore regions. + +* Added option ``industry: HVC_environment_sequestration_fraction:`` to specify + the fraction of carbon contained plastics that is permanently sequestered in + landfill. The default assumption is that all carbon contained in plastics is + eventually released to the atmosphere. + +* Added option for building waste-to-energy plants with and without carbon + capture to consume non-recycled and non-sequestered plastics. The config + settings are ``industry: waste_to_energy:`` and ``industry: + waste_to_energy_cc``. This does not include municipal solid waste. + +* Bump minimum ``powerplantmatching`` version to v0.5.15. + +* Add floating wind technology for water depths below 60m + +* Add config ``run: shared_resources: exclude:`` to specify additional files + that should be excluded from shared resources with the setting ``run: + shared_resources: base``. The function ``_helpers/get_run_path()`` now takes + an additional keyword argument ``exclude_from_shared`` with a list of files + that should not be shared. This keyword argument accepts a list of strings + where the string only needs to match the start of a filename (e.g. + ``"transport_data"`` would exclude both ``transport_data.csv`` and + ``transport_data_{simpl}_{clusters}.csv`` from being shared across scenarios. + +* Move switch ``run: shared_resources:`` to ``run: shared_resources: policy:``. + +* Add config land_transport_demand_factor to model growth in land transport demand for different time horizons. + +* Allow dictionary for the config aviation_demand_factor. + +* Add option to post-discretize line and link capacities based on unit sizes and + rounding thresholds specified in the configuration under ``solving: options: + post_discretization:`` when iterative solving is enables (``solving: optiosn: + skip_iterations: false``). This option is disabled by default. + * Group existing capacities to the earlier grouping_year for consistency with optimized capacities. +* Update data bundle: + + - Merge electricity-only and sector-coupled data bundles into `one bundle + `_. This means that the rule + ``retrieve_sector_databundle`` was removed. + + - Include rasterised ``natura.tiff`` in data bundle and remove rule + ``retrieve_natura_raster``. + + - Remove rule ``build_natura_raster`` as this rule is rarely run and increases + the data bundle size considerably. + + - Remove outdated files from data bundle (e.g., Eurostat energy balances) + + - Reduce spatial scope of GEBCO bathymetry data to Europe to save space. + + - Remove the use of a separate data bundle for tutorials. + + - Directly download `Hotmaps Industrial Database + `__ + from source and remove ``Industrial_Database.csv`` from data bundle. + * bugfix: installed heating capacities were 5% lower than existing heating capacities * Include gas and oil fields and saline aquifers in estimation of CO2 sequestration potential. * bugfix: convert Strings to pathlib.Path objects as input to ConfigSettings +* bugfix: fix distinction of temperature-dependent correction factors for the + energy demand of electric vehicles, ICES fuel cell cars. + * Allow the use of more solvers in clustering (Xpress, COPT, Gurobi, CPLEX, SCIP, MOSEK). * Enhanced support for choosing different weather years @@ -172,6 +260,10 @@ Upcoming Release * Bugfix: allow modelling sector-coupled landlocked regions. (Fixed handling of offshore wind.) +* Bugfix: approximation of hydro power generation if Portugal or Spain are not included works now. + +* Bugfix: copy_timeslice does not copy anymore, if country not present in load data. + * Adapt the disabling of transmission expansion in myopic foresight optimisations when limit is already reached to also handle cost limits. * Fix duplicated years and grouping years reference in `add_land_use_constraint_m`. @@ -184,12 +276,43 @@ Upcoming Release * Fix custom busmap read in `cluster_network`. -* Added shapes to .nc file for different stages of the network object in `base_network`, `build_bus_regions`, and `cluster_network`. +* Add `nodal_supply_energy` to `make_summary`. + +* Data on existing renewable capacities is now consistently taken from powerplantmatching (instead of being retrieved separately); the dataset has also been updated to include 2023 values. + +* Added shapes to .nc file for different stages of the network object in `base_network`, `simplify_network`, and `cluster_network`; the `build_bus_regions` rule is now integrated into the `base_network` rule. +* Improved the behaviour of `agg_p_nom_limits`: + + - Moved the associated configuration to `solving`. This allows *Snakemake* to correctly decide which rules to run when the configuration changes. + + - Added the ability to enable aggregation of all *offwind* types (*offwind-ac* and *offwind-dc*) when writing the constraint. + + - Added the possibility to take existing capacities into account when writing the constraint. + + - Added the possibility to have a different file for each planning horizon. * Fix p_nom_min of renewables generators for myopic approach and add check of existing capacities in `add_land_use_constraint_m`. * Add documentation section for how to contribute documentation +* Clarify suffix usage in `add_existing_baseyear`. + +* The ``{sector_opts}`` wildcard is now not used by default. All scenario definitions are now done in the ``config.yaml`` file. + +* Fix gas network retrofitting in `add_brownfield`. + +* Time aggregation for sector-coupled networks have been split into its own rule. When using time step segmentation, time aggregation is constant over planning horizons of the same network. + +* Clarify that the rolling-horizon setting ``solving: rolling_horizon:`` only works for the rule :mod:`solve_operations_network` and not for networks with sector-coupling or investment variables. + +* Fix non steel related coal demand during transition (using `sector_ratios_fraction_future`). + +* Fix fill missing data in `build_industry_sector_ratios_intermediate`. + +* Add methanol consumption in industry as reported in `DECHEMA report + `__ + directly as methanol demand rather than with fixed methane and electricity + demands from today's industry sector ratios. PyPSA-Eur 0.10.0 (19th February 2024) ===================================== @@ -1512,7 +1635,7 @@ This release is known to work with `PyPSA-Eur **Gas Transmission Network** * New rule ``retrieve_gas_infrastructure_data`` that downloads and extracts the - SciGRID_gas `IGGIELGN `__ dataset from + SciGRID_gas `IGGIELGN `__ dataset from zenodo. It includes data on the transmission routes, pipe diameters, capacities, pressure, and whether the pipeline is bidirectional and carries H-Gas or L-Gas. @@ -1672,7 +1795,7 @@ This release is known to work with `PyPSA-Eur PyPSA network. * Updated `data bundle - `__ + `__ that includes the hydrogan salt cavern storage potentials. * Updated and extended documentation in @@ -2032,7 +2155,7 @@ PyPSA-Eur-Sec codebase in Version 0.2.0 above. This model has `its own github repository `__ and is `archived -on Zenodo `__. +on Zenodo `__. @@ -2048,7 +2171,7 @@ European countries with one node per country. It includes demand and supply for electricity, space and water heating in buildings, and land transport. -It is `archived on Zenodo `__. +It is `archived on Zenodo `__. Release Process diff --git a/doc/retrieve.rst b/doc/retrieve.rst index d21a74b4..6b339355 100644 --- a/doc/retrieve.rst +++ b/doc/retrieve.rst @@ -53,32 +53,6 @@ The :ref:`tutorial` uses a smaller cutout than required for the full model (30 M For details see :mod:`build_cutout` and read the `atlite documentation `__. -Rule ``retrieve_natura_raster`` -================================ - -.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.4706686.svg - :target: https://doi.org/10.5281/zenodo.4706686 - -This rule, as a substitute for :mod:`build_natura_raster`, downloads an already rasterized version (`natura.tiff `__) of `Natura 2000 `__ natural protection areas to reduce computation times. The file is placed into the ``resources`` sub-directory. - -**Relevant Settings** - -.. code:: yaml - - enable: - build_natura_raster: - -.. seealso:: - Documentation of the configuration file ``config/config.yaml`` at - :ref:`toplevel_cf` - -**Outputs** - -- ``resources/natura.tiff``: Rasterized version of `Natura 2000 `__ natural protection areas to reduce computation times. - -.. seealso:: - For details see :mod:`build_natura_raster`. - Rule ``retrieve_electricity_demand`` ==================================== @@ -118,11 +92,6 @@ This rule downloads techno-economic assumptions from the `technology-data reposi - ``resources/costs.csv`` -Rule ``retrieve_irena`` -================================ - -.. automodule:: retrieve_irena - Rule ``retrieve_ship_raster`` ================================ @@ -135,14 +104,3 @@ None. **Outputs** - ``data/shipdensity_global.zip`` - - -Rule ``retrieve_sector_databundle`` -==================================== - -.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.5546516.svg - :target: https://doi.org/10.5281/zenodo.5546516 - -In addition to the databundle required for electricity-only studies, -another databundle is required for modelling sector-coupled systems. -The size of this data bundle is around 640 MB. diff --git a/doc/sector.rst b/doc/sector.rst index bdfc5386..e186ccf7 100644 --- a/doc/sector.rst +++ b/doc/sector.rst @@ -183,6 +183,11 @@ Rule ``cluster_gas_network`` .. automodule:: cluster_gas_network +Rule ``time_aggregation`` +============================================================================== + +.. automodule:: time_aggregation + Rule ``prepare_sector_network`` ============================================================================== diff --git a/doc/spatial_resolution.rst b/doc/spatial_resolution.rst index 20158ab6..76228ad8 100644 --- a/doc/spatial_resolution.rst +++ b/doc/spatial_resolution.rst @@ -15,11 +15,11 @@ The total number of nodes for Europe is set in the ``config/config.yaml`` file u Exemplary unsolved network clustered to 512 nodes: -.. image:: ../graphics/elec_s_512.png +.. image:: img/elec_s_512.png Exemplary unsolved network clustered to 37 nodes: -.. image:: ../graphics/elec_s_37.png +.. image:: img/elec_s_37.png The total number of nodes for Europe is set in the ``config/config.yaml`` file under `clusters `__. The number of nodes can vary between 37, the number of independent countries/synchronous areas, and several hundred. With 200-300 nodes, the model needs 100-150 GB RAM to solve with a commercial solver like Gurobi. Not all of the sectors are at the full nodal resolution, and some demand for some sectors is distributed to nodes using heuristics that need to be corrected. Some networks are copper-plated to reduce computational times. diff --git a/doc/supply_demand.rst b/doc/supply_demand.rst index cc598aaf..e5646fcb 100644 --- a/doc/supply_demand.rst +++ b/doc/supply_demand.rst @@ -18,7 +18,7 @@ management, carbon capture and usage/sequestration, and gas networks. The basic supply (left column) and demand (right column) options in the model are described in this figure: -.. image:: ../graphics/multisector_figure.png +.. image:: img/multisector_figure.png .. _Electricity supply and demand: @@ -72,11 +72,11 @@ For every country, heat demand is split between low and high population density Cooling is electrified and is included in the electricity demand. Cooling demand is assumed to remain at current levels. An example of regional distribution of the total heat demand for network 181 regions is depicted below. -.. image:: ../graphics/demand-map-heat.png +.. image:: img/demand-map-heat.png As below figure shows, the current total heat demand in Europe is similar to the total electricity demand but features much more pronounced seasonal variations. The current total building heating demand in Europe adds up to 3084 TWh/a of which 78% occurs in urban areas. -.. image:: ../graphics/Heat_and_el_demand_timeseries.png +.. image:: img/Heat_and_el_demand_timeseries.png In practice, in PyPSA-Eur-Sec, there are heat demand buses to which the corresponding heat demands are added. @@ -269,7 +269,7 @@ The existing European gas transmission network is represented based on the SciGR The following figure shows the unclustered European gas transmission network based on the SciGRID Gas IGGIELGN dataset. Pipelines are color-coded by estimated capacities. Markers indicate entry-points, sites of fossil resource extraction, and LNG terminals. -.. image:: ../graphics/gas_pipeline_figure.png +.. image:: img/gas_pipeline_figure.png .. _Biomass supply: @@ -374,7 +374,7 @@ Where process heat is required, our approach depends on the necessary temperatur The following figure shows the final consumption of energy and non-energy feedstocks in industry today in comparison to the scenario in 2050 assumed in `Neumann et al `__. -.. image:: ../graphics/fec_industry_today_tomorrow.png +.. image:: img/fec_industry_today_tomorrow.png The following figure shows the process emissions in industry today (top bar) and in 2050 without @@ -383,12 +383,12 @@ carbon capture (bottom bar) assumed in `Neumann et al `__, which is illustrated in the figure below. This open database includes georeferenced industrial sites of energy-intensive industry sectors in EU28, including cement, basic chemicals, glass, iron and steel, non-ferrous metals, non-metallic minerals, paper, and refineries subsectors. The use of this spatial dataset enables the calculation of regional and process-specific energy demands. This approach assumes that there will be no significant migration of energy-intensive industries. +Inside each country the industrial demand is then distributed using the `Hotmaps Industrial Database `__, which is illustrated in the figure below. This open database includes georeferenced industrial sites of energy-intensive industry sectors in EU28, including cement, basic chemicals, glass, iron and steel, non-ferrous metals, non-metallic minerals, paper, and refineries subsectors. The use of this spatial dataset enables the calculation of regional and process-specific energy demands. This approach assumes that there will be no significant migration of energy-intensive industries. -.. image:: ../graphics/hotmaps.png +.. image:: img/hotmaps.png .. _Iron and Steel: @@ -459,8 +459,7 @@ Statistics for the production of ammonia, which is commonly used as a fertilizer The Haber-Bosch process is not explicitly represented in the model, such that demand for ammonia enters the model as a demand for hydrogen ( 6.5 MWh :math:`_{H_2}` / t :math:`_{NH_3}` ) and electricity ( 1.17 MWh :math:`_{el}` /t :math:`_{NH_3}` ) (see `Wang et. al `__). Today, natural gas dominates in Europe as the source for the hydrogen used in the Haber-Bosch process, but the model can choose among the various hydrogen supply options described in the hydrogen section (see :ref:`Hydrogen supply`) -The total production and specific energy consumption of chlorine and methanol is taken from a `DECHEMA report `__. According to this source, the production of chlorine amounts to 9.58 MtCl/a, which is assumed to require electricity at 3.6 MWh :math:`_{el}`/t of chlorine and yield hydrogen at 0.937 MWh :math:`_{H_2}`/t of chlorine in the chloralkali process. The production of methanol adds up to 1.5 MtMeOH/a, requiring electricity at 0.167 MWh :math:`_{el}`/t of methanol and methane at 10.25 MWh :math:`_{CH_4}`/t of methanol. - +The total production and specific energy consumption of chlorine and methanol is taken from a `DECHEMA report `__. According to this source, the production of chlorine amounts to 9.58 MtCl/a, which is assumed to require electricity at 3.6 MWh :math:`_{el}`/t of chlorine and yield hydrogen at 0.937 MWh :math:`_{H_2}`/t of chlorine in the chloralkali process. The production of methanol adds up to 1.5 MtMeOH/a. Low-carbon methanol production (or methanolisation) by hydrogenation of :math:`CO_2` requires hydrogen at 6.299 MWh :math:`_{H_2}`/t of methanol, carbon dioxide at 1.373 t :math:`_{CO_2}`/t of methanol and electricity at 1.5 MWh :math:`_{el}`/t of methanol. The energy content of methanol is 5.528 MWh :math:`_{MeOH}`/t of methanol. These values are set exogenously in the config file. The production of ammonia, methanol, and chlorine production is deducted from the JRC IDEES basic chemicals, leaving the production totals of high-value chemicals. For this, we assume that the liquid hydrocarbon feedstock comes from synthetic or fossil- origin naphtha (14 MWh :math:`_{naphtha}`/t of HVC, similar to `Lechtenböhmer et al `__), ignoring the methanol-to-olefin route. Furthermore, we assume the following transformations of the energy-consuming processes in the production of plastics: the final energy consumption in steam processing is converted to methane since requires temperature above 500 °C (4.1 MWh :math:`_{CH_4}` /t of HVC, see `Rehfeldt et al. `__); and the remaining processes are electrified using the current efficiency of microwave for high-enthalpy heat processing, electric furnaces, electric process cooling and electric generic processes (2.85 MWh :math:`_{el}`/t of HVC). @@ -573,7 +572,7 @@ The `demand for aviation `__. +Shipping energy demand is covered by a combination of oil, hydrogen and methanol. Other fuel options, like ammonia, are currently not included in PyPSA-Eur-Sec. The share of shipping that is assumed to be supplied by hydrogen or methanol can be selected in the `config file `__. To estimate the `hydrogen demand `__, the average fuel efficiency of the fleet is used in combination with the efficiency of the fuel cell defined in the technology-data repository. The average fuel efficiency is set in the `config file `__. @@ -581,6 +580,8 @@ The consumed hydrogen comes from the general hydrogen bus where it can be produc The energy demand for liquefaction of the hydrogen used for shipping can be `included `__. If this option is selected, liquifaction will happen at the `node where the shipping demand occurs `__. +The consumed methanol comes from the general methanol bus where it is produced through methanolisation (see :ref:`Chemicals Industry`). + .. _Carbon dioxide capture, usage and sequestration (CCU/S): Carbon dioxide capture, usage and sequestration (CCU/S) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 93bb8e54..bae8e3a3 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -32,10 +32,9 @@ configuration, execute .. code:: bash :class: full-width - snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_Co2L-24H.nc --configfile config/test/config.electricity.yaml + snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_.nc --configfile config/test/config.electricity.yaml -This configuration is set to download a reduced data set via the rules :mod:`retrieve_databundle`, -:mod:`retrieve_natura_raster`, :mod:`retrieve_cutout`. +This configuration is set to download a reduced cutout via the rule :mod:`retrieve_cutout`. For more information on the data dependencies of PyPSA-Eur, continue reading :ref:`data`. How to configure runs? @@ -115,9 +114,9 @@ clustered down to 6 buses and every 24 hours aggregated to one snapshot. The com .. code:: bash - snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_Co2L-24H.nc --configfile config/test/config.electricity.yaml + snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_.nc --configfile config/test/config.electricity.yaml -orders ``snakemake`` to run the rule :mod:`solve_network` that produces the solved network and stores it in ``results/networks`` with the name ``elec_s_6_ec_lcopt_Co2L-24H.nc``: +orders ``snakemake`` to run the rule :mod:`solve_network` that produces the solved network and stores it in ``results/networks`` with the name ``elec_s_6_ec_lcopt_.nc``: .. literalinclude:: ../rules/solve_electricity.smk :start-at: rule solve_network: @@ -133,89 +132,75 @@ This triggers a workflow of multiple preceding jobs that depend on each rule's i graph[bgcolor=white, margin=0]; node[shape=box, style=rounded, fontname=sans, fontsize=10, penwidth=2]; edge[penwidth=2, color=grey]; - 0[label = "solve_network", color = "0.39 0.6 0.85", style="rounded"]; - 1[label = "prepare_network\nll: copt\nopts: Co2L-24H", color = "0.29 0.6 0.85", style="rounded"]; - 2[label = "add_extra_components", color = "0.28 0.6 0.85", style="rounded"]; - 3[label = "cluster_network\nclusters: 6", color = "0.19 0.6 0.85", style="rounded"]; - 4[label = "simplify_network\nsimpl: ", color = "0.01 0.6 0.85", style="rounded"]; - 5[label = "add_electricity", color = "0.49 0.6 0.85", style="rounded"]; - 6[label = "build_renewable_profiles\ntechnology: solar", color = "0.21 0.6 0.85", style="rounded"]; - 7[label = "base_network", color = "0.27 0.6 0.85", style="rounded"]; - 8[label = "build_shapes", color = "0.26 0.6 0.85", style="rounded"]; - 9[label = "retrieve_databundle", color = "0.59 0.6 0.85", style="rounded"]; - 10[label = "retrieve_natura_raster", color = "0.47 0.6 0.85", style="rounded"]; - 11[label = "build_bus_regions", color = "0.13 0.6 0.85", style="rounded"]; - 12[label = "retrieve_cutout\ncutout: be-03-2013-era5", color = "0.36 0.6 0.85", style="rounded,dashed"]; - 13[label = "build_renewable_profiles\ntechnology: onwind", color = "0.21 0.6 0.85", style="rounded"]; - 14[label = "build_renewable_profiles\ntechnology: offwind-ac", color = "0.21 0.6 0.85", style="rounded"]; - 15[label = "build_ship_raster", color = "0.00 0.6 0.85", style="rounded"]; - 16[label = "retrieve_ship_raster", color = "0.51 0.6 0.85", style="rounded,dashed"]; - 17[label = "build_renewable_profiles\ntechnology: offwind-dc", color = "0.21 0.6 0.85", style="rounded"]; - 18[label = "build_line_rating", color = "0.05 0.6 0.85", style="rounded"]; - 19[label = "retrieve_cost_data\nyear: 2030", color = "0.15 0.6 0.85", style="rounded"]; - 20[label = "build_powerplants", color = "0.54 0.6 0.85", style="rounded"]; - 21[label = "build_electricity_demand", color = "0.52 0.6 0.85", style="rounded"]; - 22[label = "retrieve_electricity_demand", color = "0.22 0.6 0.85", style="rounded"]; - 23[label = "copy_config", color = "0.44 0.6 0.85", style="rounded"]; + 0[label = "solve_network", color = "0.38 0.6 0.85", style="rounded"]; + 1[label = "prepare_network\nll: copt", color = "0.53 0.6 0.85", style="rounded"]; + 2[label = "add_extra_components", color = "0.01 0.6 0.85", style="rounded"]; + 3[label = "cluster_network\nclusters: 6", color = "0.03 0.6 0.85", style="rounded"]; + 4[label = "simplify_network\nsimpl: ", color = "0.42 0.6 0.85", style="rounded"]; + 5[label = "add_electricity", color = "0.10 0.6 0.85", style="rounded"]; + 6[label = "build_renewable_profiles\ntechnology: solar", color = "0.50 0.6 0.85", style="rounded"]; + 7[label = "base_network", color = "0.22 0.6 0.85", style="rounded"]; + 8[label = "build_shapes", color = "0.44 0.6 0.85", style="rounded"]; + 9[label = "retrieve_databundle", color = "0.29 0.6 0.85", style="rounded"]; + 10[label = "retrieve_cutout\ncutout: be-03-2013-era5", color = "0.49 0.6 0.85", style="rounded"]; + 11[label = "build_renewable_profiles\ntechnology: onwind", color = "0.50 0.6 0.85", style="rounded"]; + 12[label = "build_renewable_profiles\ntechnology: offwind-ac", color = "0.50 0.6 0.85", style="rounded"]; + 13[label = "build_ship_raster", color = "0.19 0.6 0.85", style="rounded"]; + 14[label = "retrieve_ship_raster", color = "0.35 0.6 0.85", style="rounded"]; + 15[label = "build_renewable_profiles\ntechnology: offwind-dc", color = "0.50 0.6 0.85", style="rounded"]; + 16[label = "build_line_rating", color = "0.60 0.6 0.85", style="rounded"]; + 17[label = "retrieve_cost_data\nyear: 2030", color = "0.59 0.6 0.85", style="rounded"]; + 18[label = "build_powerplants", color = "0.06 0.6 0.85", style="rounded"]; + 19[label = "build_electricity_demand", color = "0.13 0.6 0.85", style="rounded"]; + 20[label = "retrieve_electricity_demand", color = "0.49 0.6 0.85", style="rounded"]; + 21[label = "retrieve_synthetic_electricity_demand", color = "0.41 0.6 0.85", style="rounded"]; 1 -> 0 - 23 -> 0 2 -> 1 - 19 -> 1 + 17 -> 1 3 -> 2 - 19 -> 2 + 17 -> 2 4 -> 3 - 19 -> 3 + 17 -> 3 5 -> 4 - 19 -> 4 - 11 -> 4 + 17 -> 4 + 7 -> 4 6 -> 5 - 13 -> 5 - 14 -> 5 - 17 -> 5 + 11 -> 5 + 12 -> 5 + 15 -> 5 7 -> 5 + 16 -> 5 + 17 -> 5 18 -> 5 19 -> 5 - 11 -> 5 - 20 -> 5 - 9 -> 5 - 21 -> 5 8 -> 5 7 -> 6 9 -> 6 - 10 -> 6 8 -> 6 - 11 -> 6 - 12 -> 6 + 10 -> 6 8 -> 7 9 -> 8 - 8 -> 11 7 -> 11 - 7 -> 13 - 9 -> 13 + 9 -> 11 + 8 -> 11 + 10 -> 11 + 7 -> 12 + 9 -> 12 + 13 -> 12 + 8 -> 12 + 10 -> 12 + 14 -> 13 10 -> 13 - 8 -> 13 - 11 -> 13 - 12 -> 13 - 7 -> 14 - 9 -> 14 - 10 -> 14 - 15 -> 14 - 8 -> 14 - 11 -> 14 - 12 -> 14 - 16 -> 15 - 12 -> 15 - 7 -> 17 - 9 -> 17 - 10 -> 17 - 15 -> 17 - 8 -> 17 - 11 -> 17 - 12 -> 17 + 7 -> 15 + 9 -> 15 + 13 -> 15 + 8 -> 15 + 10 -> 15 + 7 -> 16 + 10 -> 16 7 -> 18 - 12 -> 18 - 7 -> 20 - 22 -> 21 + 20 -> 19 + 21 -> 19 } | @@ -226,28 +211,28 @@ In the terminal, this will show up as a list of jobs to be run: Building DAG of jobs... Job stats: - job count - --------------------------- ------- - add_electricity 1 - add_extra_components 1 - base_network 1 - build_bus_regions 1 - build_electricity_demand 1 - build_line_rating 1 - build_powerplants 1 - build_renewable_profiles 4 - build_shapes 1 - build_ship_raster 1 - cluster_network 1 - copy_config 1 - prepare_network 1 - retrieve_cost_data 1 - retrieve_databundle 1 - retrieve_electricity_demand 1 - retrieve_natura_raster 1 - simplify_network 1 - solve_network 1 - total 22 + job count + ------------------------------------- ------- + add_electricity 1 + add_extra_components 1 + base_network 1 + build_electricity_demand 1 + build_line_rating 1 + build_powerplants 1 + build_renewable_profiles 4 + build_shapes 1 + build_ship_raster 1 + cluster_network 1 + prepare_network 1 + retrieve_cost_data 1 + retrieve_cutout 1 + retrieve_databundle 1 + retrieve_electricity_demand 1 + retrieve_ship_raster 1 + retrieve_synthetic_electricity_demand 1 + simplify_network 1 + solve_network 1 + total 22 ``snakemake`` then runs these jobs in the correct order. @@ -283,7 +268,7 @@ For example, you can explore the evolution of the PyPSA networks by running #. ``snakemake resources/networks/elec.nc -call --configfile config/test/config.electricity.yaml`` #. ``snakemake resources/networks/elec_s.nc -call --configfile config/test/config.electricity.yaml`` #. ``snakemake resources/networks/elec_s_6.nc -call --configfile config/test/config.electricity.yaml`` -#. ``snakemake resources/networks/elec_s_6_ec_lcopt_Co2L-24H.nc -call --configfile config/test/config.electricity.yaml`` +#. ``snakemake resources/networks/elec_s_6_ec_lcopt_.nc -call --configfile config/test/config.electricity.yaml`` To run all combinations of wildcard values provided in the ``config/config.yaml`` under ``scenario:``, you can use the collection rule ``solve_elec_networks``. @@ -321,6 +306,6 @@ Jupyter Notebooks). import pypsa - n = pypsa.Network("results/networks/elec_s_6_ec_lcopt_Co2L-24H.nc") + n = pypsa.Network("results/networks/elec_s_6_ec_lcopt_.nc") For inspiration, read the `examples section in the PyPSA documentation `__. diff --git a/doc/tutorial_sector.rst b/doc/tutorial_sector.rst index a1556150..70943ab0 100644 --- a/doc/tutorial_sector.rst +++ b/doc/tutorial_sector.rst @@ -74,7 +74,6 @@ which were already included in the electricity-only tutorial: base_network 1 build_ammonia_production 1 build_biomass_potentials 1 - build_bus_regions 1 build_clustered_population_layouts 1 build_cop_profiles 1 build_daily_heat_demand 1 @@ -83,6 +82,7 @@ which were already included in the electricity-only tutorial: build_energy_totals 1 build_gas_input_locations 1 build_gas_network 1 + build_heat_totals 1 build_hourly_heat_demand 1 build_industrial_distribution_key 1 build_industrial_energy_demand_per_country_today 1 @@ -94,19 +94,19 @@ which were already included in the electricity-only tutorial: build_industry_sector_ratios 1 build_industry_sector_ratios_intermediate 1 build_population_layouts 1 - build_population_weighted_energy_totals 1 + build_population_weighted_energy_totals 2 build_powerplants 1 - build_renewable_profiles 4 + build_renewable_profiles 5 build_salt_cavern_potentials 1 build_shapes 1 build_ship_raster 1 build_shipping_demand 1 build_simplified_population_layouts 1 + build_solar_thermal_profiles 3 build_temperature_profiles 3 build_transport_demand 1 cluster_gas_network 1 cluster_network 1 - copy_config 1 make_summary 1 plot_gas_network 1 plot_hydrogen_network 1 @@ -116,14 +116,17 @@ which were already included in the electricity-only tutorial: prepare_network 1 prepare_sector_network 1 retrieve_cost_data 1 + retrieve_cutout 1 retrieve_databundle 1 retrieve_electricity_demand 1 + retrieve_eurostat_data 1 retrieve_gas_infrastructure_data 1 - retrieve_natura_raster 1 - retrieve_sector_databundle 1 + retrieve_ship_raster 1 + retrieve_synthetic_electricity_demand 1 simplify_network 1 solve_sector_network 1 - total 60 + time_aggregation 1 + total 67 This covers the retrieval of additional raw data from online resources and preprocessing data about the transport, industry, and heating sectors as well as @@ -142,234 +145,203 @@ successfully. graph[bgcolor=white, margin=0]; node[shape=box, style=rounded, fontname=sans, fontsize=10, penwidth=2]; edge[penwidth=2, color=grey]; - 0[label = "all", color = "0.55 0.6 0.85", style="rounded"]; - 1[label = "plot_summary", color = "0.31 0.6 0.85", style="rounded"]; - 2[label = "make_summary", color = "0.37 0.6 0.85", style="rounded"]; - 3[label = "plot_power_network_clustered", color = "0.50 0.6 0.85", style="rounded"]; - 4[label = "cluster_network\nclusters: 5", color = "0.62 0.6 0.85", style="rounded"]; - 5[label = "simplify_network\nsimpl: ", color = "0.18 0.6 0.85", style="rounded"]; - 6[label = "add_electricity", color = "0.33 0.6 0.85", style="rounded"]; - 7[label = "build_renewable_profiles\ntechnology: solar", color = "0.20 0.6 0.85", style="rounded"]; - 8[label = "base_network", color = "0.31 0.6 0.85", style="rounded"]; - 9[label = "build_shapes", color = "0.36 0.6 0.85", style="rounded"]; - 10[label = "retrieve_databundle", color = "0.29 0.6 0.85", style="rounded"]; - 11[label = "retrieve_natura_raster", color = "0.01 0.6 0.85", style="rounded"]; - 12[label = "build_bus_regions", color = "0.10 0.6 0.85", style="rounded"]; - 13[label = "retrieve_cutout\ncutout: be-03-2013-era5", color = "0.37 0.6 0.85", style="rounded,dashed"]; - 14[label = "build_renewable_profiles\ntechnology: onwind", color = "0.20 0.6 0.85", style="rounded"]; - 15[label = "build_renewable_profiles\ntechnology: offwind-ac", color = "0.20 0.6 0.85", style="rounded"]; - 16[label = "build_ship_raster", color = "0.64 0.6 0.85", style="rounded"]; - 17[label = "retrieve_ship_raster", color = "0.64 0.6 0.85", style="rounded,dashed"]; - 18[label = "build_renewable_profiles\ntechnology: offwind-dc", color = "0.20 0.6 0.85", style="rounded"]; - 19[label = "retrieve_cost_data\nyear: 2030", color = "0.12 0.6 0.85", style="rounded"]; - 20[label = "build_powerplants", color = "0.23 0.6 0.85", style="rounded"]; - 21[label = "build_electricity_demand", color = "0.54 0.6 0.85", style="rounded"]; - 22[label = "retrieve_electricity_demand", color = "0.07 0.6 0.85", style="rounded"]; - 23[label = "solve_sector_network", color = "0.41 0.6 0.85", style="rounded"]; - 24[label = "prepare_sector_network\nsector_opts: CO2L0-24h-T-H-B-I-A-dist1", color = "0.22 0.6 0.85", style="rounded"]; - 25[label = "cluster_gas_network", color = "0.24 0.6 0.85", style="rounded"]; - 26[label = "build_gas_network", color = "0.10 0.6 0.85", style="rounded"]; - 27[label = "retrieve_gas_infrastructure_data", color = "0.17 0.6 0.85", style="rounded"]; - 28[label = "build_gas_input_locations", color = "0.16 0.6 0.85", style="rounded"]; - 29[label = "prepare_network\nll: v1.5\nopts: ", color = "0.49 0.6 0.85", style="rounded"]; - 30[label = "add_extra_components", color = "0.14 0.6 0.85", style="rounded"]; - 31[label = "build_energy_totals", color = "0.39 0.6 0.85", style="rounded"]; - 32[label = "retrieve_sector_databundle", color = "0.58 0.6 0.85", style="rounded"]; - 33[label = "build_population_weighted_energy_totals", color = "0.56 0.6 0.85", style="rounded"]; - 34[label = "build_clustered_population_layouts", color = "0.49 0.6 0.85", style="rounded"]; - 35[label = "build_population_layouts", color = "0.06 0.6 0.85", style="rounded"]; - 36[label = "build_shipping_demand", color = "0.47 0.6 0.85", style="rounded"]; - 37[label = "build_transport_demand", color = "0.45 0.6 0.85", style="rounded"]; - 38[label = "build_temperature_profiles\nscope: total", color = "0.04 0.6 0.85", style="rounded"]; - 39[label = "build_biomass_potentials\nplanning_horizons: 2030", color = "0.11 0.6 0.85", style="rounded"]; - 40[label = "build_salt_cavern_potentials", color = "0.15 0.6 0.85", style="rounded"]; - 41[label = "build_simplified_population_layouts", color = "0.46 0.6 0.85", style="rounded"]; - 42[label = "build_industrial_energy_demand_per_node", color = "0.63 0.6 0.85", style="rounded"]; - 43[label = "build_industry_sector_ratios_intermediate\nplanning_horizons: 2030", color = "0.07 0.6 0.85", style="rounded"]; - 44[label = "build_industry_sector_ratios", color = "0.59 0.6 0.85", style="rounded"]; - 45[label = "build_ammonia_production", color = "0.04 0.6 0.85", style="rounded"]; - 46[label = "build_industrial_energy_demand_per_country_today", color = "0.44 0.6 0.85", style="rounded"]; - 47[label = "build_industrial_production_per_country", color = "0.34 0.6 0.85", style="rounded"]; - 48[label = "build_industrial_production_per_node", color = "0.26 0.6 0.85", style="rounded"]; - 49[label = "build_industrial_distribution_key", color = "0.13 0.6 0.85", style="rounded"]; - 50[label = "build_industrial_production_per_country_tomorrow\nplanning_horizons: 2030", color = "0.32 0.6 0.85", style="rounded"]; - 51[label = "build_industrial_energy_demand_per_node_today", color = "0.48 0.6 0.85", style="rounded"]; - 52[label = "build_hourly_heat_demand", color = "0.28 0.6 0.85", style="rounded"]; - 53[label = "build_daily_heat_demand\nscope: total", color = "0.28 0.6 0.85", style="rounded"]; - 54[label = "build_district_heat_share\nplanning_horizons: 2030", color = "0.52 0.6 0.85", style="rounded"]; - 55[label = "build_temperature_profiles\nscope: rural", color = "0.04 0.6 0.85", style="rounded"]; - 56[label = "build_temperature_profiles\nscope: urban", color = "0.04 0.6 0.85", style="rounded"]; - 57[label = "build_cop_profiles", color = "0.38 0.6 0.85", style="rounded"]; - 58[label = "copy_config", color = "0.19 0.6 0.85", style="rounded"]; - 59[label = "plot_power_network", color = "0.60 0.6 0.85", style="rounded"]; - 60[label = "plot_hydrogen_network", color = "0.27 0.6 0.85", style="rounded"]; - 61[label = "plot_gas_network", color = "0.08 0.6 0.85", style="rounded"]; + 0[label = "all", color = "0.06 0.6 0.85", style="rounded"]; + 1[label = "plot_summary", color = "0.16 0.6 0.85", style="rounded"]; + 2[label = "make_summary", color = "0.57 0.6 0.85", style="rounded"]; + 3[label = "solve_sector_network", color = "0.35 0.6 0.85", style="rounded"]; + 4[label = "prepare_sector_network", color = "0.36 0.6 0.85", style="rounded"]; + 5[label = "build_renewable_profiles", color = "0.12 0.6 0.85", style="rounded"]; + 6[label = "base_network", color = "0.45 0.6 0.85", style="rounded"]; + 7[label = "build_shapes", color = "0.66 0.6 0.85", style="rounded"]; + 8[label = "retrieve_databundle", color = "0.28 0.6 0.85", style="rounded"]; + 9[label = "build_ship_raster", color = "0.58 0.6 0.85", style="rounded"]; + 10[label = "retrieve_ship_raster", color = "0.50 0.6 0.85", style="rounded"]; + 11[label = "retrieve_cutout", color = "0.34 0.6 0.85", style="rounded"]; + 12[label = "cluster_gas_network", color = "0.09 0.6 0.85", style="rounded"]; + 13[label = "build_gas_network", color = "0.19 0.6 0.85", style="rounded"]; + 14[label = "retrieve_gas_infrastructure_data", color = "0.52 0.6 0.85", style="rounded"]; + 15[label = "cluster_network", color = "0.05 0.6 0.85", style="rounded"]; + 16[label = "simplify_network", color = "0.50 0.6 0.85", style="rounded"]; + 17[label = "add_electricity", color = "0.32 0.6 0.85", style="rounded"]; + 18[label = "retrieve_cost_data", color = "0.39 0.6 0.85", style="rounded"]; + 19[label = "build_powerplants", color = "0.33 0.6 0.85", style="rounded"]; + 20[label = "build_electricity_demand", color = "0.31 0.6 0.85", style="rounded"]; + 21[label = "retrieve_electricity_demand", color = "0.23 0.6 0.85", style="rounded"]; + 22[label = "retrieve_synthetic_electricity_demand", color = "0.16 0.6 0.85", style="rounded"]; + 23[label = "build_gas_input_locations", color = "0.62 0.6 0.85", style="rounded"]; + 24[label = "time_aggregation", color = "0.28 0.6 0.85", style="rounded"]; + 25[label = "prepare_network", color = "0.23 0.6 0.85", style="rounded"]; + 26[label = "add_extra_components", color = "0.21 0.6 0.85", style="rounded"]; + 27[label = "build_hourly_heat_demand", color = "0.21 0.6 0.85", style="rounded"]; + 28[label = "build_daily_heat_demand", color = "0.24 0.6 0.85", style="rounded"]; + 29[label = "build_population_layouts", color = "0.33 0.6 0.85", style="rounded"]; + 30[label = "build_solar_thermal_profiles", color = "0.60 0.6 0.85", style="rounded"]; + 31[label = "retrieve_eurostat_data", color = "0.03 0.6 0.85", style="rounded"]; + 32[label = "build_population_weighted_energy_totals", color = "0.11 0.6 0.85", style="rounded"]; + 33[label = "build_energy_totals", color = "0.62 0.6 0.85", style="rounded"]; + 34[label = "build_clustered_population_layouts", color = "0.55 0.6 0.85", style="rounded"]; + 35[label = "build_heat_totals", color = "0.38 0.6 0.85", style="rounded"]; + 36[label = "build_shipping_demand", color = "0.37 0.6 0.85", style="rounded"]; + 37[label = "build_transport_demand", color = "0.44 0.6 0.85", style="rounded"]; + 38[label = "build_temperature_profiles", color = "0.54 0.6 0.85", style="rounded"]; + 39[label = "build_biomass_potentials", color = "0.00 0.6 0.85", style="rounded"]; + 40[label = "build_salt_cavern_potentials", color = "0.61 0.6 0.85", style="rounded"]; + 41[label = "build_simplified_population_layouts", color = "0.40 0.6 0.85", style="rounded"]; + 42[label = "build_industrial_energy_demand_per_node", color = "0.22 0.6 0.85", style="rounded"]; + 43[label = "build_industry_sector_ratios_intermediate", color = "0.65 0.6 0.85", style="rounded"]; + 44[label = "build_industry_sector_ratios", color = "0.57 0.6 0.85", style="rounded"]; + 45[label = "build_ammonia_production", color = "0.01 0.6 0.85", style="rounded"]; + 46[label = "build_industrial_energy_demand_per_country_today", color = "0.01 0.6 0.85", style="rounded"]; + 47[label = "build_industrial_production_per_country", color = "0.59 0.6 0.85", style="rounded"]; + 48[label = "build_industrial_production_per_node", color = "0.47 0.6 0.85", style="rounded"]; + 49[label = "build_industrial_distribution_key", color = "0.09 0.6 0.85", style="rounded"]; + 50[label = "build_industrial_production_per_country_tomorrow", color = "0.43 0.6 0.85", style="rounded"]; + 51[label = "build_industrial_energy_demand_per_node_today", color = "0.64 0.6 0.85", style="rounded"]; + 52[label = "build_district_heat_share", color = "0.38 0.6 0.85", style="rounded"]; + 53[label = "build_cop_profiles", color = "0.14 0.6 0.85", style="rounded"]; + 54[label = "plot_power_network_clustered", color = "0.25 0.6 0.85", style="rounded"]; + 55[label = "plot_power_network", color = "0.65 0.6 0.85", style="rounded"]; + 56[label = "plot_hydrogen_network", color = "0.30 0.6 0.85", style="rounded"]; + 57[label = "plot_gas_network", color = "0.56 0.6 0.85", style="rounded"]; 1 -> 0 2 -> 1 - 32 -> 1 + 31 -> 1 + 8 -> 1 + 57 -> 2 + 18 -> 2 + 55 -> 2 3 -> 2 - 23 -> 2 - 19 -> 2 - 59 -> 2 - 60 -> 2 - 61 -> 2 + 56 -> 2 + 54 -> 2 4 -> 3 + 39 -> 4 + 16 -> 4 + 42 -> 4 + 31 -> 4 + 15 -> 4 + 25 -> 4 + 38 -> 4 + 34 -> 4 + 36 -> 4 + 12 -> 4 + 52 -> 4 + 18 -> 4 + 32 -> 4 5 -> 4 - 19 -> 4 + 30 -> 4 + 40 -> 4 + 24 -> 4 + 33 -> 4 + 53 -> 4 + 41 -> 4 + 23 -> 4 + 8 -> 4 + 37 -> 4 + 27 -> 4 + 11 -> 5 6 -> 5 - 19 -> 5 - 12 -> 5 + 9 -> 5 + 8 -> 5 + 7 -> 5 7 -> 6 - 14 -> 6 - 15 -> 6 - 18 -> 6 - 8 -> 6 - 19 -> 6 - 12 -> 6 - 20 -> 6 - 10 -> 6 - 21 -> 6 - 9 -> 6 8 -> 7 - 10 -> 7 - 11 -> 7 - 9 -> 7 - 12 -> 7 - 13 -> 7 - 9 -> 8 + 11 -> 9 10 -> 9 - 9 -> 12 - 8 -> 12 - 8 -> 14 - 10 -> 14 - 11 -> 14 - 9 -> 14 - 12 -> 14 - 13 -> 14 - 8 -> 15 - 10 -> 15 - 11 -> 15 + 13 -> 12 + 15 -> 12 + 14 -> 13 16 -> 15 - 9 -> 15 - 12 -> 15 - 13 -> 15 + 18 -> 15 + 6 -> 16 17 -> 16 - 13 -> 16 - 8 -> 18 - 10 -> 18 - 11 -> 18 - 16 -> 18 - 9 -> 18 - 12 -> 18 - 13 -> 18 - 8 -> 20 - 22 -> 21 - 24 -> 23 - 58 -> 23 + 18 -> 16 + 20 -> 17 + 6 -> 17 + 18 -> 17 + 5 -> 17 + 19 -> 17 + 7 -> 17 + 6 -> 19 + 21 -> 20 + 22 -> 20 + 14 -> 23 + 15 -> 23 + 30 -> 24 + 27 -> 24 25 -> 24 - 28 -> 24 - 29 -> 24 - 31 -> 24 - 32 -> 24 - 33 -> 24 - 36 -> 24 - 37 -> 24 - 39 -> 24 - 19 -> 24 - 15 -> 24 - 18 -> 24 - 40 -> 24 - 5 -> 24 - 4 -> 24 - 34 -> 24 - 41 -> 24 - 42 -> 24 - 52 -> 24 - 54 -> 24 - 38 -> 24 - 55 -> 24 - 56 -> 24 - 57 -> 24 26 -> 25 - 4 -> 25 - 27 -> 26 - 27 -> 28 - 4 -> 28 - 30 -> 29 - 19 -> 29 - 4 -> 30 - 19 -> 30 - 9 -> 31 - 32 -> 31 + 18 -> 25 + 15 -> 26 + 18 -> 26 + 28 -> 27 + 11 -> 28 + 15 -> 28 + 29 -> 28 + 11 -> 29 + 7 -> 29 + 11 -> 30 + 15 -> 30 + 29 -> 30 + 33 -> 32 + 34 -> 32 + 35 -> 32 31 -> 33 - 34 -> 33 - 35 -> 34 - 4 -> 34 - 13 -> 34 - 9 -> 35 - 13 -> 35 - 9 -> 36 - 4 -> 36 - 31 -> 36 + 7 -> 33 + 8 -> 33 + 11 -> 34 + 15 -> 34 + 29 -> 34 + 33 -> 35 + 33 -> 36 + 7 -> 36 + 15 -> 36 34 -> 37 33 -> 37 - 31 -> 37 32 -> 37 + 8 -> 37 38 -> 37 - 35 -> 38 - 4 -> 38 - 13 -> 38 - 32 -> 39 - 4 -> 39 - 10 -> 39 - 9 -> 39 - 32 -> 40 - 4 -> 40 - 35 -> 41 - 5 -> 41 - 13 -> 41 - 43 -> 42 + 11 -> 38 + 15 -> 38 + 29 -> 38 + 15 -> 39 + 7 -> 39 + 8 -> 39 + 15 -> 40 + 8 -> 40 + 11 -> 41 + 16 -> 41 + 29 -> 41 48 -> 42 51 -> 42 + 43 -> 42 44 -> 43 - 46 -> 43 47 -> 43 + 46 -> 43 45 -> 44 - 32 -> 44 - 32 -> 45 - 32 -> 46 + 8 -> 44 + 8 -> 45 47 -> 46 + 8 -> 46 45 -> 47 - 32 -> 47 - 49 -> 48 + 31 -> 47 + 8 -> 47 50 -> 48 - 4 -> 49 + 49 -> 48 34 -> 49 - 32 -> 49 + 15 -> 49 47 -> 50 49 -> 51 46 -> 51 - 53 -> 52 - 35 -> 53 - 4 -> 53 - 13 -> 53 - 31 -> 54 - 34 -> 54 - 35 -> 55 - 4 -> 55 - 13 -> 55 - 35 -> 56 - 4 -> 56 - 13 -> 56 - 38 -> 57 - 55 -> 57 - 56 -> 57 - 23 -> 59 - 4 -> 59 - 23 -> 60 - 4 -> 60 - 23 -> 61 - 4 -> 61 + 33 -> 52 + 34 -> 52 + 38 -> 53 + 15 -> 54 + 3 -> 55 + 15 -> 55 + 3 -> 56 + 15 -> 56 + 3 -> 57 + 15 -> 57 } | @@ -429,386 +401,222 @@ workflow: graph[bgcolor=white, margin=0]; node[shape=box, style=rounded, fontname=sans, fontsize=10, penwidth=2]; edge[penwidth=2, color=grey]; - 0[label = "all", color = "0.46 0.6 0.85", style="rounded"]; - 1[label = "plot_summary", color = "0.40 0.6 0.85", style="rounded"]; - 2[label = "make_summary", color = "0.59 0.6 0.85", style="rounded"]; - 3[label = "plot_power_network_clustered", color = "0.17 0.6 0.85", style="rounded"]; - 4[label = "cluster_network\nclusters: 5", color = "0.49 0.6 0.85", style="rounded"]; - 5[label = "simplify_network\nsimpl: ", color = "0.16 0.6 0.85", style="rounded"]; - 6[label = "add_electricity", color = "0.32 0.6 0.85", style="rounded"]; - 7[label = "build_renewable_profiles\ntechnology: solar", color = "0.63 0.6 0.85", style="rounded"]; - 8[label = "base_network", color = "0.12 0.6 0.85", style="rounded"]; - 9[label = "build_shapes", color = "0.23 0.6 0.85", style="rounded"]; - 10[label = "retrieve_databundle", color = "0.61 0.6 0.85", style="rounded"]; - 11[label = "retrieve_natura_raster", color = "0.50 0.6 0.85", style="rounded"]; - 12[label = "build_bus_regions", color = "0.51 0.6 0.85", style="rounded"]; - 13[label = "retrieve_cutout\ncutout: be-03-2013-era5", color = "0.37 0.6 0.85", style="rounded,dashed"]; - 14[label = "build_renewable_profiles\ntechnology: onwind", color = "0.63 0.6 0.85", style="rounded"]; - 15[label = "build_renewable_profiles\ntechnology: offwind-ac", color = "0.63 0.6 0.85", style="rounded"]; - 16[label = "build_ship_raster", color = "0.24 0.6 0.85", style="rounded"]; - 17[label = "retrieve_ship_raster", color = "0.14 0.6 0.85", style="rounded,dashed"]; - 18[label = "build_renewable_profiles\ntechnology: offwind-dc", color = "0.63 0.6 0.85", style="rounded"]; - 19[label = "retrieve_cost_data\nyear: 2030", color = "0.04 0.6 0.85", style="rounded"]; - 20[label = "build_powerplants", color = "0.58 0.6 0.85", style="rounded"]; - 21[label = "build_electricity_demand", color = "0.04 0.6 0.85", style="rounded"]; - 22[label = "retrieve_electricity_demand", color = "0.62 0.6 0.85", style="rounded"]; - 23[label = "solve_sector_network_myopic", color = "0.30 0.6 0.85", style="rounded"]; - 24[label = "add_existing_baseyear", color = "0.34 0.6 0.85", style="rounded"]; - 25[label = "prepare_sector_network\nsector_opts: 24h-T-H-B-I-A-dist1", color = "0.42 0.6 0.85", style="rounded"]; - 26[label = "cluster_gas_network", color = "0.39 0.6 0.85", style="rounded"]; - 27[label = "build_gas_network", color = "0.59 0.6 0.85", style="rounded"]; - 28[label = "retrieve_gas_infrastructure_data", color = "0.15 0.6 0.85", style="rounded"]; - 29[label = "build_gas_input_locations", color = "0.07 0.6 0.85", style="rounded"]; - 30[label = "prepare_network\nll: v1.5\nopts: ", color = "0.56 0.6 0.85", style="rounded"]; - 31[label = "add_extra_components", color = "0.11 0.6 0.85", style="rounded"]; - 32[label = "build_energy_totals", color = "0.18 0.6 0.85", style="rounded"]; - 33[label = "retrieve_sector_databundle", color = "0.06 0.6 0.85", style="rounded"]; - 34[label = "build_population_weighted_energy_totals", color = "0.03 0.6 0.85", style="rounded"]; - 35[label = "build_clustered_population_layouts", color = "0.25 0.6 0.85", style="rounded"]; - 36[label = "build_population_layouts", color = "0.57 0.6 0.85", style="rounded"]; - 37[label = "build_shipping_demand", color = "0.45 0.6 0.85", style="rounded"]; - 38[label = "build_transport_demand", color = "0.18 0.6 0.85", style="rounded"]; - 39[label = "build_temperature_profiles\nscope: total", color = "0.54 0.6 0.85", style="rounded"]; - 40[label = "build_biomass_potentials\nplanning_horizons: 2030", color = "0.41 0.6 0.85", style="rounded"]; - 41[label = "build_salt_cavern_potentials", color = "0.02 0.6 0.85", style="rounded"]; - 42[label = "build_simplified_population_layouts", color = "0.15 0.6 0.85", style="rounded"]; - 43[label = "build_industrial_energy_demand_per_node", color = "0.47 0.6 0.85", style="rounded"]; - 44[label = "build_industry_sector_ratios_intermediate\nplanning_horizons: 2030", color = "0.31 0.6 0.85", style="rounded"]; - 45[label = "build_industry_sector_ratios", color = "0.48 0.6 0.85", style="rounded"]; - 46[label = "build_ammonia_production", color = "0.00 0.6 0.85", style="rounded"]; - 47[label = "build_industrial_energy_demand_per_country_today", color = "0.32 0.6 0.85", style="rounded"]; - 48[label = "build_industrial_production_per_country", color = "0.60 0.6 0.85", style="rounded"]; - 49[label = "build_industrial_production_per_node", color = "0.05 0.6 0.85", style="rounded"]; - 50[label = "build_industrial_distribution_key", color = "0.21 0.6 0.85", style="rounded"]; - 51[label = "build_industrial_production_per_country_tomorrow\nplanning_horizons: 2030", color = "0.33 0.6 0.85", style="rounded"]; - 52[label = "build_industrial_energy_demand_per_node_today", color = "0.62 0.6 0.85", style="rounded"]; - 53[label = "build_hourly_heat_demand", color = "0.28 0.6 0.85", style="rounded"]; - 54[label = "build_daily_heat_demand\nscope: total", color = "0.22 0.6 0.85", style="rounded"]; - 55[label = "build_district_heat_share\nplanning_horizons: 2030", color = "0.21 0.6 0.85", style="rounded"]; - 56[label = "build_temperature_profiles\nscope: rural", color = "0.54 0.6 0.85", style="rounded"]; - 57[label = "build_temperature_profiles\nscope: urban", color = "0.54 0.6 0.85", style="rounded"]; - 58[label = "build_cop_profiles", color = "0.52 0.6 0.85", style="rounded"]; - 59[label = "build_existing_heating_distribution", color = "0.09 0.6 0.85", style="rounded"]; - 60[label = "copy_config", color = "0.42 0.6 0.85", style="rounded"]; - 61[label = "solve_sector_network_myopic", color = "0.30 0.6 0.85", style="rounded"]; - 62[label = "add_brownfield", color = "0.10 0.6 0.85", style="rounded"]; - 63[label = "prepare_sector_network\nsector_opts: 24h-T-H-B-I-A-dist1", color = "0.42 0.6 0.85", style="rounded"]; - 64[label = "build_biomass_potentials\nplanning_horizons: 2040", color = "0.41 0.6 0.85", style="rounded"]; - 65[label = "retrieve_cost_data\nyear: 2040", color = "0.04 0.6 0.85", style="rounded"]; - 66[label = "build_industrial_energy_demand_per_node", color = "0.47 0.6 0.85", style="rounded"]; - 67[label = "build_industry_sector_ratios_intermediate\nplanning_horizons: 2040", color = "0.31 0.6 0.85", style="rounded"]; - 68[label = "build_industrial_production_per_node", color = "0.05 0.6 0.85", style="rounded"]; - 69[label = "build_industrial_production_per_country_tomorrow\nplanning_horizons: 2040", color = "0.33 0.6 0.85", style="rounded"]; - 70[label = "build_district_heat_share\nplanning_horizons: 2040", color = "0.21 0.6 0.85", style="rounded"]; - 71[label = "solve_sector_network_myopic", color = "0.30 0.6 0.85", style="rounded"]; - 72[label = "add_brownfield", color = "0.10 0.6 0.85", style="rounded"]; - 73[label = "prepare_sector_network\nsector_opts: 24h-T-H-B-I-A-dist1", color = "0.42 0.6 0.85", style="rounded"]; - 74[label = "build_biomass_potentials\nplanning_horizons: 2050", color = "0.41 0.6 0.85", style="rounded"]; - 75[label = "retrieve_cost_data\nyear: 2050", color = "0.04 0.6 0.85", style="rounded"]; - 76[label = "build_industrial_energy_demand_per_node", color = "0.47 0.6 0.85", style="rounded"]; - 77[label = "build_industry_sector_ratios_intermediate\nplanning_horizons: 2050", color = "0.31 0.6 0.85", style="rounded"]; - 78[label = "build_industrial_production_per_node", color = "0.05 0.6 0.85", style="rounded"]; - 79[label = "build_industrial_production_per_country_tomorrow\nplanning_horizons: 2050", color = "0.33 0.6 0.85", style="rounded"]; - 80[label = "build_district_heat_share\nplanning_horizons: 2050", color = "0.21 0.6 0.85", style="rounded"]; - 81[label = "plot_power_network", color = "0.48 0.6 0.85", style="rounded"]; - 82[label = "plot_power_network", color = "0.48 0.6 0.85", style="rounded"]; - 83[label = "plot_power_network", color = "0.48 0.6 0.85", style="rounded"]; - 84[label = "plot_hydrogen_network", color = "0.37 0.6 0.85", style="rounded"]; - 85[label = "plot_hydrogen_network", color = "0.37 0.6 0.85", style="rounded"]; - 86[label = "plot_hydrogen_network", color = "0.37 0.6 0.85", style="rounded"]; + 0[label = "all", color = "0.10 0.6 0.85", style="rounded"]; + 1[label = "plot_summary", color = "0.56 0.6 0.85", style="rounded"]; + 2[label = "make_summary", color = "0.44 0.6 0.85", style="rounded"]; + 3[label = "solve_sector_network_myopic", color = "0.11 0.6 0.85", style="rounded"]; + 4[label = "add_existing_baseyear", color = "0.24 0.6 0.85", style="rounded"]; + 5[label = "prepare_sector_network", color = "0.26 0.6 0.85", style="rounded"]; + 6[label = "build_renewable_profiles", color = "0.62 0.6 0.85", style="rounded"]; + 7[label = "base_network", color = "0.13 0.6 0.85", style="rounded"]; + 8[label = "build_shapes", color = "0.31 0.6 0.85", style="rounded"]; + 9[label = "retrieve_databundle", color = "0.49 0.6 0.85", style="rounded"]; + 10[label = "build_ship_raster", color = "0.39 0.6 0.85", style="rounded"]; + 11[label = "retrieve_ship_raster", color = "0.61 0.6 0.85", style="rounded"]; + 12[label = "retrieve_cutout", color = "0.65 0.6 0.85", style="rounded"]; + 13[label = "cluster_gas_network", color = "0.05 0.6 0.85", style="rounded"]; + 14[label = "build_gas_network", color = "0.18 0.6 0.85", style="rounded"]; + 15[label = "retrieve_gas_infrastructure_data", color = "0.49 0.6 0.85", style="rounded"]; + 16[label = "cluster_network", color = "0.45 0.6 0.85", style="rounded"]; + 17[label = "simplify_network", color = "0.28 0.6 0.85", style="rounded"]; + 18[label = "add_electricity", color = "0.40 0.6 0.85", style="rounded"]; + 19[label = "retrieve_cost_data", color = "0.66 0.6 0.85", style="rounded"]; + 20[label = "build_powerplants", color = "0.60 0.6 0.85", style="rounded"]; + 21[label = "build_electricity_demand", color = "0.48 0.6 0.85", style="rounded"]; + 22[label = "retrieve_electricity_demand", color = "0.60 0.6 0.85", style="rounded"]; + 23[label = "retrieve_synthetic_electricity_demand", color = "0.09 0.6 0.85", style="rounded"]; + 24[label = "build_gas_input_locations", color = "0.08 0.6 0.85", style="rounded"]; + 25[label = "time_aggregation", color = "0.51 0.6 0.85", style="rounded"]; + 26[label = "prepare_network", color = "0.58 0.6 0.85", style="rounded"]; + 27[label = "add_extra_components", color = "0.25 0.6 0.85", style="rounded"]; + 28[label = "build_hourly_heat_demand", color = "0.06 0.6 0.85", style="rounded"]; + 29[label = "build_daily_heat_demand", color = "0.23 0.6 0.85", style="rounded"]; + 30[label = "build_population_layouts", color = "0.33 0.6 0.85", style="rounded"]; + 31[label = "build_solar_thermal_profiles", color = "0.62 0.6 0.85", style="rounded"]; + 32[label = "retrieve_eurostat_data", color = "0.43 0.6 0.85", style="rounded"]; + 33[label = "build_population_weighted_energy_totals", color = "0.12 0.6 0.85", style="rounded"]; + 34[label = "build_energy_totals", color = "0.17 0.6 0.85", style="rounded"]; + 35[label = "build_clustered_population_layouts", color = "0.59 0.6 0.85", style="rounded"]; + 36[label = "build_heat_totals", color = "0.01 0.6 0.85", style="rounded"]; + 37[label = "build_shipping_demand", color = "0.15 0.6 0.85", style="rounded"]; + 38[label = "build_transport_demand", color = "0.16 0.6 0.85", style="rounded"]; + 39[label = "build_temperature_profiles", color = "0.41 0.6 0.85", style="rounded"]; + 40[label = "build_biomass_potentials", color = "0.53 0.6 0.85", style="rounded"]; + 41[label = "build_salt_cavern_potentials", color = "0.54 0.6 0.85", style="rounded"]; + 42[label = "build_simplified_population_layouts", color = "0.42 0.6 0.85", style="rounded"]; + 43[label = "build_industrial_energy_demand_per_node", color = "0.28 0.6 0.85", style="rounded"]; + 44[label = "build_industry_sector_ratios_intermediate", color = "0.35 0.6 0.85", style="rounded"]; + 45[label = "build_industry_sector_ratios", color = "0.58 0.6 0.85", style="rounded"]; + 46[label = "build_ammonia_production", color = "0.02 0.6 0.85", style="rounded"]; + 47[label = "build_industrial_energy_demand_per_country_today", color = "0.07 0.6 0.85", style="rounded"]; + 48[label = "build_industrial_production_per_country", color = "0.40 0.6 0.85", style="rounded"]; + 49[label = "build_industrial_production_per_node", color = "0.46 0.6 0.85", style="rounded"]; + 50[label = "build_industrial_distribution_key", color = "0.20 0.6 0.85", style="rounded"]; + 51[label = "build_industrial_production_per_country_tomorrow", color = "0.47 0.6 0.85", style="rounded"]; + 52[label = "build_industrial_energy_demand_per_node_today", color = "0.30 0.6 0.85", style="rounded"]; + 53[label = "build_district_heat_share", color = "0.17 0.6 0.85", style="rounded"]; + 54[label = "build_cop_profiles", color = "0.14 0.6 0.85", style="rounded"]; + 55[label = "build_existing_heating_distribution", color = "0.19 0.6 0.85", style="rounded"]; + 56[label = "add_brownfield", color = "0.33 0.6 0.85", style="rounded"]; + 57[label = "plot_power_network_clustered", color = "0.56 0.6 0.85", style="rounded"]; + 58[label = "plot_power_network", color = "0.51 0.6 0.85", style="rounded"]; + 59[label = "plot_hydrogen_network", color = "0.47 0.6 0.85", style="rounded"]; 1 -> 0 + 9 -> 1 + 32 -> 1 2 -> 1 - 33 -> 1 + 58 -> 2 3 -> 2 - 23 -> 2 - 61 -> 2 - 71 -> 2 + 59 -> 2 19 -> 2 - 81 -> 2 - 82 -> 2 - 83 -> 2 - 84 -> 2 - 85 -> 2 - 86 -> 2 + 57 -> 2 + 19 -> 3 4 -> 3 - 5 -> 4 + 56 -> 3 + 17 -> 4 + 35 -> 4 + 16 -> 4 + 20 -> 4 + 54 -> 4 + 55 -> 4 19 -> 4 + 5 -> 4 + 25 -> 5 + 33 -> 5 + 54 -> 5 + 40 -> 5 + 37 -> 5 + 41 -> 5 + 38 -> 5 + 53 -> 5 + 34 -> 5 + 39 -> 5 + 13 -> 5 + 42 -> 5 + 26 -> 5 + 32 -> 5 + 28 -> 5 + 17 -> 5 + 16 -> 5 + 35 -> 5 + 24 -> 5 + 43 -> 5 6 -> 5 + 31 -> 5 + 9 -> 5 19 -> 5 - 12 -> 5 - 7 -> 6 - 14 -> 6 - 15 -> 6 - 18 -> 6 8 -> 6 - 19 -> 6 - 12 -> 6 - 20 -> 6 - 10 -> 6 - 21 -> 6 + 7 -> 6 9 -> 6 + 12 -> 6 + 10 -> 6 8 -> 7 - 10 -> 7 - 11 -> 7 - 9 -> 7 - 12 -> 7 - 13 -> 7 9 -> 8 - 10 -> 9 - 9 -> 12 - 8 -> 12 - 8 -> 14 - 10 -> 14 - 11 -> 14 - 9 -> 14 - 12 -> 14 - 13 -> 14 - 8 -> 15 - 10 -> 15 - 11 -> 15 - 16 -> 15 - 9 -> 15 - 12 -> 15 - 13 -> 15 + 12 -> 10 + 11 -> 10 + 14 -> 13 + 16 -> 13 + 15 -> 14 17 -> 16 - 13 -> 16 + 19 -> 16 + 18 -> 17 + 7 -> 17 + 19 -> 17 8 -> 18 - 10 -> 18 - 11 -> 18 - 16 -> 18 - 9 -> 18 - 12 -> 18 - 13 -> 18 - 8 -> 20 + 21 -> 18 + 7 -> 18 + 20 -> 18 + 19 -> 18 + 6 -> 18 + 7 -> 20 22 -> 21 - 24 -> 23 - 19 -> 23 - 60 -> 23 - 25 -> 24 - 20 -> 24 - 5 -> 24 - 4 -> 24 - 35 -> 24 - 19 -> 24 - 58 -> 24 - 59 -> 24 + 23 -> 21 + 15 -> 24 + 16 -> 24 + 31 -> 25 26 -> 25 - 29 -> 25 - 30 -> 25 - 32 -> 25 - 33 -> 25 - 34 -> 25 - 37 -> 25 - 38 -> 25 - 40 -> 25 - 19 -> 25 - 15 -> 25 - 18 -> 25 - 41 -> 25 - 5 -> 25 - 4 -> 25 - 35 -> 25 - 42 -> 25 - 43 -> 25 - 53 -> 25 - 55 -> 25 - 39 -> 25 - 56 -> 25 - 57 -> 25 - 58 -> 25 + 28 -> 25 + 19 -> 26 27 -> 26 - 4 -> 26 - 28 -> 27 - 28 -> 29 - 4 -> 29 - 31 -> 30 - 19 -> 30 - 4 -> 31 - 19 -> 31 - 9 -> 32 - 33 -> 32 + 19 -> 27 + 16 -> 27 + 29 -> 28 + 12 -> 29 + 16 -> 29 + 30 -> 29 + 12 -> 30 + 8 -> 30 + 12 -> 31 + 16 -> 31 + 30 -> 31 + 34 -> 33 + 36 -> 33 + 35 -> 33 + 9 -> 34 32 -> 34 - 35 -> 34 - 36 -> 35 - 4 -> 35 - 13 -> 35 - 9 -> 36 - 13 -> 36 - 9 -> 37 - 4 -> 37 - 32 -> 37 - 35 -> 38 - 34 -> 38 - 32 -> 38 - 33 -> 38 + 8 -> 34 + 12 -> 35 + 16 -> 35 + 30 -> 35 + 34 -> 36 + 34 -> 37 + 8 -> 37 + 16 -> 37 39 -> 38 - 36 -> 39 - 4 -> 39 - 13 -> 39 - 33 -> 40 - 4 -> 40 - 10 -> 40 + 33 -> 38 + 35 -> 38 + 9 -> 38 + 34 -> 38 + 12 -> 39 + 16 -> 39 + 30 -> 39 9 -> 40 - 33 -> 41 - 4 -> 41 - 36 -> 42 - 5 -> 42 - 13 -> 42 - 44 -> 43 + 8 -> 40 + 16 -> 40 + 9 -> 41 + 16 -> 41 + 12 -> 42 + 17 -> 42 + 30 -> 42 49 -> 43 52 -> 43 + 44 -> 43 45 -> 44 - 47 -> 44 48 -> 44 + 47 -> 44 + 9 -> 45 46 -> 45 - 33 -> 45 - 33 -> 46 - 33 -> 47 + 9 -> 46 + 9 -> 47 48 -> 47 + 9 -> 48 + 32 -> 48 46 -> 48 - 33 -> 48 50 -> 49 51 -> 49 - 4 -> 50 35 -> 50 - 33 -> 50 + 16 -> 50 48 -> 51 - 50 -> 52 47 -> 52 - 54 -> 53 - 36 -> 54 - 4 -> 54 - 13 -> 54 - 32 -> 55 + 50 -> 52 + 34 -> 53 + 35 -> 53 + 39 -> 54 + 53 -> 55 35 -> 55 - 36 -> 56 - 4 -> 56 - 13 -> 56 - 36 -> 57 - 4 -> 57 - 13 -> 57 - 39 -> 58 - 56 -> 58 - 57 -> 58 - 35 -> 59 - 34 -> 59 - 55 -> 59 - 62 -> 61 - 65 -> 61 - 60 -> 61 - 7 -> 62 - 14 -> 62 - 15 -> 62 - 18 -> 62 - 5 -> 62 - 4 -> 62 - 63 -> 62 - 23 -> 62 - 65 -> 62 - 58 -> 62 - 26 -> 63 - 29 -> 63 - 30 -> 63 - 32 -> 63 - 33 -> 63 - 34 -> 63 - 37 -> 63 - 38 -> 63 - 64 -> 63 - 65 -> 63 - 15 -> 63 - 18 -> 63 - 41 -> 63 - 5 -> 63 - 4 -> 63 - 35 -> 63 - 42 -> 63 - 66 -> 63 - 53 -> 63 - 70 -> 63 - 39 -> 63 - 56 -> 63 - 57 -> 63 - 58 -> 63 - 33 -> 64 - 4 -> 64 - 10 -> 64 - 9 -> 64 - 67 -> 66 - 68 -> 66 - 52 -> 66 - 45 -> 67 - 47 -> 67 - 48 -> 67 - 50 -> 68 - 69 -> 68 - 48 -> 69 - 32 -> 70 - 35 -> 70 - 72 -> 71 - 75 -> 71 - 60 -> 71 - 7 -> 72 - 14 -> 72 - 15 -> 72 - 18 -> 72 - 5 -> 72 - 4 -> 72 - 73 -> 72 - 61 -> 72 - 75 -> 72 - 58 -> 72 - 26 -> 73 - 29 -> 73 - 30 -> 73 - 32 -> 73 - 33 -> 73 - 34 -> 73 - 37 -> 73 - 38 -> 73 - 74 -> 73 - 75 -> 73 - 15 -> 73 - 18 -> 73 - 41 -> 73 - 5 -> 73 - 4 -> 73 - 35 -> 73 - 42 -> 73 - 76 -> 73 - 53 -> 73 - 80 -> 73 - 39 -> 73 - 56 -> 73 - 57 -> 73 - 58 -> 73 - 33 -> 74 - 4 -> 74 - 10 -> 74 - 9 -> 74 - 77 -> 76 - 78 -> 76 - 52 -> 76 - 45 -> 77 - 47 -> 77 - 48 -> 77 - 50 -> 78 - 79 -> 78 - 48 -> 79 - 32 -> 80 - 35 -> 80 - 23 -> 81 - 4 -> 81 - 61 -> 82 - 4 -> 82 - 71 -> 83 - 4 -> 83 - 23 -> 84 - 4 -> 84 - 61 -> 85 - 4 -> 85 - 71 -> 86 - 4 -> 86 + 33 -> 55 + 17 -> 56 + 3 -> 56 + 16 -> 56 + 54 -> 56 + 19 -> 56 + 5 -> 56 + 6 -> 56 + 16 -> 57 + 16 -> 58 + 3 -> 58 + 16 -> 59 + 3 -> 59 } | diff --git a/doc/validation.rst b/doc/validation.rst index afe7a7f3..b32a786d 100644 --- a/doc/validation.rst +++ b/doc/validation.rst @@ -29,11 +29,11 @@ Results By the time of writing the comparison with the historical data shows partially accurate, partially improvable results. The following figures show the comparison of the dispatch of the different carriers. -.. image:: ../graphics/validation_seasonal_operation_area_elec_s_37_ec_lv1.0_Ept.png +.. image:: img/validation_seasonal_operation_area_elec_s_37_ec_lv1.0_Ept.png :width: 100% :align: center -.. image:: ../graphics/validation_production_bar_elec_s_37_ec_lv1.0_Ept.png +.. image:: img/validation_production_bar_elec_s_37_ec_lv1.0_Ept.png :width: 100% :align: center diff --git a/doc/wildcards.rst b/doc/wildcards.rst index 1fd1646f..f8e60e20 100644 --- a/doc/wildcards.rst +++ b/doc/wildcards.rst @@ -35,8 +35,8 @@ The ``{technology}`` wildcard The ``{technology}`` wildcard specifies for which renewable energy technology to produce availability time series and potentials using the rule :mod:`build_renewable_profiles`. -It can take the values ``onwind``, ``offwind-ac``, ``offwind-dc``, and ``solar`` but **not** ``hydro`` -(since hydroelectric plant profiles are created by a different rule). +It can take the values ``onwind``, ``offwind-ac``, ``offwind-dc``, ``offwind-float``, and ``solar`` but **not** ``hydro`` +(since hydroelectric plant profiles are created by a different rule)`` .. _simpl: @@ -101,7 +101,7 @@ The ``{opts}`` wildcard The ``{opts}`` wildcard is used for electricity-only studies. It triggers optional constraints, which are activated in either :mod:`prepare_network` or the :mod:`solve_network` step. It may hold multiple triggers separated by ``-``, -i.e. ``Co2L-3H`` contains the ``Co2L`` trigger and the ``3H`` switch. There are +i.e. ``Co2L-3h`` contains the ``Co2L`` trigger and the ``3h`` switch. There are currently: @@ -121,7 +121,7 @@ The ``{sector_opts}`` wildcard # Co2Lx specifies the CO2 target in x% of the 1990 values; default will give default (5%); # Co2L0p25 will give 25% CO2 emissions; Co2Lm0p05 will give 5% negative emissions - # xH is the temporal resolution; 3H is 3-hourly, i.e. one snapshot every 3 hours + # xH is the temporal resolution; 3h is 3-hourly, i.e. one snapshot every 3 hours # single letters are sectors: T for land transport, H for building heating, # B for biomass supply, I for industry, shipping and aviation, # A for agriculture, forestry and fishing diff --git a/envs/environment.fixed.yaml b/envs/environment.fixed.yaml index 8bbd70bf..260c17fd 100644 --- a/envs/environment.fixed.yaml +++ b/envs/environment.fixed.yaml @@ -7,440 +7,466 @@ channels: - bioconda - http://conda.anaconda.org/gurobi - conda-forge -- defaults dependencies: -- _libgcc_mutex=0.1 -- _openmp_mutex=4.5 -- affine=2.4.0 -- alsa-lib=1.2.10 -- ampl-mp=3.1.0 -- amply=0.1.6 -- appdirs=1.4.4 -- asttokens=2.4.1 -- atk-1.0=2.38.0 -- atlite=0.2.12 -- attr=2.5.1 -- attrs=23.2.0 -- aws-c-auth=0.7.15 -- aws-c-cal=0.6.9 -- aws-c-common=0.9.12 -- aws-c-compression=0.2.17 -- aws-c-event-stream=0.4.1 -- aws-c-http=0.8.0 -- aws-c-io=0.14.3 -- aws-c-mqtt=0.10.1 -- aws-c-s3=0.5.0 -- aws-c-sdkutils=0.1.14 -- aws-checksums=0.1.17 -- aws-crt-cpp=0.26.1 -- aws-sdk-cpp=1.11.242 -- azure-core-cpp=1.10.3 -- azure-storage-blobs-cpp=12.10.0 -- azure-storage-common-cpp=12.5.0 -- beautifulsoup4=4.12.3 -- blosc=1.21.5 -- bokeh=3.3.4 -- bottleneck=1.3.7 -- branca=0.7.1 -- brotli=1.1.0 -- brotli-bin=1.1.0 -- brotli-python=1.1.0 -- bzip2=1.0.8 -- c-ares=1.26.0 -- c-blosc2=2.13.2 -- ca-certificates=2024.2.2 -- cairo=1.18.0 -- cartopy=0.22.0 -- cdsapi=0.6.1 -- certifi=2024.2.2 -- cffi=1.16.0 -- cfgv=3.3.1 -- cfitsio=4.3.1 -- cftime=1.6.3 -- charset-normalizer=3.3.2 -- click=8.1.7 -- click-plugins=1.1.1 -- cligj=0.7.2 -- cloudpickle=3.0.0 -- coin-or-cbc=2.10.10 -- coin-or-cgl=0.60.7 -- coin-or-clp=1.17.8 -- coin-or-osi=0.108.8 -- coin-or-utils=2.11.9 -- coincbc=2.10.10 -- colorama=0.4.6 -- configargparse=1.7 -- connection_pool=0.0.3 -- contourpy=1.2.0 -- country_converter=1.2 -- cppad=20240000.2 -- cycler=0.12.1 -- cytoolz=0.12.3 -- dask=2024.2.0 -- dask-core=2024.2.0 -- datrie=0.8.2 -- dbus=1.13.6 -- decorator=5.1.1 -- deprecation=2.1.0 -- descartes=1.1.0 -- distlib=0.3.8 -- distributed=2024.2.0 -- distro=1.9.0 -- docutils=0.20.1 -- dpath=2.1.6 -- entsoe-py=0.6.6 -- et_xmlfile=1.1.0 -- exceptiongroup=1.2.0 -- executing=2.0.1 -- expat=2.5.0 -- filelock=3.13.1 -- fiona=1.9.5 -- folium=0.15.1 -- font-ttf-dejavu-sans-mono=2.37 -- font-ttf-inconsolata=3.000 -- font-ttf-source-code-pro=2.038 -- font-ttf-ubuntu=0.83 -- fontconfig=2.14.2 -- fonts-conda-ecosystem=1 -- fonts-conda-forge=1 -- fonttools=4.49.0 -- freetype=2.12.1 -- freexl=2.0.0 -- fribidi=1.0.10 -- fsspec=2024.2.0 -- gdal=3.8.4 -- gdk-pixbuf=2.42.10 -- geographiclib=1.52 -- geojson-rewind=1.1.0 -- geopandas=0.14.3 -- geopandas-base=0.14.3 -- geopy=2.4.1 -- geos=3.12.1 -- geotiff=1.7.1 -- gettext=0.21.1 -- gflags=2.2.2 -- giflib=5.2.1 -- gitdb=4.0.11 -- gitpython=3.1.42 -- glib=2.78.4 -- glib-tools=2.78.4 -- glog=0.6.0 -- glpk=5.0 -- gmp=6.3.0 -- graphite2=1.3.13 -- graphviz=9.0.0 -- gst-plugins-base=1.22.9 -- gstreamer=1.22.9 -- gtk2=2.24.33 -- gts=0.7.6 -- harfbuzz=8.3.0 -- hdf4=4.2.15 -- hdf5=1.14.3 -- humanfriendly=10.0 -- icu=73.2 -- identify=2.5.35 -- idna=3.6 -- importlib-metadata=7.0.1 -- importlib_metadata=7.0.1 -- importlib_resources=6.1.1 -- iniconfig=2.0.0 -- ipopt=3.14.14 -- ipython=8.21.0 -- jedi=0.19.1 -- jinja2=3.1.3 -- joblib=1.3.2 -- json-c=0.17 -- jsonschema=4.21.1 -- jsonschema-specifications=2023.12.1 -- jupyter_core=5.7.1 -- kealib=1.5.3 -- keyutils=1.6.1 -- kiwisolver=1.4.5 -- krb5=1.21.2 -- lame=3.100 -- lcms2=2.16 -- ld_impl_linux-64=2.40 -- lerc=4.0.0 -- libabseil=20230802.1 -- libaec=1.1.2 -- libarchive=3.7.2 -- libarrow=15.0.0 -- libarrow-acero=15.0.0 -- libarrow-dataset=15.0.0 -- libarrow-flight=15.0.0 -- libarrow-flight-sql=15.0.0 -- libarrow-gandiva=15.0.0 -- libarrow-substrait=15.0.0 -- libblas=3.9.0 -- libboost-headers=1.84.0 -- libbrotlicommon=1.1.0 -- libbrotlidec=1.1.0 -- libbrotlienc=1.1.0 -- libcap=2.69 -- libcblas=3.9.0 -- libclang=15.0.7 -- libclang13=15.0.7 -- libcrc32c=1.1.2 -- libcups=2.3.3 -- libcurl=8.5.0 -- libdeflate=1.19 -- libedit=3.1.20191231 -- libev=4.33 -- libevent=2.1.12 -- libexpat=2.5.0 -- libffi=3.4.2 -- libflac=1.4.3 -- libgcc-ng=13.2.0 -- libgcrypt=1.10.3 -- libgd=2.3.3 -- libgdal=3.8.4 -- libgfortran-ng=13.2.0 -- libgfortran5=13.2.0 -- libglib=2.78.4 -- libgomp=13.2.0 -- libgoogle-cloud=2.12.0 -- libgpg-error=1.47 -- libgrpc=1.60.1 -- libhwloc=2.9.3 -- libiconv=1.17 -- libjpeg-turbo=3.0.0 -- libkml=1.3.0 -- liblapack=3.9.0 -- liblapacke=3.9.0 -- libllvm15=15.0.7 -- libnetcdf=4.9.2 -- libnghttp2=1.58.0 -- libnl=3.9.0 -- libnsl=2.0.1 -- libnuma=2.0.16 -- libogg=1.3.4 -- libopenblas=0.3.26 -- libopus=1.3.1 -- libparquet=15.0.0 -- libpng=1.6.42 -- libpq=16.2 -- libprotobuf=4.25.1 -- libre2-11=2023.06.02 -- librsvg=2.56.3 -- librttopo=1.1.0 -- libscotch=7.0.4 -- libsndfile=1.2.2 -- libspatialindex=1.9.3 -- libspatialite=5.1.0 -- libspral=2023.09.07 -- libsqlite=3.45.1 -- libssh2=1.11.0 -- libstdcxx-ng=13.2.0 -- libsystemd0=255 -- libthrift=0.19.0 -- libtiff=4.6.0 -- libutf8proc=2.8.0 -- libuuid=2.38.1 -- libvorbis=1.3.7 -- libwebp=1.3.2 -- libwebp-base=1.3.2 -- libxcb=1.15 -- libxcrypt=4.4.36 -- libxkbcommon=1.6.0 -- libxml2=2.12.5 -- libxslt=1.1.39 -- libzip=1.10.1 -- libzlib=1.2.13 -- linopy=0.3.4 -- locket=1.0.0 -- lxml=5.1.0 -- lz4=4.3.3 -- lz4-c=1.9.4 -- lzo=2.10 -- mapclassify=2.6.1 -- markupsafe=2.1.5 -- matplotlib=3.8.3 -- matplotlib-base=3.8.3 -- matplotlib-inline=0.1.6 -- memory_profiler=0.61.0 -- metis=5.1.0 -- minizip=4.0.4 -- mpg123=1.32.4 -- msgpack-python=1.0.7 -- mumps-include=5.6.2 -- mumps-seq=5.6.2 -- munkres=1.1.4 -- mysql-common=8.0.33 -- mysql-libs=8.0.33 -- nbformat=5.9.2 -- ncurses=6.4 -- netcdf4=1.6.5 -- networkx=3.2.1 -- nodeenv=1.8.0 -- nomkl=1.0 -- nspr=4.35 -- nss=3.98 -- numexpr=2.9.0 -- numpy=1.26.4 -- openjdk=21.0.2 -- openjpeg=2.5.0 -- openpyxl=3.1.2 -- openssl=3.2.1 -- orc=1.9.2 -- packaging=23.2 -- pandas=2.2.0 -- pango=1.50.14 -- parso=0.8.3 -- partd=1.4.1 -- patsy=0.5.6 -- pcre2=10.42 -- pexpect=4.9.0 -- pickleshare=0.7.5 -- pillow=10.2.0 -- pip=24.0 -- pixman=0.43.2 -- pkgutil-resolve-name=1.3.10 -- plac=1.4.2 -- platformdirs=4.2.0 -- pluggy=1.4.0 -- ply=3.11 -- poppler=24.02.0 -- poppler-data=0.4.12 -- postgresql=16.2 -- powerplantmatching=0.5.11 -- pre-commit=3.6.2 -- progressbar2=4.3.2 -- proj=9.3.1 -- prompt-toolkit=3.0.42 -- psutil=5.9.8 -- pthread-stubs=0.4 -- ptyprocess=0.7.0 -- pulp=2.7.0 -- pulseaudio-client=16.1 -- pure_eval=0.2.2 -- py-cpuinfo=9.0.0 -- pyarrow=15.0.0 -- pyarrow-hotfix=0.6 -- pycountry=22.3.5 -- pycparser=2.21 -- pygments=2.17.2 -- pyomo=6.6.1 -- pyparsing=3.1.1 -- pyproj=3.6.1 -- pypsa=0.27.0 -- pyqt=5.15.9 -- pyqt5-sip=12.12.2 -- pyscipopt=4.4.0 -- pyshp=2.3.1 -- pysocks=1.7.1 -- pytables=3.9.2 -- pytest=8.0.0 -- python=3.11.8 -- python-dateutil=2.8.2 -- python-fastjsonschema=2.19.1 -- python-tzdata=2024.1 -- python-utils=3.8.2 -- python_abi=3.11 -- pytz=2024.1 -- pyxlsb=1.0.10 -- pyyaml=6.0.1 -- qt-main=5.15.8 -- rasterio=1.3.9 -- rdma-core=50.0 -- re2=2023.06.02 -- readline=8.2 -- referencing=0.33.0 -- requests=2.31.0 -- reretry=0.11.8 -- rioxarray=0.15.1 -- rpds-py=0.18.0 -- rtree=1.2.0 -- s2n=1.4.3 -- scikit-learn=1.4.1.post1 -- scip=8.1.0 -- scipy=1.12.0 -- scotch=7.0.4 -- seaborn=0.13.2 -- seaborn-base=0.13.2 -- setuptools=69.1.0 -- setuptools-scm=8.0.4 -- setuptools_scm=8.0.4 -- shapely=2.0.2 -- sip=6.7.12 -- six=1.16.0 -- smart_open=6.4.0 -- smmap=5.0.0 -- snakemake-minimal=7.32.4 -- snappy=1.1.10 -- snuggs=1.4.7 -- sortedcontainers=2.4.0 -- soupsieve=2.5 -- sqlite=3.45.1 -- stack_data=0.6.2 -- statsmodels=0.14.1 -- stopit=1.1.2 -- tabula-py=2.7.0 -- tabulate=0.9.0 -- tbb=2021.11.0 -- tblib=3.0.0 -- threadpoolctl=3.3.0 -- throttler=1.2.2 -- tiledb=2.20.0 -- tk=8.6.13 -- toml=0.10.2 -- tomli=2.0.1 -- toolz=0.12.1 -- toposort=1.10 -- tornado=6.3.3 -- tqdm=4.66.2 -- traitlets=5.14.1 -- typing-extensions=4.9.0 -- typing_extensions=4.9.0 -- tzcode=2024a -- tzdata=2024a -- ucx=1.15.0 -- ukkonen=1.0.1 -- unidecode=1.3.8 -- unixodbc=2.3.12 -- uriparser=0.9.7 -- urllib3=2.2.1 -- validators=0.22.0 -- virtualenv=20.25.0 -- wcwidth=0.2.13 -- wheel=0.42.0 -- wrapt=1.16.0 -- xarray=2024.2.0 -- xcb-util=0.4.0 -- xcb-util-image=0.4.0 -- xcb-util-keysyms=0.4.0 -- xcb-util-renderutil=0.3.9 -- xcb-util-wm=0.4.1 -- xerces-c=3.2.5 -- xkeyboard-config=2.41 -- xlrd=2.0.1 -- xorg-fixesproto=5.0 -- xorg-inputproto=2.3.2 -- xorg-kbproto=1.0.7 -- xorg-libice=1.1.1 -- xorg-libsm=1.2.4 -- xorg-libx11=1.8.7 -- xorg-libxau=1.0.11 -- xorg-libxdmcp=1.1.3 -- xorg-libxext=1.3.4 -- xorg-libxfixes=5.0.3 -- xorg-libxi=1.7.10 -- xorg-libxrender=0.9.11 -- xorg-libxt=1.3.0 -- xorg-libxtst=1.2.3 -- xorg-recordproto=1.14.2 -- xorg-renderproto=0.11.1 -- xorg-xextproto=7.3.0 -- xorg-xf86vidmodeproto=2.3.1 -- xorg-xproto=7.0.31 -- xyzservices=2023.10.1 -- xz=5.2.6 -- yaml=0.2.5 -- yte=1.5.4 -- zict=3.0.0 -- zipp=3.17.0 -- zlib=1.2.13 -- zlib-ng=2.0.7 -- zstd=1.5.5 +- _libgcc_mutex=0.1=conda_forge +- _openmp_mutex=4.5=2_gnu +- affine=2.4.0=pyhd8ed1ab_0 +- alsa-lib=1.2.11=hd590300_1 +- ampl-mp=3.1.0=h2cc385e_1006 +- amply=0.1.6=pyhd8ed1ab_0 +- appdirs=1.4.4=pyh9f0ad1d_0 +- argparse-dataclass=2.0.0=pyhd8ed1ab_0 +- asttokens=2.4.1=pyhd8ed1ab_0 +- atk-1.0=2.38.0=h04ea711_2 +- atlite=0.2.12=pyhd8ed1ab_0 +- attr=2.5.1=h166bdaf_1 +- attrs=23.2.0=pyh71513ae_0 +- aws-c-auth=0.7.18=he0b1f16_0 +- aws-c-cal=0.6.11=heb1d5e4_0 +- aws-c-common=0.9.15=hd590300_0 +- aws-c-compression=0.2.18=hce8ee76_3 +- aws-c-event-stream=0.4.2=h01f5eca_8 +- aws-c-http=0.8.1=hdb68c23_10 +- aws-c-io=0.14.7=hbfbeace_6 +- aws-c-mqtt=0.10.4=h50844eb_0 +- aws-c-s3=0.5.7=h6be9164_2 +- aws-c-sdkutils=0.1.15=hce8ee76_3 +- aws-checksums=0.1.18=hce8ee76_3 +- aws-crt-cpp=0.26.8=h2150271_2 +- aws-sdk-cpp=1.11.267=hddb5a97_7 +- azure-core-cpp=1.11.1=h91d86a7_1 +- azure-identity-cpp=1.6.0=hf1915f5_1 +- azure-storage-blobs-cpp=12.10.0=h00ab1b0_1 +- azure-storage-common-cpp=12.5.0=h94269e2_4 +- beautifulsoup4=4.12.3=pyha770c72_0 +- blosc=1.21.5=hc2324a3_1 +- bokeh=3.4.1=pyhd8ed1ab_0 +- bottleneck=1.3.8=py311h1f0f07a_0 +- branca=0.7.2=pyhd8ed1ab_0 +- brotli=1.1.0=hd590300_1 +- brotli-bin=1.1.0=hd590300_1 +- brotli-python=1.1.0=py311hb755f60_1 +- bzip2=1.0.8=hd590300_5 +- c-ares=1.28.1=hd590300_0 +- c-blosc2=2.14.4=hb4ffafa_1 +- ca-certificates=2024.2.2=hbcca054_0 +- cads-api-client=1.0.0=pyhd8ed1ab_0 +- cairo=1.18.0=h3faef2a_0 +- cartopy=0.23.0=py311h320fe9a_0 +- cdsapi=0.7.0=pyhd8ed1ab_0 +- certifi=2024.2.2=pyhd8ed1ab_0 +- cffi=1.16.0=py311hb3a22ac_0 +- cfgv=3.3.1=pyhd8ed1ab_0 +- cfitsio=4.4.0=hbdc6101_1 +- cftime=1.6.3=py311h1f0f07a_0 +- charset-normalizer=3.3.2=pyhd8ed1ab_0 +- click=8.1.7=unix_pyh707e725_0 +- click-plugins=1.1.1=py_0 +- cligj=0.7.2=pyhd8ed1ab_1 +- cloudpickle=3.0.0=pyhd8ed1ab_0 +- coin-or-cbc=2.10.10=h9002f0b_0 +- coin-or-cgl=0.60.7=h516709c_0 +- coin-or-clp=1.17.8=h1ee7a9c_0 +- coin-or-osi=0.108.10=haf5fa05_0 +- coin-or-utils=2.11.11=hee58242_0 +- coincbc=2.10.10=0_metapackage +- colorama=0.4.6=pyhd8ed1ab_0 +- conda-inject=1.3.1=pyhd8ed1ab_0 +- configargparse=1.7=pyhd8ed1ab_0 +- connection_pool=0.0.3=pyhd3deb0d_0 +- contourpy=1.2.1=py311h9547e67_0 +- country_converter=1.2=pyhd8ed1ab_0 +- cppad=20240000.4=h59595ed_0 +- cycler=0.12.1=pyhd8ed1ab_0 +- cytoolz=0.12.3=py311h459d7ec_0 +- dask=2024.4.2=pyhd8ed1ab_0 +- dask-core=2024.4.2=pyhd8ed1ab_0 +- dask-expr=1.0.14=pyhd8ed1ab_0 +- datrie=0.8.2=py311h459d7ec_7 +- dbus=1.13.6=h5008d03_3 +- decorator=5.1.1=pyhd8ed1ab_0 +- deprecation=2.1.0=pyh9f0ad1d_0 +- descartes=1.1.0=py_4 +- distlib=0.3.8=pyhd8ed1ab_0 +- distributed=2024.4.2=pyhd8ed1ab_0 +- distro=1.9.0=pyhd8ed1ab_0 +- docutils=0.21.2=pyhd8ed1ab_0 +- dpath=2.1.6=pyha770c72_0 +- entsoe-py=0.6.7=pyhd8ed1ab_0 +- et_xmlfile=1.1.0=pyhd8ed1ab_0 +- exceptiongroup=1.2.0=pyhd8ed1ab_2 +- executing=2.0.1=pyhd8ed1ab_0 +- expat=2.6.2=h59595ed_0 +- filelock=3.14.0=pyhd8ed1ab_0 +- fiona=1.9.6=py311hf8e0aa6_0 +- fmt=10.2.1=h00ab1b0_0 +- folium=0.16.0=pyhd8ed1ab_0 +- font-ttf-dejavu-sans-mono=2.37=hab24e00_0 +- font-ttf-inconsolata=3.000=h77eed37_0 +- font-ttf-source-code-pro=2.038=h77eed37_0 +- font-ttf-ubuntu=0.83=h77eed37_2 +- fontconfig=2.14.2=h14ed4e7_0 +- fonts-conda-ecosystem=1=0 +- fonts-conda-forge=1=0 +- fonttools=4.51.0=py311h459d7ec_0 +- freetype=2.12.1=h267a509_2 +- freexl=2.0.0=h743c826_0 +- fribidi=1.0.10=h36c2ea0_0 +- fsspec=2024.3.1=pyhca7485f_0 +- gdal=3.8.5=py311hd032c08_2 +- gdk-pixbuf=2.42.11=hb9ae30d_0 +- geographiclib=2.0=pyhd8ed1ab_0 +- geojson-rewind=1.1.0=pyhd8ed1ab_0 +- geopandas=0.14.4=pyhd8ed1ab_0 +- geopandas-base=0.14.4=pyha770c72_0 +- geopy=2.4.1=pyhd8ed1ab_1 +- geos=3.12.1=h59595ed_0 +- geotiff=1.7.1=h6cf1f90_16 +- gettext=0.22.5=h59595ed_2 +- gettext-tools=0.22.5=h59595ed_2 +- gflags=2.2.2=he1b5a44_1004 +- giflib=5.2.2=hd590300_0 +- gitdb=4.0.11=pyhd8ed1ab_0 +- gitpython=3.1.43=pyhd8ed1ab_0 +- glib=2.80.0=hf2295e7_6 +- glib-tools=2.80.0=hde27a5a_6 +- glog=0.7.0=hed5481d_0 +- glpk=5.0=h445213a_0 +- gmp=6.3.0=h59595ed_1 +- graphite2=1.3.13=h59595ed_1003 +- graphviz=9.0.0=h78e8752_1 +- gst-plugins-base=1.24.1=hfa15dee_2 +- gstreamer=1.24.1=h98fc4e7_2 +- gtk2=2.24.33=h280cfa0_4 +- gts=0.7.6=h977cf35_4 +- harfbuzz=8.4.0=h3d44ed6_0 +- hdf4=4.2.15=h2a13503_7 +- hdf5=1.14.3=nompi_h4f84152_101 +- humanfriendly=10.0=pyhd8ed1ab_6 +- icu=73.2=h59595ed_0 +- identify=2.5.36=pyhd8ed1ab_0 +- idna=3.7=pyhd8ed1ab_0 +- immutables=0.20=py311h459d7ec_1 +- importlib-metadata=7.1.0=pyha770c72_0 +- importlib_metadata=7.1.0=hd8ed1ab_0 +- importlib_resources=6.4.0=pyhd8ed1ab_0 +- iniconfig=2.0.0=pyhd8ed1ab_0 +- ipopt=3.14.16=hf967516_0 +- ipython=8.22.2=pyh707e725_0 +- jedi=0.19.1=pyhd8ed1ab_0 +- jinja2=3.1.3=pyhd8ed1ab_0 +- joblib=1.4.2=pyhd8ed1ab_0 +- json-c=0.17=h7ab15ed_0 +- jsonschema=4.22.0=pyhd8ed1ab_0 +- jsonschema-specifications=2023.12.1=pyhd8ed1ab_0 +- jupyter_core=5.7.2=py311h38be061_0 +- kealib=1.5.3=h2f55d51_0 +- keyutils=1.6.1=h166bdaf_0 +- kiwisolver=1.4.5=py311h9547e67_1 +- krb5=1.21.2=h659d440_0 +- lame=3.100=h166bdaf_1003 +- lcms2=2.16=hb7c19ff_0 +- ld_impl_linux-64=2.40=h55db66e_0 +- lerc=4.0.0=h27087fc_0 +- libabseil=20240116.2=cxx17_h59595ed_0 +- libaec=1.1.3=h59595ed_0 +- libarchive=3.7.2=h2aa1ff5_1 +- libarrow=15.0.2=hefa796f_6_cpu +- libarrow-acero=15.0.2=hbabe93e_6_cpu +- libarrow-dataset=15.0.2=hbabe93e_6_cpu +- libarrow-flight=15.0.2=hc4f8a93_6_cpu +- libarrow-flight-sql=15.0.2=he4f5ca8_6_cpu +- libarrow-gandiva=15.0.2=hc1954e9_6_cpu +- libarrow-substrait=15.0.2=he4f5ca8_6_cpu +- libasprintf=0.22.5=h661eb56_2 +- libasprintf-devel=0.22.5=h661eb56_2 +- libblas=3.9.0=22_linux64_openblas +- libboost-headers=1.84.0=ha770c72_2 +- libbrotlicommon=1.1.0=hd590300_1 +- libbrotlidec=1.1.0=hd590300_1 +- libbrotlienc=1.1.0=hd590300_1 +- libcap=2.69=h0f662aa_0 +- libcblas=3.9.0=22_linux64_openblas +- libclang-cpp15=15.0.7=default_h127d8a8_5 +- libclang13=18.1.4=default_h5d6823c_0 +- libcrc32c=1.1.2=h9c3ff4c_0 +- libcups=2.3.3=h4637d8d_4 +- libcurl=8.7.1=hca28451_0 +- libdeflate=1.20=hd590300_0 +- libedit=3.1.20191231=he28a2e2_2 +- libev=4.33=hd590300_2 +- libevent=2.1.12=hf998b51_1 +- libexpat=2.6.2=h59595ed_0 +- libffi=3.4.2=h7f98852_5 +- libflac=1.4.3=h59595ed_0 +- libgcc-ng=13.2.0=h77fa898_6 +- libgcrypt=1.10.3=hd590300_0 +- libgd=2.3.3=h119a65a_9 +- libgdal=3.8.5=hf9625ee_2 +- libgettextpo=0.22.5=h59595ed_2 +- libgettextpo-devel=0.22.5=h59595ed_2 +- libgfortran-ng=13.2.0=h69a702a_6 +- libgfortran5=13.2.0=h43f5ff8_6 +- libglib=2.80.0=hf2295e7_6 +- libgomp=13.2.0=h77fa898_6 +- libgoogle-cloud=2.23.0=h9be4e54_1 +- libgoogle-cloud-storage=2.23.0=hc7a4891_1 +- libgpg-error=1.49=h4f305b6_0 +- libgrpc=1.62.2=h15f2491_0 +- libhwloc=2.9.3=default_h554bfaf_1009 +- libiconv=1.17=hd590300_2 +- libjpeg-turbo=3.0.0=hd590300_1 +- libkml=1.3.0=h01aab08_1018 +- liblapack=3.9.0=22_linux64_openblas +- liblapacke=3.9.0=22_linux64_openblas +- libllvm15=15.0.7=hb3ce162_4 +- libllvm16=16.0.6=hb3ce162_3 +- libllvm18=18.1.4=h2448989_0 +- libnetcdf=4.9.2=nompi_h9612171_113 +- libnghttp2=1.58.0=h47da74e_1 +- libnl=3.9.0=hd590300_0 +- libnsl=2.0.1=hd590300_0 +- libogg=1.3.4=h7f98852_1 +- libopenblas=0.3.27=pthreads_h413a1c8_0 +- libopus=1.3.1=h7f98852_1 +- libparquet=15.0.2=hacf5a1f_6_cpu +- libpng=1.6.43=h2797004_0 +- libpq=16.2=h33b98f1_1 +- libprotobuf=4.25.3=h08a7969_0 +- libre2-11=2023.09.01=h5a48ba9_2 +- librsvg=2.58.0=hadf69e7_1 +- librttopo=1.1.0=h8917695_15 +- libscotch=7.0.4=h91e35bf_1 +- libsndfile=1.2.2=hc60ed4a_1 +- libspatialindex=1.9.3=h9c3ff4c_4 +- libspatialite=5.1.0=h6f065fc_5 +- libspral=2024.01.18=h6aa6db2_0 +- libsqlite=3.45.3=h2797004_0 +- libssh2=1.11.0=h0841786_0 +- libstdcxx-ng=13.2.0=hc0a3c3a_6 +- libsystemd0=255=h3516f8a_1 +- libthrift=0.19.0=hb90f79a_1 +- libtiff=4.6.0=h1dd3fc0_3 +- libutf8proc=2.8.0=h166bdaf_0 +- libuuid=2.38.1=h0b41bf4_0 +- libvorbis=1.3.7=h9c3ff4c_0 +- libwebp=1.4.0=h2c329e2_0 +- libwebp-base=1.4.0=hd590300_0 +- libxcb=1.15=h0b41bf4_0 +- libxcrypt=4.4.36=hd590300_1 +- libxkbcommon=1.7.0=h662e7e4_0 +- libxml2=2.12.6=h232c23b_2 +- libxslt=1.1.39=h76b75d6_0 +- libzip=1.10.1=h2629f0a_3 +- libzlib=1.2.13=hd590300_5 +- linopy=0.3.8=pyhd8ed1ab_0 +- locket=1.0.0=pyhd8ed1ab_0 +- lxml=5.2.1=py311hc0a218f_0 +- lz4=4.3.3=py311h38e4bf4_0 +- lz4-c=1.9.4=hcb278e6_0 +- lzo=2.10=hd590300_1001 +- mapclassify=2.6.1=pyhd8ed1ab_0 +- markupsafe=2.1.5=py311h459d7ec_0 +- matplotlib=3.8.4=py311h38be061_0 +- matplotlib-base=3.8.4=py311h54ef318_0 +- matplotlib-inline=0.1.7=pyhd8ed1ab_0 +- memory_profiler=0.61.0=pyhd8ed1ab_0 +- metis=5.1.0=h59595ed_1007 +- minizip=4.0.5=h0ab5242_0 +- mpfr=4.2.1=h9458935_1 +- mpg123=1.32.6=h59595ed_0 +- msgpack-python=1.0.7=py311h9547e67_0 +- multiurl=0.3.1=pyhd8ed1ab_0 +- mumps-include=5.6.2=ha770c72_4 +- mumps-seq=5.6.2=hfef103a_4 +- munkres=1.1.4=pyh9f0ad1d_0 +- mysql-common=8.3.0=hf1915f5_4 +- mysql-libs=8.3.0=hca2cd23_4 +- nbformat=5.10.4=pyhd8ed1ab_0 +- ncurses=6.4.20240210=h59595ed_0 +- netcdf4=1.6.5=nompi_py311he8ad708_100 +- networkx=3.3=pyhd8ed1ab_1 +- nodeenv=1.8.0=pyhd8ed1ab_0 +- nomkl=1.0=h5ca1d4c_0 +- nspr=4.35=h27087fc_0 +- nss=3.98=h1d7d5a4_0 +- numexpr=2.9.0=py311h039bad6_100 +- numpy=1.26.4=py311h64a7726_0 +- openjdk=22.0.1=hb622114_0 +- openjpeg=2.5.2=h488ebb8_0 +- openpyxl=3.1.2=py311h459d7ec_1 +- openssl=3.3.0=hd590300_0 +- orc=2.0.0=h17fec99_1 +- packaging=24.0=pyhd8ed1ab_0 +- pandas=2.2.2=py311h320fe9a_0 +- pango=1.52.2=ha41ecd1_0 +- parso=0.8.4=pyhd8ed1ab_0 +- partd=1.4.1=pyhd8ed1ab_0 +- patsy=0.5.6=pyhd8ed1ab_0 +- pcre2=10.43=hcad00b1_0 +- pexpect=4.9.0=pyhd8ed1ab_0 +- pickleshare=0.7.5=py_1003 +- pillow=10.3.0=py311h18e6fac_0 +- pip=24.0=pyhd8ed1ab_0 +- pixman=0.43.2=h59595ed_0 +- pkgutil-resolve-name=1.3.10=pyhd8ed1ab_1 +- plac=1.4.3=pyhd8ed1ab_0 +- platformdirs=4.2.1=pyhd8ed1ab_0 +- pluggy=1.5.0=pyhd8ed1ab_0 +- ply=3.11=pyhd8ed1ab_2 +- poppler=24.04.0=hb6cd0d7_0 +- poppler-data=0.4.12=hd8ed1ab_0 +- postgresql=16.2=h82ecc9d_1 +- powerplantmatching=0.5.14=pyhd8ed1ab_0 +- pre-commit=3.7.0=pyha770c72_0 +- progressbar2=4.4.2=pyhd8ed1ab_0 +- proj=9.4.0=h1d62c97_1 +- prompt-toolkit=3.0.42=pyha770c72_0 +- psutil=5.9.8=py311h459d7ec_0 +- pthread-stubs=0.4=h36c2ea0_1001 +- ptyprocess=0.7.0=pyhd3deb0d_0 +- pulp=2.8.0=py311h38be061_0 +- pulseaudio-client=17.0=hb77b528_0 +- pure_eval=0.2.2=pyhd8ed1ab_0 +- py-cpuinfo=9.0.0=pyhd8ed1ab_0 +- pyarrow=15.0.2=py311hd5e4297_6_cpu +- pyarrow-hotfix=0.6=pyhd8ed1ab_0 +- pycountry=22.3.5=pyhd8ed1ab_0 +- pycparser=2.22=pyhd8ed1ab_0 +- pygments=2.17.2=pyhd8ed1ab_0 +- pyomo=6.6.1=py311hb755f60_0 +- pyparsing=3.1.2=pyhd8ed1ab_0 +- pyproj=3.6.1=py311hb3a3e68_6 +- pypsa=0.27.1=pyhd8ed1ab_0 +- pyqt=5.15.9=py311hf0fb5b6_5 +- pyqt5-sip=12.12.2=py311hb755f60_5 +- pyscipopt=5.0.1=py311hb755f60_0 +- pyshp=2.3.1=pyhd8ed1ab_0 +- pysocks=1.7.1=pyha2e5f31_6 +- pytables=3.9.2=py311h3e8b7c9_2 +- pytest=8.2.0=pyhd8ed1ab_0 +- python=3.11.9=hb806964_0_cpython +- python-dateutil=2.9.0=pyhd8ed1ab_0 +- python-fastjsonschema=2.19.1=pyhd8ed1ab_0 +- python-tzdata=2024.1=pyhd8ed1ab_0 +- python-utils=3.8.2=pyhd8ed1ab_0 +- python_abi=3.11=4_cp311 +- pytz=2024.1=pyhd8ed1ab_0 +- pyxlsb=1.0.10=pyhd8ed1ab_0 +- pyyaml=6.0.1=py311h459d7ec_1 +- qt-main=5.15.8=hc9dc06e_21 +- rasterio=1.3.10=py311h375a7ea_0 +- rdma-core=51.0=hd3aeb46_0 +- re2=2023.09.01=h7f4b329_2 +- readline=8.2=h8228510_1 +- referencing=0.35.1=pyhd8ed1ab_0 +- requests=2.31.0=pyhd8ed1ab_0 +- reretry=0.11.8=pyhd8ed1ab_0 +- rioxarray=0.15.5=pyhd8ed1ab_0 +- rpds-py=0.18.0=py311h46250e7_0 +- rtree=1.2.0=py311h3bb2b0f_0 +- s2n=1.4.12=h06160fa_0 +- scikit-learn=1.4.2=py311hc009520_0 +- scip=9.0.0=hded5f35_4 +- scipy=1.13.0=py311h64a7726_0 +- scotch=7.0.4=h23d43cc_1 +- seaborn=0.13.2=hd8ed1ab_2 +- seaborn-base=0.13.2=pyhd8ed1ab_2 +- setuptools=69.5.1=pyhd8ed1ab_0 +- setuptools-scm=8.0.4=pyhd8ed1ab_1 +- setuptools_scm=8.0.4=hd8ed1ab_1 +- shapely=2.0.4=py311h2032efe_0 +- sip=6.7.12=py311hb755f60_0 +- six=1.16.0=pyh6c4a22f_0 +- smart_open=7.0.4=pyhd8ed1ab_0 +- smmap=5.0.0=pyhd8ed1ab_0 +- snakemake-interface-common=1.17.2=pyhdfd78af_0 +- snakemake-interface-executor-plugins=9.1.1=pyhdfd78af_0 +- snakemake-interface-report-plugins=1.0.0=pyhdfd78af_0 +- snakemake-interface-storage-plugins=3.2.2=pyhdfd78af_0 +- snakemake-minimal=8.11.1=pyhdfd78af_0 +- snappy=1.2.0=hdb0a2a9_1 +- snuggs=1.4.7=py_0 +- sortedcontainers=2.4.0=pyhd8ed1ab_0 +- soupsieve=2.5=pyhd8ed1ab_1 +- spdlog=1.13.0=hd2e6256_0 +- sqlite=3.45.3=h2c6b66d_0 +- stack_data=0.6.2=pyhd8ed1ab_0 +- statsmodels=0.14.1=py311h1f0f07a_0 +- stopit=1.1.2=py_0 +- tabula-py=2.7.0=py311h38be061_1 +- tabulate=0.9.0=pyhd8ed1ab_1 +- tbb=2021.11.0=h00ab1b0_1 +- tblib=3.0.0=pyhd8ed1ab_0 +- threadpoolctl=3.5.0=pyhc1e730c_0 +- throttler=1.2.2=pyhd8ed1ab_0 +- tiledb=2.22.0=h27f064a_3 +- tk=8.6.13=noxft_h4845f30_101 +- toml=0.10.2=pyhd8ed1ab_0 +- tomli=2.0.1=pyhd8ed1ab_0 +- toolz=0.12.1=pyhd8ed1ab_0 +- toposort=1.10=pyhd8ed1ab_0 +- tornado=6.4=py311h459d7ec_0 +- tqdm=4.66.2=pyhd8ed1ab_0 +- traitlets=5.14.3=pyhd8ed1ab_0 +- typing-extensions=4.11.0=hd8ed1ab_0 +- typing_extensions=4.11.0=pyha770c72_0 +- tzcode=2024a=h3f72095_0 +- tzdata=2024a=h0c530f3_0 +- ucx=1.15.0=ha691c75_8 +- ukkonen=1.0.1=py311h9547e67_4 +- unidecode=1.3.8=pyhd8ed1ab_0 +- unixodbc=2.3.12=h661eb56_0 +- uriparser=0.9.7=h59595ed_1 +- urllib3=2.2.1=pyhd8ed1ab_0 +- validators=0.28.1=pyhd8ed1ab_0 +- virtualenv=20.26.1=pyhd8ed1ab_0 +- wcwidth=0.2.13=pyhd8ed1ab_0 +- wheel=0.43.0=pyhd8ed1ab_1 +- wrapt=1.16.0=py311h459d7ec_0 +- xarray=2024.3.0=pyhd8ed1ab_0 +- xcb-util=0.4.0=hd590300_1 +- xcb-util-image=0.4.0=h8ee46fc_1 +- xcb-util-keysyms=0.4.0=h8ee46fc_1 +- xcb-util-renderutil=0.3.9=hd590300_1 +- xcb-util-wm=0.4.1=h8ee46fc_1 +- xerces-c=3.2.5=hac6953d_0 +- xkeyboard-config=2.41=hd590300_0 +- xlrd=2.0.1=pyhd8ed1ab_3 +- xorg-fixesproto=5.0=h7f98852_1002 +- xorg-inputproto=2.3.2=h7f98852_1002 +- xorg-kbproto=1.0.7=h7f98852_1002 +- xorg-libice=1.1.1=hd590300_0 +- xorg-libsm=1.2.4=h7391055_0 +- xorg-libx11=1.8.9=h8ee46fc_0 +- xorg-libxau=1.0.11=hd590300_0 +- xorg-libxdmcp=1.1.3=h7f98852_0 +- xorg-libxext=1.3.4=h0b41bf4_2 +- xorg-libxfixes=5.0.3=h7f98852_1004 +- xorg-libxi=1.7.10=h7f98852_0 +- xorg-libxrender=0.9.11=hd590300_0 +- xorg-libxt=1.3.0=hd590300_1 +- xorg-libxtst=1.2.3=h7f98852_1002 +- xorg-recordproto=1.14.2=h7f98852_1002 +- xorg-renderproto=0.11.1=h7f98852_1002 +- xorg-xextproto=7.3.0=h0b41bf4_1003 +- xorg-xf86vidmodeproto=2.3.1=h7f98852_1002 +- xorg-xproto=7.0.31=h7f98852_1007 +- xyzservices=2024.4.0=pyhd8ed1ab_0 +- xz=5.2.6=h166bdaf_0 +- yaml=0.2.5=h7f98852_2 +- yte=1.5.4=pyha770c72_0 +- zict=3.0.0=pyhd8ed1ab_0 +- zipp=3.17.0=pyhd8ed1ab_0 +- zlib=1.2.13=hd590300_5 +- zlib-ng=2.0.7=h0b41bf4_0 +- zstd=1.5.5=hfc55251_0 - pip: - highspy==1.5.3 + - oauthlib==3.2.2 + - requests-oauthlib==1.3.1 + - snakemake-executor-plugin-cluster-generic==1.0.9 + - snakemake-executor-plugin-slurm==0.4.5 + - snakemake-executor-plugin-slurm-jobstep==0.2.1 + - snakemake-storage-plugin-http==0.2.3 - tsam==2.3.1 diff --git a/envs/environment.yaml b/envs/environment.yaml index ee1d1605..dc5fad2b 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -11,7 +11,7 @@ dependencies: - pip - atlite>=0.2.9 -- pypsa>=0.26.1 +- pypsa>=0.28 - linopy - dask @@ -20,12 +20,12 @@ dependencies: - openpyxl!=3.1.1 - pycountry - seaborn -- snakemake-minimal>=8.5 +- snakemake-minimal>=8.11 - memory_profiler - yaml - pytables - lxml -- powerplantmatching>=0.5.5,!=0.5.9 +- powerplantmatching>=0.5.15 - numpy - pandas>=2.1 - geopandas>=0.11.0 diff --git a/graphics/elec_s_37.png b/graphics/elec_s_37.png deleted file mode 100644 index 23607334..00000000 Binary files a/graphics/elec_s_37.png and /dev/null differ diff --git a/graphics/elec_s_512.png b/graphics/elec_s_512.png deleted file mode 100644 index f9409a84..00000000 Binary files a/graphics/elec_s_512.png and /dev/null differ diff --git a/graphics/workflow.png b/graphics/workflow.png deleted file mode 100644 index a7fbc5ad..00000000 Binary files a/graphics/workflow.png and /dev/null differ diff --git a/rules/build_electricity.smk b/rules/build_electricity.smk index c074bdbd..6d5a1131 100644 --- a/rules/build_electricity.smk +++ b/rules/build_electricity.smk @@ -86,7 +86,9 @@ rule base_network: offshore_shapes=resources("offshore_shapes.geojson"), europe_shape=resources("europe_shape.geojson"), output: - resources("networks/base.nc"), + base_network=resources("networks/base.nc"), + regions_onshore=resources("regions_onshore.geojson"), + regions_offshore=resources("regions_offshore.geojson"), log: logs("base_network.log"), benchmark: @@ -109,7 +111,7 @@ rule build_shapes: nuts3=ancient("data/bundle/NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp"), nuts3pop=ancient("data/bundle/nama_10r_3popgdp.tsv.gz"), nuts3gdp=ancient("data/bundle/nama_10r_3gdp.tsv.gz"), - ch_cantons=ancient("data/bundle/ch_cantons.csv"), + ch_cantons=ancient("data/ch_cantons.csv"), ch_popgdp=ancient("data/bundle/je-e-21.03.02.xls"), output: country_shapes=resources("country_shapes.geojson"), @@ -127,27 +129,6 @@ rule build_shapes: "../scripts/build_shapes.py" -rule build_bus_regions: - params: - countries=config_provider("countries"), - input: - country_shapes=resources("country_shapes.geojson"), - offshore_shapes=resources("offshore_shapes.geojson"), - base_network=resources("networks/base.nc"), - output: - regions_onshore=resources("regions_onshore.geojson"), - regions_offshore=resources("regions_offshore.geojson"), - log: - logs("build_bus_regions.log"), - threads: 1 - resources: - mem_mb=1000, - conda: - "../envs/environment.yaml" - script: - "../scripts/build_bus_regions.py" - - if config["enable"].get("build_cutout", False): rule build_cutout: @@ -172,27 +153,6 @@ if config["enable"].get("build_cutout", False): "../scripts/build_cutout.py" -if config["enable"].get("build_natura_raster", False): - - rule build_natura_raster: - input: - natura=ancient("data/bundle/natura/Natura2000_end2015.shp"), - cutout=lambda w: "cutouts/" - + CDIR - + config_provider("atlite", "default_cutout")(w) - + ".nc", - output: - resources("natura.tiff"), - resources: - mem_mb=5000, - log: - logs("build_natura_raster.log"), - conda: - "../envs/environment.yaml" - script: - "../scripts/build_natura_raster.py" - - rule build_ship_raster: input: ship_density="data/shipdensity_global.zip", @@ -220,7 +180,7 @@ rule determine_availability_matrix_MD_UA: wdpa="data/WDPA.gpkg", wdpa_marine="data/WDPA_WDOECM_marine.gpkg", gebco=lambda w: ( - "data/bundle/GEBCO_2014_2D.nc" + "data/bundle/gebco/GEBCO_2014_2D.nc" if config_provider("renewable", w.technology)(w).get("max_depth") else [] ), @@ -233,7 +193,7 @@ rule determine_availability_matrix_MD_UA: offshore_shapes=resources("offshore_shapes.geojson"), regions=lambda w: ( resources("regions_onshore.geojson") - if w.technology in ("onwind", "solar") + if w.technology in ("onwind", "solar", "solar-hsat") else resources("regions_offshore.geojson") ), cutout=lambda w: "cutouts/" @@ -276,7 +236,7 @@ rule build_renewable_profiles: base_network=resources("networks/base.nc"), corine=ancient("data/bundle/corine/g250_clc06_V18_5.tif"), natura=lambda w: ( - resources("natura.tiff") + "data/bundle/natura/natura.tiff" if config_provider("renewable", w.technology, "natura")(w) else [] ), @@ -287,8 +247,11 @@ rule build_renewable_profiles: ), gebco=ancient( lambda w: ( - "data/bundle/GEBCO_2014_2D.nc" - if config_provider("renewable", w.technology)(w).get("max_depth") + "data/bundle/gebco/GEBCO_2014_2D.nc" + if ( + config_provider("renewable", w.technology)(w).get("max_depth") + or config_provider("renewable", w.technology)(w).get("min_depth") + ) else [] ) ), @@ -301,7 +264,7 @@ rule build_renewable_profiles: offshore_shapes=resources("offshore_shapes.geojson"), regions=lambda w: ( resources("regions_onshore.geojson") - if w.technology in ("onwind", "solar") + if w.technology in ("onwind", "solar", "solar-hsat") else resources("regions_offshore.geojson") ), cutout=lambda w: "cutouts/" @@ -433,11 +396,11 @@ rule add_electricity: else resources("networks/base.nc") ), tech_costs=lambda w: resources( - f"costs_{config_provider('costs', 'year') (w)}.csv" + f"costs_{config_provider('costs', 'year')(w)}.csv" ), regions=resources("regions_onshore.geojson"), powerplants=resources("powerplants.csv"), - hydro_capacities=ancient("data/bundle/hydro_capacities.csv"), + hydro_capacities=ancient("data/hydro_capacities.csv"), geth_hydro_capacities="data/geth2015_hydro_capacities.csv", unit_commitment="data/unit_commitment.csv", fuel_price=lambda w: ( @@ -478,7 +441,7 @@ rule simplify_network: input: network=resources("networks/elec.nc"), tech_costs=lambda w: resources( - f"costs_{config_provider('costs', 'year') (w)}.csv" + f"costs_{config_provider('costs', 'year')(w)}.csv" ), regions_onshore=resources("regions_onshore.geojson"), regions_offshore=resources("regions_offshore.geojson"), @@ -526,7 +489,7 @@ rule cluster_network: else [] ), tech_costs=lambda w: resources( - f"costs_{config_provider('costs', 'year') (w)}.csv" + f"costs_{config_provider('costs', 'year')(w)}.csv" ), output: network=resources("networks/elec_s{simpl}_{clusters}.nc"), @@ -555,7 +518,7 @@ rule add_extra_components: input: network=resources("networks/elec_s{simpl}_{clusters}.nc"), tech_costs=lambda w: resources( - f"costs_{config_provider('costs', 'year') (w)}.csv" + f"costs_{config_provider('costs', 'year')(w)}.csv" ), output: resources("networks/elec_s{simpl}_{clusters}_ec.nc"), @@ -590,7 +553,7 @@ rule prepare_network: input: resources("networks/elec_s{simpl}_{clusters}_ec.nc"), tech_costs=lambda w: resources( - f"costs_{config_provider('costs', 'year') (w)}.csv" + f"costs_{config_provider('costs', 'year')(w)}.csv" ), co2_price=lambda w: resources("co2_price.csv") if "Ept" in w.opts else [], output: diff --git a/rules/build_sector.smk b/rules/build_sector.smk index e1575a78..86784fe8 100644 --- a/rules/build_sector.smk +++ b/rules/build_sector.smk @@ -287,10 +287,10 @@ rule build_energy_totals: energy=config_provider("energy"), input: nuts3_shapes=resources("nuts3_shapes.geojson"), - co2="data/bundle-sector/eea/UNFCCC_v23.csv", + co2="data/bundle/eea/UNFCCC_v23.csv", swiss="data/switzerland-new_format-all_years.csv", swiss_transport="data/gr-e-11.03.02.01.01-cc.csv", - idees="data/bundle-sector/jrc-idees-2015", + idees="data/bundle/jrc-idees-2015", district_heat_share="data/district_heat_share.csv", eurostat="data/eurostat/eurostat-energy_balances-april_2023_edition", output: @@ -338,10 +338,10 @@ rule build_biomass_potentials: "https://zenodo.org/records/10356004/files/ENSPRESO_BIOMASS.xlsx", keep_local=True, ), - nuts2="data/bundle-sector/nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", # https://gisco-services.ec.europa.eu/distribution/v2/nuts/download/#nuts21 + nuts2="data/bundle/nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", # https://gisco-services.ec.europa.eu/distribution/v2/nuts/download/#nuts21 regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"), nuts3_population=ancient("data/bundle/nama_10r_3popgdp.tsv.gz"), - swiss_cantons=ancient("data/bundle/ch_cantons.csv"), + swiss_cantons=ancient("data/ch_cantons.csv"), swiss_population=ancient("data/bundle/je-e-21.03.02.xls"), country_shapes=resources("country_shapes.geojson"), output: @@ -416,7 +416,7 @@ rule build_sequestration_potentials: rule build_salt_cavern_potentials: input: - salt_caverns="data/bundle-sector/h2_salt_caverns_GWh_per_sqkm.geojson", + salt_caverns="data/bundle/h2_salt_caverns_GWh_per_sqkm.geojson", regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"), regions_offshore=resources("regions_offshore_elec_s{simpl}_{clusters}.geojson"), output: @@ -436,7 +436,7 @@ rule build_salt_cavern_potentials: rule build_ammonia_production: input: - usgs="data/bundle-sector/myb1-2017-nitro.xls", + usgs="data/bundle/myb1-2017-nitro.xls", output: ammonia_production=resources("ammonia_production.csv"), threads: 1 @@ -458,7 +458,7 @@ rule build_industry_sector_ratios: ammonia=config_provider("sector", "ammonia", default=False), input: ammonia_production=resources("ammonia_production.csv"), - idees="data/bundle-sector/jrc-idees-2015", + idees="data/bundle/jrc-idees-2015", output: industry_sector_ratios=resources("industry_sector_ratios.csv"), threads: 1 @@ -508,7 +508,7 @@ rule build_industrial_production_per_country: countries=config_provider("countries"), input: ammonia_production=resources("ammonia_production.csv"), - jrc="data/bundle-sector/jrc-idees-2015", + jrc="data/bundle/jrc-idees-2015", eurostat="data/eurostat/eurostat-energy_balances-april_2023_edition", output: industrial_production_per_country=resources( @@ -564,7 +564,10 @@ rule build_industrial_distribution_key: input: regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"), clustered_pop_layout=resources("pop_layout_elec_s{simpl}_{clusters}.csv"), - hotmaps_industrial_database="data/bundle-sector/Industrial_Database.csv", + hotmaps_industrial_database=storage( + "https://gitlab.com/hotmaps/industrial_sites/industrial_sites_Industrial_Database/-/raw/master/data/Industrial_Database.csv", + keep_local=True, + ), output: industrial_distribution_key=resources( "industrial_distribution_key_elec_s{simpl}_{clusters}.csv" @@ -652,7 +655,7 @@ rule build_industrial_energy_demand_per_country_today: countries=config_provider("countries"), industry=config_provider("industry"), input: - jrc="data/bundle-sector/jrc-idees-2015", + jrc="data/bundle/jrc-idees-2015", industrial_production_per_country=resources( "industrial_production_per_country.csv" ), @@ -704,7 +707,7 @@ rule build_retro_cost: countries=config_provider("countries"), input: building_stock="data/retro/data_building_stock.csv", - data_tabula="data/bundle-sector/retro/tabula-calculator-calcsetbuilding.csv", + data_tabula="data/bundle/retro/tabula-calculator-calcsetbuilding.csv", air_temperature=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"), u_values_PL="data/retro/u_values_poland.csv", tax_w="data/retro/electricity_taxes_eu.csv", @@ -780,8 +783,8 @@ rule build_transport_demand: "pop_weighted_energy_totals_s{simpl}_{clusters}.csv" ), transport_data=resources("transport_data.csv"), - traffic_data_KFZ="data/bundle-sector/emobility/KFZ__count", - traffic_data_Pkw="data/bundle-sector/emobility/Pkw__count", + traffic_data_KFZ="data/bundle/emobility/KFZ__count", + traffic_data_Pkw="data/bundle/emobility/Pkw__count", temp_air_total=resources("temp_air_total_elec_s{simpl}_{clusters}.nc"), output: transport_demand=resources("transport_demand_s{simpl}_{clusters}.csv"), @@ -856,10 +859,44 @@ rule build_existing_heating_distribution: "../scripts/build_existing_heating_distribution.py" +rule time_aggregation: + params: + time_resolution=config_provider("clustering", "temporal", "resolution_sector"), + drop_leap_day=config_provider("enable", "drop_leap_day"), + solver_name=config_provider("solving", "solver", "name"), + input: + network=resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"), + hourly_heat_demand_total=lambda w: ( + resources("hourly_heat_demand_total_elec_s{simpl}_{clusters}.nc") + if config_provider("sector", "heating")(w) + else None + ), + solar_thermal_total=lambda w: ( + resources("solar_thermal_total_elec_s{simpl}_{clusters}.nc") + if config_provider("sector", "solar_thermal")(w) + else None + ), + output: + snapshot_weightings=resources( + "snapshot_weightings_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.csv" + ), + threads: 1 + resources: + mem_mb=5000, + log: + logs("time_aggregation_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.log"), + benchmark: + benchmarks("time_aggregation_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}") + conda: + "../envs/environment.yaml" + script: + "../scripts/time_aggregation.py" + + def input_profile_offwind(w): return { f"profile_{tech}": resources(f"profile_{tech}.nc") - for tech in ["offwind-ac", "offwind-dc"] + for tech in ["offwind-ac", "offwind-dc", "offwind-float"] if (tech in config_provider("electricity", "renewable_carriers")(w)) } @@ -867,7 +904,6 @@ def input_profile_offwind(w): rule prepare_sector_network: params: time_resolution=config_provider("clustering", "temporal", "resolution_sector"), - drop_leap_day=config_provider("enable", "drop_leap_day"), co2_budget=config_provider("co2_budget"), conventional_carriers=config_provider( "existing_capacities", "conventional_carriers" @@ -888,6 +924,9 @@ rule prepare_sector_network: unpack(input_profile_offwind), **rules.cluster_gas_network.output, **rules.build_gas_input_locations.output, + snapshot_weightings=resources( + "snapshot_weightings_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.csv" + ), retro_cost=lambda w: ( resources("retro_cost_elec_s{simpl}_{clusters}.csv") if config_provider("sector", "retrofitting", "retro_endogen")(w) @@ -925,7 +964,7 @@ rule prepare_sector_network: avail_profile=resources("avail_profile_s{simpl}_{clusters}.csv"), dsm_profile=resources("dsm_profile_s{simpl}_{clusters}.csv"), co2_totals_name=resources("co2_totals.csv"), - co2="data/bundle-sector/eea/UNFCCC_v23.csv", + co2="data/bundle/eea/UNFCCC_v23.csv", biomass_potentials=lambda w: ( resources( "biomass_potentials_s{simpl}_{clusters}_" diff --git a/rules/postprocess.smk b/rules/postprocess.smk index e7df2e66..d2da99f9 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -199,6 +199,7 @@ rule make_summary: energy=RESULTS + "csvs/energy.csv", supply=RESULTS + "csvs/supply.csv", supply_energy=RESULTS + "csvs/supply_energy.csv", + nodal_supply_energy=RESULTS + "csvs/nodal_supply_energy.csv", prices=RESULTS + "csvs/prices.csv", weighted_prices=RESULTS + "csvs/weighted_prices.csv", market_values=RESULTS + "csvs/market_values.csv", @@ -230,7 +231,7 @@ rule plot_summary: energy=RESULTS + "csvs/energy.csv", balances=RESULTS + "csvs/supply_energy.csv", eurostat="data/eurostat/eurostat-energy_balances-april_2023_edition", - co2="data/bundle-sector/eea/UNFCCC_v23.csv", + co2="data/bundle/eea/UNFCCC_v23.csv", output: costs=RESULTS + "graphs/costs.pdf", energy=RESULTS + "graphs/energy.pdf", diff --git a/rules/retrieve.smk b/rules/retrieve.smk index 4b244483..d9ba58e2 100644 --- a/rules/retrieve.smk +++ b/rules/retrieve.smk @@ -14,23 +14,27 @@ if config["enable"]["retrieve"] is False: if config["enable"]["retrieve"] and config["enable"].get("retrieve_databundle", True): datafiles = [ - "ch_cantons.csv", "je-e-21.03.02.xls", "eez/World_EEZ_v8_2014.shp", - "hydro_capacities.csv", "naturalearth/ne_10m_admin_0_countries.shp", "NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp", "nama_10r_3popgdp.tsv.gz", "nama_10r_3gdp.tsv.gz", "corine/g250_clc06_V18_5.tif", + "eea/UNFCCC_v23.csv", + "nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", + "myb1-2017-nitro.xls", + "emobility/KFZ__count", + "emobility/Pkw__count", + "h2_salt_caverns_GWh_per_sqkm.geojson", + "natura/natura.tiff", + "gebco/GEBCO_2014_2D.nc", ] - if not config.get("tutorial", False): - datafiles.extend(["natura/Natura2000_end2015.shp", "GEBCO_2014_2D.nc"]) - rule retrieve_databundle: output: protected(expand("data/bundle/{file}", file=datafiles)), + protected(directory("data/bundle/jrc-idees-2015")), log: "logs/retrieve_databundle.log", resources: @@ -41,23 +45,14 @@ if config["enable"]["retrieve"] and config["enable"].get("retrieve_databundle", script: "../scripts/retrieve_databundle.py" - -if config["enable"].get("retrieve_irena"): - - rule retrieve_irena: + rule retrieve_eurostat_data: output: - offwind="data/existing_infrastructure/offwind_capacity_IRENA.csv", - onwind="data/existing_infrastructure/onwind_capacity_IRENA.csv", - solar="data/existing_infrastructure/solar_capacity_IRENA.csv", + directory("data/eurostat/eurostat-energy_balances-april_2023_edition"), log: - "logs/retrieve_irena.log", - resources: - mem_mb=1000, + "logs/retrieve_eurostat_data.log", retries: 2 - conda: - "../envs/retrieve.yaml" script: - "../scripts/retrieve_irena.py" + "../scripts/retrieve_eurostat_data.py" if config["enable"]["retrieve"] and config["enable"].get("retrieve_cutout", True): @@ -65,7 +60,7 @@ if config["enable"]["retrieve"] and config["enable"].get("retrieve_cutout", True rule retrieve_cutout: input: storage( - "https://zenodo.org/record/6382570/files/{cutout}.nc", + "https://zenodo.org/records/6382570/files/{cutout}.nc", ), output: protected("cutouts/" + CDIR + "{cutout}.nc"), @@ -97,64 +92,6 @@ if config["enable"]["retrieve"] and config["enable"].get("retrieve_cost_data", T "../scripts/retrieve_cost_data.py" -if config["enable"]["retrieve"] and config["enable"].get( - "retrieve_natura_raster", True -): - - rule retrieve_natura_raster: - input: - storage( - "https://zenodo.org/record/4706686/files/natura.tiff", - keep_local=True, - ), - output: - resources("natura.tiff"), - log: - logs("retrieve_natura_raster.log"), - resources: - mem_mb=5000, - retries: 2 - run: - copyfile(input[0], output[0]) - validate_checksum(output[0], input[0]) - - -if config["enable"]["retrieve"] and config["enable"].get( - "retrieve_sector_databundle", True -): - datafiles = [ - "eea/UNFCCC_v23.csv", - "switzerland-sfoe/switzerland-new_format.csv", - "nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", - "myb1-2017-nitro.xls", - "Industrial_Database.csv", - "emobility/KFZ__count", - "emobility/Pkw__count", - "h2_salt_caverns_GWh_per_sqkm.geojson", - ] - - rule retrieve_sector_databundle: - output: - protected(expand("data/bundle-sector/{files}", files=datafiles)), - protected(directory("data/bundle-sector/jrc-idees-2015")), - log: - "logs/retrieve_sector_databundle.log", - retries: 2 - conda: - "../envs/retrieve.yaml" - script: - "../scripts/retrieve_sector_databundle.py" - - rule retrieve_eurostat_data: - output: - directory("data/eurostat/eurostat-energy_balances-april_2023_edition"), - log: - "logs/retrieve_eurostat_data.log", - retries: 2 - script: - "../scripts/retrieve_eurostat_data.py" - - if config["enable"]["retrieve"]: datafiles = [ "IGGIELGN_LNGs.geojson", @@ -217,7 +154,7 @@ if config["enable"]["retrieve"]: rule retrieve_ship_raster: input: storage( - "https://zenodo.org/record/6953563/files/shipdensity_global.zip", + "https://zenodo.org/records/10973944/files/shipdensity_global.zip", keep_local=True, ), output: @@ -239,7 +176,7 @@ if config["enable"]["retrieve"]: rule download_copernicus_land_cover: input: storage( - "https://zenodo.org/record/3939050/files/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", + "https://zenodo.org/records/3939050/files/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", ), output: "data/Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", @@ -312,7 +249,7 @@ if config["enable"]["retrieve"]: layer_path = ( f"/vsizip/{params.folder}/WDPA_{bYYYY}_Public_shp_{i}.zip" ) - print(f"Adding layer {i + 1} of 3 to combined output file.") + print(f"Adding layer {i+1} of 3 to combined output file.") shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}") rule download_wdpa_marine: @@ -335,7 +272,7 @@ if config["enable"]["retrieve"]: for i in range(3): # vsizip is special driver for directly working with zipped shapefiles in ogr2ogr layer_path = f"/vsizip/{params.folder}/WDPA_WDOECM_{bYYYY}_Public_marine_shp_{i}.zip" - print(f"Adding layer {i + 1} of 3 to combined output file.") + print(f"Adding layer {i+1} of 3 to combined output file.") shell("ogr2ogr -f gpkg -update -append {output.gpkg} {layer_path}") diff --git a/rules/solve_myopic.smk b/rules/solve_myopic.smk index fe291c6d..6220af2a 100644 --- a/rules/solve_myopic.smk +++ b/rules/solve_myopic.smk @@ -26,9 +26,6 @@ rule add_existing_baseyear: existing_heating_distribution=resources( "existing_heating_distribution_elec_s{simpl}_{clusters}_{planning_horizons}.csv" ), - existing_solar="data/existing_infrastructure/solar_capacity_IRENA.csv", - 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", diff --git a/rules/solve_perfect.smk b/rules/solve_perfect.smk index 70acc830..51cb3920 100644 --- a/rules/solve_perfect.smk +++ b/rules/solve_perfect.smk @@ -25,9 +25,6 @@ rule add_existing_baseyear: "existing_heating_distribution_elec_s{simpl}_{clusters}_{planning_horizons}.csv" ), existing_heating="data/existing_infrastructure/existing_heating_raw.csv", - existing_solar="data/existing_infrastructure/solar_capacity_IRENA.csv", - 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", diff --git a/scripts/_helpers.py b/scripts/_helpers.py index dfedcaea..5008b32a 100644 --- a/scripts/_helpers.py +++ b/scripts/_helpers.py @@ -67,7 +67,7 @@ def get_rdir(run): return RDIR -def get_run_path(fn, dir, rdir, shared_resources): +def get_run_path(fn, dir, rdir, shared_resources, exclude_from_shared): """ Dynamically provide paths based on shared resources and filename. @@ -87,6 +87,8 @@ def get_run_path(fn, dir, rdir, shared_resources): - If string is "base", special handling for shared "base" resources (see notes). - If random string other than "base", this folder is used instead of the `rdir` keyword. - If boolean, directly specifies if the resource is shared. + exclude_from_shared: list + List of filenames to exclude from shared resources. Only relevant if shared_resources is "base". Returns ------- @@ -104,10 +106,12 @@ def get_run_path(fn, dir, rdir, shared_resources): existing_wildcards = set(re.findall(pattern, fn)) irrelevant_wildcards = {"technology", "year", "scope", "kind"} no_relevant_wildcards = not existing_wildcards - irrelevant_wildcards - no_elec_rule = not fn.startswith("networks/elec") and not fn.startswith( - "add_electricity" + not_shared_rule = ( + not fn.startswith("networks/elec") + and not fn.startswith("add_electricity") + and not any(fn.startswith(ex) for ex in exclude_from_shared) ) - is_shared = no_relevant_wildcards and no_elec_rule + is_shared = no_relevant_wildcards and not_shared_rule rdir = "" if is_shared else rdir elif isinstance(shared_resources, str): rdir = shared_resources + "/" @@ -121,7 +125,7 @@ def get_run_path(fn, dir, rdir, shared_resources): return f"{dir}{rdir}{fn}" -def path_provider(dir, rdir, shared_resources): +def path_provider(dir, rdir, shared_resources, exclude_from_shared): """ Returns a partial function that dynamically provides paths based on shared resources and the filename. @@ -132,7 +136,13 @@ def path_provider(dir, rdir, shared_resources): A partial function that takes a filename as input and returns the path to the file based on the shared_resources parameter. """ - return partial(get_run_path, dir=dir, rdir=rdir, shared_resources=shared_resources) + return partial( + get_run_path, + dir=dir, + rdir=rdir, + shared_resources=shared_resources, + exclude_from_shared=exclude_from_shared, + ) def get_opt(opts, expr, flags=None): @@ -707,7 +717,7 @@ def update_config_from_wildcards(config, w, inplace=True): def get_checksum_from_zenodo(file_url): parts = file_url.split("/") - record_id = parts[parts.index("record") + 1] + record_id = parts[parts.index("records") + 1] filename = parts[-1] response = requests.get(f"https://zenodo.org/api/records/{record_id}", timeout=30) @@ -746,7 +756,7 @@ def validate_checksum(file_path, zenodo_url=None, checksum=None): >>> validate_checksum("/path/to/file", checksum="md5:abc123...") >>> validate_checksum( ... "/path/to/file", - ... zenodo_url="https://zenodo.org/record/12345/files/example.txt", + ... zenodo_url="https://zenodo.org/records/12345/files/example.txt", ... ) If the checksum is invalid, an AssertionError will be raised. diff --git a/scripts/add_brownfield.py b/scripts/add_brownfield.py index 16b4e087..0f2d6aa3 100644 --- a/scripts/add_brownfield.py +++ b/scripts/add_brownfield.py @@ -86,43 +86,39 @@ def add_brownfield(n, n_p, year): for tattr in n.component_attrs[c.name].index[selection]: n.import_series_from_dataframe(c.pnl[tattr], c.name, tattr) - # deal with gas network - pipe_carrier = ["gas pipeline"] - if snakemake.params.H2_retrofit: - # drop capacities of previous year to avoid duplicating - to_drop = n.links.carrier.isin(pipe_carrier) & (n.links.build_year != year) - n.mremove("Link", n.links.loc[to_drop].index) + # deal with gas network + pipe_carrier = ["gas pipeline"] + if snakemake.params.H2_retrofit: + # drop capacities of previous year to avoid duplicating + to_drop = n.links.carrier.isin(pipe_carrier) & (n.links.build_year != year) + n.mremove("Link", n.links.loc[to_drop].index) - # subtract the already retrofitted from today's gas grid capacity - h2_retrofitted_fixed_i = n.links[ - (n.links.carrier == "H2 pipeline retrofitted") - & (n.links.build_year != year) - ].index - gas_pipes_i = n.links[n.links.carrier.isin(pipe_carrier)].index - CH4_per_H2 = 1 / snakemake.params.H2_retrofit_capacity_per_CH4 - fr = "H2 pipeline retrofitted" - to = "gas pipeline" - # today's pipe capacity - pipe_capacity = n.links.loc[gas_pipes_i, "p_nom"] - # already retrofitted capacity from gas -> H2 - already_retrofitted = ( - n.links.loc[h2_retrofitted_fixed_i, "p_nom"] - .rename(lambda x: x.split("-2")[0].replace(fr, to)) - .groupby(level=0) - .sum() - ) - remaining_capacity = ( - pipe_capacity - - CH4_per_H2 - * already_retrofitted.reindex(index=pipe_capacity.index).fillna(0) - ) - n.links.loc[gas_pipes_i, "p_nom"] = remaining_capacity - else: - new_pipes = n.links.carrier.isin(pipe_carrier) & ( - n.links.build_year == year - ) - n.links.loc[new_pipes, "p_nom"] = 0.0 - n.links.loc[new_pipes, "p_nom_min"] = 0.0 + # subtract the already retrofitted from today's gas grid capacity + h2_retrofitted_fixed_i = n.links[ + (n.links.carrier == "H2 pipeline retrofitted") + & (n.links.build_year != year) + ].index + gas_pipes_i = n.links[n.links.carrier.isin(pipe_carrier)].index + CH4_per_H2 = 1 / snakemake.params.H2_retrofit_capacity_per_CH4 + fr = "H2 pipeline retrofitted" + to = "gas pipeline" + # today's pipe capacity + pipe_capacity = n.links.loc[gas_pipes_i, "p_nom"] + # already retrofitted capacity from gas -> H2 + already_retrofitted = ( + n.links.loc[h2_retrofitted_fixed_i, "p_nom"] + .rename(lambda x: x.split("-2")[0].replace(fr, to) + f"-{year}") + .groupby(level=0) + .sum() + ) + remaining_capacity = pipe_capacity - CH4_per_H2 * already_retrofitted.reindex( + index=pipe_capacity.index + ).fillna(0) + n.links.loc[gas_pipes_i, "p_nom"] = remaining_capacity + else: + new_pipes = n.links.carrier.isin(pipe_carrier) & (n.links.build_year == year) + n.links.loc[new_pipes, "p_nom"] = 0.0 + n.links.loc[new_pipes, "p_nom_min"] = 0.0 def disable_grid_expansion_if_limit_hit(n): @@ -201,6 +197,7 @@ def adjust_renewable_profiles(n, input_profiles, params, year): for carrier in params["carriers"]: if carrier == "hydro": continue + with xr.open_dataset(getattr(input_profiles, "profile_" + carrier)) as ds: if ds.indexes["bus"].empty or "year" not in ds.indexes: continue diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 7e60203f..7a856b95 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -46,7 +46,7 @@ Inputs ------ - ``resources/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. -- ``data/bundle/hydro_capacities.csv``: Hydropower plant store/discharge power capacities, energy storage capacity, and average hourly inflow by country. +- ``data/hydro_capacities.csv``: Hydropower plant store/discharge power capacities, energy storage capacity, and average hourly inflow by country. .. image:: img/hydrocapacities.png :scale: 34 % @@ -230,10 +230,9 @@ def load_costs(tech_costs, config, max_hours, Nyears=1.0): costs.at["OCGT", "co2_emissions"] = costs.at["gas", "co2_emissions"] costs.at["CCGT", "co2_emissions"] = costs.at["gas", "co2_emissions"] - costs.at["solar", "capital_cost"] = ( - config["rooftop_share"] * costs.at["solar-rooftop", "capital_cost"] - + (1 - config["rooftop_share"]) * costs.at["solar-utility", "capital_cost"] - ) + costs.at["solar", "capital_cost"] = costs.at["solar-utility", "capital_cost"] + + costs = costs.rename({"solar-utility single-axis tracking": "solar-hsat"}) def costs_for_storage(store, link1, link2=None, max_hours=1.0): capital_cost = link1["capital_cost"] + max_hours * store["capital_cost"] @@ -271,7 +270,6 @@ def load_powerplants(ppl_fn): "bioenergy": "biomass", "ccgt, thermal": "CCGT", "hard coal": "coal", - "natural gas": "OCGT", } return ( pd.read_csv(ppl_fn, index_col=0, dtype={"bus": "str"}) diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 0ae23125..8eac44f6 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -13,6 +13,7 @@ from types import SimpleNamespace import country_converter as coco import numpy as np import pandas as pd +import powerplantmatching as pm import pypsa import xarray as xr from _helpers import ( @@ -60,14 +61,22 @@ def add_existing_renewables(df_agg, costs): Append existing renewables to the df_agg pd.DataFrame with the conventional power plants. """ - carriers = {"solar": "solar", "onwind": "onwind", "offwind": "offwind-ac"} + tech_map = {"solar": "PV", "onwind": "Onshore", "offwind": "Offshore"} - for tech in ["solar", "onwind", "offwind"]: - carrier = carriers[tech] + countries = snakemake.config["countries"] + irena = pm.data.IRENASTAT().powerplant.convert_country_to_alpha2() + irena = irena.query("Country in @countries") + irena = irena.groupby(["Technology", "Country", "Year"]).Capacity.sum() - df = pd.read_csv(snakemake.input[f"existing_{tech}"], index_col=0).fillna(0.0) + irena = irena.unstack().reset_index() + + for carrier, tech in tech_map.items(): + df = ( + irena[irena.Technology.str.contains(tech)] + .drop(columns=["Technology"]) + .set_index("Country") + ) df.columns = df.columns.astype(int) - df.index = cc.convert(df.index, to="iso2") # calculate yearly differences df.insert(loc=0, value=0.0, column="1999") @@ -97,14 +106,16 @@ def add_existing_renewables(df_agg, costs): for year in nodal_df.columns: for node in nodal_df.index: - name = f"{node}-{tech}-{year}" + name = f"{node}-{carrier}-{year}" capacity = nodal_df.loc[node, year] if capacity > 0.0: - df_agg.at[name, "Fueltype"] = tech + df_agg.at[name, "Fueltype"] = carrier df_agg.at[name, "Capacity"] = capacity df_agg.at[name, "DateIn"] = year - df_agg.at[name, "lifetime"] = costs.at[tech, "lifetime"] - df_agg.at[name, "DateOut"] = year + costs.at[tech, "lifetime"] - 1 + df_agg.at[name, "lifetime"] = costs.at[carrier, "lifetime"] + df_agg.at[name, "DateOut"] = ( + year + costs.at[carrier, "lifetime"] - 1 + ) df_agg.at[name, "cluster_bus"] = node @@ -152,7 +163,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas technology_to_drop = ["Pv", "Storage Technologies"] - # drop unused fueltyps and technologies + # drop unused fueltypes and technologies df_agg.drop(df_agg.index[df_agg.Fueltype.isin(fueltype_to_drop)], inplace=True) df_agg.drop(df_agg.index[df_agg.Technology.isin(technology_to_drop)], inplace=True) df_agg.Fueltype = df_agg.Fueltype.map(rename_fuel) @@ -241,6 +252,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas ] suffix = "-ac" if generator == "offwind" else "" name_suffix = f" {generator}{suffix}-{grouping_year}" + name_suffix_by = f" {generator}{suffix}-{baseyear}" asset_i = capacity.index + name_suffix if generator in ["solar", "onwind", "offwind"]: # to consider electricity grid connection costs or a split between @@ -270,21 +282,13 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas # for offshore the splitting only includes coastal regions inv_ind = [ - i - for i in inv_ind - if (i + name_suffix) - in n.generators.index.str.replace( - str(baseyear), str(grouping_year) - ) + i for i in inv_ind if (i + name_suffix_by) in n.generators.index ] p_max_pu = n.generators_t.p_max_pu[ - [i + name_suffix for i in inv_ind] - ] - p_max_pu.columns = [ - i + name_suffix.replace(str(grouping_year), str(baseyear)) - for i in inv_ind + [i + name_suffix_by for i in inv_ind] ] + p_max_pu.columns = [i + name_suffix for i in inv_ind] n.madd( "Generator", @@ -302,9 +306,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas ) else: - p_max_pu = n.generators_t.p_max_pu[ - capacity.index + f" {generator}{suffix}-{baseyear}" - ] + p_max_pu = n.generators_t.p_max_pu[capacity.index + name_suffix_by] if not new_build.empty: n.madd( @@ -430,7 +432,7 @@ def add_heating_capacities_installed_before_baseyear( linear decommissioning of heating capacities from 2020 to 2045 is currently assumed heating capacities split between residential and services proportional to heating load in both 50% capacities - in rural busess 50% in urban buses + in rural buses 50% in urban buses """ logger.debug(f"Adding heating capacities installed before {baseyear}") diff --git a/scripts/add_extra_components.py b/scripts/add_extra_components.py index eb14436e..90e7eaec 100644 --- a/scripts/add_extra_components.py +++ b/scripts/add_extra_components.py @@ -246,7 +246,8 @@ if __name__ == "__main__": attach_hydrogen_pipelines(n, costs, extendable_carriers) sanitize_carriers(n, snakemake.config) - sanitize_locations(n) + if "location" in n.buses: + sanitize_locations(n) n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards))) n.export_to_netcdf(snakemake.output[0]) diff --git a/scripts/base_network.py b/scripts/base_network.py index d96a7e54..b811f625 100644 --- a/scripts/base_network.py +++ b/scripts/base_network.py @@ -5,10 +5,7 @@ # coding: utf-8 """ -Creates the network topology from a `ENTSO-E map extract. - -`_ (March 2022) as a PyPSA -network. +Creates the network topology from an `ENTSO-E map extract `_ (March 2022) as a PyPSA network. Relevant Settings ----------------- @@ -59,8 +56,19 @@ Outputs .. image:: img/base.png :scale: 33 % +- ``resources/regions_onshore.geojson``: + + .. image:: img/regions_onshore.png + :scale: 33 % + +- ``resources/regions_offshore.geojson``: + + .. image:: img/regions_offshore.png + :scale: 33 % + Description ----------- +Creates the network topology from an ENTSO-E map extract, and create Voronoi shapes for each bus representing both onshore and offshore regions. """ import logging @@ -75,11 +83,11 @@ import shapely import shapely.prepared import shapely.wkt import yaml -from _helpers import configure_logging, get_snapshots, set_scenario_config +from _helpers import REGION_COLS, configure_logging, get_snapshots, set_scenario_config from packaging.version import Version, parse from scipy import spatial from scipy.sparse import csgraph -from shapely.geometry import LineString, Point +from shapely.geometry import LineString, Point, Polygon PD_GE_2_2 = parse(pd.__version__) >= Version("2.2") @@ -264,14 +272,15 @@ def _add_links_from_tyndp(buses, links, links_tyndp, europe_shape): if links_tyndp.empty: return buses, links - tree = spatial.KDTree(buses[["x", "y"]]) + tree_buses = buses.query("carrier=='AC'") + tree = spatial.KDTree(tree_buses[["x", "y"]]) _, ind0 = tree.query(links_tyndp[["x1", "y1"]]) - ind0_b = ind0 < len(buses) - links_tyndp.loc[ind0_b, "bus0"] = buses.index[ind0[ind0_b]] + ind0_b = ind0 < len(tree_buses) + links_tyndp.loc[ind0_b, "bus0"] = tree_buses.index[ind0[ind0_b]] _, ind1 = tree.query(links_tyndp[["x2", "y2"]]) - ind1_b = ind1 < len(buses) - links_tyndp.loc[ind1_b, "bus1"] = buses.index[ind1[ind1_b]] + ind1_b = ind1 < len(tree_buses) + links_tyndp.loc[ind1_b, "bus1"] = tree_buses.index[ind1[ind1_b]] links_tyndp_located_b = ( links_tyndp["bus0"].notnull() & links_tyndp["bus1"].notnull() @@ -561,7 +570,7 @@ def _set_countries_and_substations(n, config, country_shapes, offshore_shapes): buses["substation_lv"] = ( lv_b & onshore_b & (~buses["under_construction"]) & has_connections_b ) - buses["substation_off"] = (offshore_b | (hv_b & onshore_b)) & ( + buses["substation_off"] = ((hv_b & offshore_b) | (hv_b & onshore_b)) & ( ~buses["under_construction"] ) @@ -779,9 +788,147 @@ def base_network( return n +def voronoi_partition_pts(points, outline): + """ + Compute the polygons of a voronoi partition of `points` within the polygon + `outline`. Taken from + https://github.com/FRESNA/vresutils/blob/master/vresutils/graph.py. + + Attributes + ---------- + points : Nx2 - ndarray[dtype=float] + outline : Polygon + Returns + ------- + polygons : N - ndarray[dtype=Polygon|MultiPolygon] + """ + points = np.asarray(points) + + if len(points) == 1: + polygons = [outline] + else: + xmin, ymin = np.amin(points, axis=0) + xmax, ymax = np.amax(points, axis=0) + xspan = xmax - xmin + yspan = ymax - ymin + + # to avoid any network positions outside all Voronoi cells, append + # the corners of a rectangle framing these points + vor = spatial.Voronoi( + np.vstack( + ( + points, + [ + [xmin - 3.0 * xspan, ymin - 3.0 * yspan], + [xmin - 3.0 * xspan, ymax + 3.0 * yspan], + [xmax + 3.0 * xspan, ymin - 3.0 * yspan], + [xmax + 3.0 * xspan, ymax + 3.0 * yspan], + ], + ) + ) + ) + + polygons = [] + for i in range(len(points)): + poly = Polygon(vor.vertices[vor.regions[vor.point_region[i]]]) + + if not poly.is_valid: + poly = poly.buffer(0) + + with np.errstate(invalid="ignore"): + poly = poly.intersection(outline) + + polygons.append(poly) + + return polygons + + +def build_bus_shapes(n, country_shapes, offshore_shapes, countries): + country_shapes = gpd.read_file(country_shapes).set_index("name")["geometry"] + offshore_shapes = gpd.read_file(offshore_shapes) + offshore_shapes = offshore_shapes.reindex(columns=REGION_COLS).set_index("name")[ + "geometry" + ] + + onshore_regions = [] + offshore_regions = [] + + for country in countries: + c_b = n.buses.country == country + + onshore_shape = country_shapes[country] + onshore_locs = ( + n.buses.loc[c_b & n.buses.onshore_bus] + .sort_values( + by="substation_lv", ascending=False + ) # preference for substations + .drop_duplicates(subset=["x", "y"], keep="first")[["x", "y"]] + ) + onshore_regions.append( + gpd.GeoDataFrame( + { + "name": onshore_locs.index, + "x": onshore_locs["x"], + "y": onshore_locs["y"], + "geometry": voronoi_partition_pts( + onshore_locs.values, onshore_shape + ), + "country": country, + } + ) + ) + + if country not in offshore_shapes.index: + continue + offshore_shape = offshore_shapes[country] + offshore_locs = n.buses.loc[c_b & n.buses.substation_off, ["x", "y"]] + offshore_regions_c = gpd.GeoDataFrame( + { + "name": offshore_locs.index, + "x": offshore_locs["x"], + "y": offshore_locs["y"], + "geometry": voronoi_partition_pts(offshore_locs.values, offshore_shape), + "country": country, + } + ) + offshore_regions_c = offshore_regions_c.loc[offshore_regions_c.area > 1e-2] + offshore_regions.append(offshore_regions_c) + + shapes = pd.concat(onshore_regions, ignore_index=True) + + return onshore_regions, offshore_regions, shapes + + +def append_bus_shapes(n, shapes, type): + """ + Append shapes to the network. If shapes with the same component and type + already exist, they will be removed. + + Parameters: + n (pypsa.Network): The network to which the shapes will be appended. + shapes (geopandas.GeoDataFrame): The shapes to be appended. + **kwargs: Additional keyword arguments used in `n.madd`. + + Returns: + None + """ + remove = n.shapes.query("component == 'Bus' and type == @type").index + n.mremove("Shape", remove) + + offset = n.shapes.index.astype(int).max() + 1 if not n.shapes.empty else 0 + shapes = shapes.rename(lambda x: int(x) + offset) + n.madd( + "Shape", + shapes.index, + geometry=shapes.geometry, + idx=shapes.name, + component="Bus", + type=type, + ) + + if __name__ == "__main__": if "snakemake" not in globals(): - from _helpers import mock_snakemake snakemake = mock_snakemake("base_network") @@ -803,5 +950,22 @@ if __name__ == "__main__": snakemake.config, ) + onshore_regions, offshore_regions, shapes = build_bus_shapes( + n, + snakemake.input.country_shapes, + snakemake.input.offshore_shapes, + snakemake.params.countries, + ) + + shapes.to_file(snakemake.output.regions_onshore) + append_bus_shapes(n, shapes, "onshore") + + if offshore_regions: + shapes = pd.concat(offshore_regions, ignore_index=True) + shapes.to_file(snakemake.output.regions_offshore) + append_bus_shapes(n, shapes, "offshore") + else: + offshore_shapes.to_frame().to_file(snakemake.output.regions_offshore) + n.meta = snakemake.config - n.export_to_netcdf(snakemake.output[0]) + n.export_to_netcdf(snakemake.output.base_network) diff --git a/scripts/build_bus_regions.py b/scripts/build_bus_regions.py deleted file mode 100644 index 05a7729e..00000000 --- a/scripts/build_bus_regions.py +++ /dev/null @@ -1,218 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors -# -# SPDX-License-Identifier: MIT -""" -Creates Voronoi shapes for each bus representing both onshore and offshore -regions. - -Relevant Settings ------------------ - -.. code:: yaml - - countries: - -.. seealso:: - Documentation of the configuration file ``config/config.yaml`` at - :ref:`toplevel_cf` - -Inputs ------- - -- ``resources/country_shapes.geojson``: confer :ref:`shapes` -- ``resources/offshore_shapes.geojson``: confer :ref:`shapes` -- ``networks/base.nc``: confer :ref:`base` - -Outputs -------- - -- ``resources/regions_onshore.geojson``: - - .. image:: img/regions_onshore.png - :scale: 33 % - -- ``resources/regions_offshore.geojson``: - - .. image:: img/regions_offshore.png - :scale: 33 % - -Description ------------ -""" - -import logging - -import geopandas as gpd -import numpy as np -import pandas as pd -import pypsa -from _helpers import REGION_COLS, configure_logging, set_scenario_config -from scipy.spatial import Voronoi -from shapely.geometry import Polygon - -logger = logging.getLogger(__name__) - - -def voronoi_partition_pts(points, outline): - """ - Compute the polygons of a voronoi partition of `points` within the polygon - `outline`. Taken from - https://github.com/FRESNA/vresutils/blob/master/vresutils/graph.py. - - Attributes - ---------- - points : Nx2 - ndarray[dtype=float] - outline : Polygon - Returns - ------- - polygons : N - ndarray[dtype=Polygon|MultiPolygon] - """ - points = np.asarray(points) - - if len(points) == 1: - polygons = [outline] - else: - xmin, ymin = np.amin(points, axis=0) - xmax, ymax = np.amax(points, axis=0) - xspan = xmax - xmin - yspan = ymax - ymin - - # to avoid any network positions outside all Voronoi cells, append - # the corners of a rectangle framing these points - vor = Voronoi( - np.vstack( - ( - points, - [ - [xmin - 3.0 * xspan, ymin - 3.0 * yspan], - [xmin - 3.0 * xspan, ymax + 3.0 * yspan], - [xmax + 3.0 * xspan, ymin - 3.0 * yspan], - [xmax + 3.0 * xspan, ymax + 3.0 * yspan], - ], - ) - ) - ) - - polygons = [] - for i in range(len(points)): - poly = Polygon(vor.vertices[vor.regions[vor.point_region[i]]]) - - if not poly.is_valid: - poly = poly.buffer(0) - - with np.errstate(invalid="ignore"): - poly = poly.intersection(outline) - - polygons.append(poly) - - return polygons - - -def append_bus_shapes(n, shapes, type): - """ - Append shapes to the network. If shapes with the same component and type - already exist, they will be removed. - - Parameters: - n (pypsa.Network): The network to which the shapes will be appended. - shapes (geopandas.GeoDataFrame): The shapes to be appended. - **kwargs: Additional keyword arguments used in `n.madd`. - - Returns: - None - """ - remove = n.shapes.query("component == 'Bus' and type == @type").index - n.mremove("Shape", remove) - - offset = n.shapes.index.astype(int).max() + 1 if not n.shapes.empty else 0 - shapes = shapes.rename(lambda x: int(x) + offset) - n.madd( - "Shape", - shapes.index, - geometry=shapes.geometry, - idx=shapes.name, - component="Bus", - type=type, - ) - - -if __name__ == "__main__": - if "snakemake" not in globals(): - from _helpers import mock_snakemake - - snakemake = mock_snakemake("build_bus_regions") - configure_logging(snakemake) - set_scenario_config(snakemake) - - countries = snakemake.params.countries - - base_network = snakemake.input.base_network - n = pypsa.Network(base_network) - - country_shapes = gpd.read_file(snakemake.input.country_shapes).set_index("name")[ - "geometry" - ] - offshore_shapes = gpd.read_file(snakemake.input.offshore_shapes) - offshore_shapes = offshore_shapes.reindex(columns=REGION_COLS).set_index("name")[ - "geometry" - ] - - onshore_regions = [] - offshore_regions = [] - - for country in countries: - c_b = n.buses.country == country - - onshore_shape = country_shapes[country] - onshore_locs = ( - n.buses.loc[c_b & n.buses.onshore_bus] - .sort_values( - by="substation_lv", ascending=False - ) # preference for substations - .drop_duplicates(subset=["x", "y"], keep="first")[["x", "y"]] - ) - onshore_regions.append( - gpd.GeoDataFrame( - { - "name": onshore_locs.index, - "x": onshore_locs["x"], - "y": onshore_locs["y"], - "geometry": voronoi_partition_pts( - onshore_locs.values, onshore_shape - ), - "country": country, - } - ) - ) - - if country not in offshore_shapes.index: - continue - offshore_shape = offshore_shapes[country] - offshore_locs = n.buses.loc[c_b & n.buses.substation_off, ["x", "y"]] - offshore_regions_c = gpd.GeoDataFrame( - { - "name": offshore_locs.index, - "x": offshore_locs["x"], - "y": offshore_locs["y"], - "geometry": voronoi_partition_pts(offshore_locs.values, offshore_shape), - "country": country, - } - ) - offshore_regions_c = offshore_regions_c.loc[offshore_regions_c.area > 1e-2] - offshore_regions.append(offshore_regions_c) - - shapes = pd.concat(onshore_regions, ignore_index=True) - shapes.to_file(snakemake.output.regions_onshore) - append_bus_shapes(n, shapes, "onshore") - - if offshore_regions: - shapes = pd.concat(offshore_regions, ignore_index=True) - shapes.to_file(snakemake.output.regions_offshore) - append_bus_shapes(n, shapes, "offshore") - - else: - offshore_shapes.to_frame().to_file(snakemake.output.regions_offshore) - - # save network with shapes - n.export_to_netcdf(base_network) diff --git a/scripts/build_electricity_demand.py b/scripts/build_electricity_demand.py index 7615bbc6..fc8af372 100755 --- a/scripts/build_electricity_demand.py +++ b/scripts/build_electricity_demand.py @@ -129,7 +129,7 @@ def copy_timeslice(load, cntry, start, stop, delta, fn_load=None): load.loc[start:stop, cntry] = load.loc[ start - delta : stop - delta, cntry ].values - elif fn_load is not None: + elif fn_load is not None and cntry in load: duration = pd.date_range(freq="h", start=start - delta, end=stop - delta) load_raw = load_timeseries(fn_load, duration, [cntry]) load.loc[start:stop, cntry] = load_raw.loc[ diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index b56d3294..439f7ac1 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -142,6 +142,7 @@ def build_eurostat(input_eurostat, countries, nprocesses=1, disable_progressbar= "Domestic navigation": "Domestic Navigation", "International maritime bunkers": "Bunkers", "UK": "GB", + "EL": "GR", } columns_rename = {"Total": "Total all products"} df.rename(index=index_rename, columns=columns_rename, inplace=True) @@ -395,13 +396,12 @@ def build_idees(countries): names=["country", "year"], ) + # efficiency kgoe/100km -> ktoe/100km + totals.loc[:, "passenger car efficiency"] *= 1e3 # convert ktoe to TWh exclude = totals.columns.str.fullmatch("passenger cars") totals.loc[:, ~exclude] *= 11.63 / 1e3 - # convert TWh/100km to kWh/km - totals.loc[:, "passenger car efficiency"] *= 10 - return totals @@ -854,6 +854,7 @@ def rescale_idees_from_eurostat( "total passenger cars", "total other road passenger", "total light duty road freight", + "total heavy duty road freight", ], "elec": [ "electricity road", @@ -891,6 +892,7 @@ def rescale_idees_from_eurostat( navigation = [ "total domestic navigation", ] + # international navigation is already read in from the eurostat data directly for country in idees_countries: filling_years = [(2015, slice(2016, 2021)), (2000, slice(1990, 1999))] @@ -940,6 +942,22 @@ def rescale_idees_from_eurostat( energy.loc[slicer_source, navigation].squeeze(axis=0), ).values + # set the total of agriculture/road to the sum of all agriculture/road categories (corresponding to the IDEES data) + sel = [ + "total agriculture electricity", + "total agriculture heat", + "total agriculture machinery", + ] + energy.loc[country, "total agriculture"] = energy.loc[country, sel].sum(axis=1) + + sel = [ + "total passenger cars", + "total other road passenger", + "total light duty road freight", + "total heavy duty road freight", + ] + energy.loc[country, "total road"] = energy.loc[country, sel].sum(axis=1) + return energy diff --git a/scripts/build_hydro_profile.py b/scripts/build_hydro_profile.py index cd51ce90..6a0315c7 100644 --- a/scripts/build_hydro_profile.py +++ b/scripts/build_hydro_profile.py @@ -139,7 +139,10 @@ def approximate_missing_eia_stats(eia_stats, runoff_fn, countries): runoff.index = runoff.index.astype(int) # fix outliers; exceptional floods in 1977-1979 in ES & PT - runoff.loc[1978, ["ES", "PT"]] = runoff.loc[1979, ["ES", "PT"]] + if "ES" in runoff: + runoff.loc[1978, "ES"] = runoff.loc[1979, "ES"] + if "PT" in runoff: + runoff.loc[1978, "PT"] = runoff.loc[1979, "PT"] runoff_eia = runoff.loc[eia_stats.index] diff --git a/scripts/build_industry_sector_ratios.py b/scripts/build_industry_sector_ratios.py index 52e83f60..06c8ecb7 100644 --- a/scripts/build_industry_sector_ratios.py +++ b/scripts/build_industry_sector_ratios.py @@ -68,6 +68,7 @@ index = [ "heat", "naphtha", "ammonia", + "methanol", "process emission", "process emission from feedstock", ] @@ -313,7 +314,7 @@ def chemicals_industry(): df.loc["methane", sector] += s_fec["Natural gas"] # LPG and other feedstock materials are assimilated to naphtha - # since they will be produced through Fischer-Tropsh process + # since they will be produced through Fischer-Tropsch process sel = [ "Solids", "Refinery gas", @@ -456,8 +457,7 @@ def chemicals_industry(): sector = "Methanol" df[sector] = 0.0 - df.loc["methane", sector] = params["MWh_CH4_per_tMeOH"] - df.loc["elec", sector] = params["MWh_elec_per_tMeOH"] + df.loc["methanol", sector] = params["MWh_MeOH_per_tMeOH"] # Other chemicals diff --git a/scripts/build_industry_sector_ratios_intermediate.py b/scripts/build_industry_sector_ratios_intermediate.py index 14e09505..a9cda852 100644 --- a/scripts/build_industry_sector_ratios_intermediate.py +++ b/scripts/build_industry_sector_ratios_intermediate.py @@ -51,11 +51,14 @@ def build_industry_sector_ratios_intermediate(): intermediate_sector_ratios = {} for ct, group in today_sector_ratios.T.groupby(level=0): - today_sector_ratios_ct = ( - group.droplevel(0) - .T.reindex_like(future_sector_ratios) - .fillna(future_sector_ratios) - ) + today_sector_ratios_ct = group.droplevel(0).T.reindex_like(future_sector_ratios) + missing_mask = today_sector_ratios_ct.isna().all() + today_sector_ratios_ct.loc[:, missing_mask] = future_sector_ratios.loc[ + :, missing_mask + ] + today_sector_ratios_ct.loc[:, ~missing_mask] = today_sector_ratios_ct.loc[ + :, ~missing_mask + ].fillna(0) intermediate_sector_ratios[ct] = ( today_sector_ratios_ct * (1 - fraction_future) + future_sector_ratios * fraction_future diff --git a/scripts/build_natura_raster.py b/scripts/build_natura_raster.py deleted file mode 100644 index 35fb0dbd..00000000 --- a/scripts/build_natura_raster.py +++ /dev/null @@ -1,118 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors -# -# SPDX-License-Identifier: MIT -""" -Rasters the vector data of the `Natura 2000. - -`_ natural protection areas onto all -cutout regions. - -Relevant Settings ------------------ - -.. code:: yaml - - renewable: - {technology}: - cutout: - -.. seealso:: - Documentation of the configuration file ``config/config.yaml`` at - :ref:`renewable_cf` - -Inputs ------- - -- ``data/bundle/natura/Natura2000_end2015.shp``: `Natura 2000 `_ natural protection areas. - - .. image:: img/natura.png - :scale: 33 % - -Outputs -------- - -- ``resources/natura.tiff``: Rasterized version of `Natura 2000 `_ natural protection areas to reduce computation times. - - .. image:: img/natura.png - :scale: 33 % - -Description ------------ -""" - -import logging - -import atlite -import geopandas as gpd -import rasterio as rio -from _helpers import configure_logging, set_scenario_config -from rasterio.features import geometry_mask -from rasterio.warp import transform_bounds - -logger = logging.getLogger(__name__) - - -def determine_cutout_xXyY(cutout_name): - """ - Determine the full extent of a cutout. - - Since the coordinates of the cutout data are given as the - center of the grid cells, the extent of the cutout is - calculated by adding/subtracting half of the grid cell size. - - - Parameters - ---------- - cutout_name : str - Path to the cutout. - - Returns - ------- - A list of extent coordinates in the order [x, X, y, Y]. - """ - cutout = atlite.Cutout(cutout_name) - assert cutout.crs.to_epsg() == 4326 - x, X, y, Y = cutout.extent - dx, dy = cutout.dx, cutout.dy - return [x - dx / 2.0, X + dx / 2.0, y - dy / 2.0, Y + dy / 2.0] - - -def get_transform_and_shape(bounds, res): - left, bottom = [(b // res) * res for b in bounds[:2]] - right, top = [(b // res + 1) * res for b in bounds[2:]] - shape = int((top - bottom) // res), int((right - left) / res) - transform = rio.Affine(res, 0, left, 0, -res, top) - return transform, shape - - -if __name__ == "__main__": - if "snakemake" not in globals(): - from _helpers import mock_snakemake - - snakemake = mock_snakemake("build_natura_raster") - configure_logging(snakemake) - set_scenario_config(snakemake) - - x, X, y, Y = determine_cutout_xXyY(snakemake.input.cutout) - bounds = transform_bounds(4326, 3035, x, y, X, Y) - transform, out_shape = get_transform_and_shape(bounds, res=100) - - # adjusted boundaries - shapes = gpd.read_file(snakemake.input.natura).to_crs(3035) - raster = ~geometry_mask(shapes.geometry, out_shape, transform) - raster = raster.astype(rio.uint8) - - with rio.open( - snakemake.output[0], - "w", - driver="GTiff", - dtype=rio.uint8, - count=1, - transform=transform, - crs=3035, - compress="lzw", - width=raster.shape[1], - height=raster.shape[0], - ) as dst: - dst.write(raster, indexes=1) diff --git a/scripts/build_powerplants.py b/scripts/build_powerplants.py index 66a01624..4e2bb88f 100755 --- a/scripts/build_powerplants.py +++ b/scripts/build_powerplants.py @@ -148,7 +148,11 @@ def add_everywhere_powerplants(ppl, substations, everywhere_powerplants): def replace_natural_gas_technology(df): - mapping = {"Steam Turbine": "CCGT", "Combustion Engine": "OCGT"} + mapping = { + "Steam Turbine": "CCGT", + "Combustion Engine": "OCGT", + "Not Found": "CCGT", + } tech = df.Technology.replace(mapping).fillna("CCGT") return df.Technology.mask(df.Fueltype == "Natural Gas", tech) diff --git a/scripts/build_renewable_profiles.py b/scripts/build_renewable_profiles.py index f1eb5e15..0aef89bc 100644 --- a/scripts/build_renewable_profiles.py +++ b/scripts/build_renewable_profiles.py @@ -26,7 +26,7 @@ Relevant settings renewable: {technology}: - cutout: corine: luisa: grid_codes: distance: natura: max_depth: + cutout: corine: luisa: grid_codes: distance: natura: max_depth: min_depth: max_shore_distance: min_shore_distance: capacity_per_sqkm: correction_factor: min_p_max_pu: clip_p_max_pu: resource: @@ -52,7 +52,7 @@ Inputs CORINE land cover, see `Annex 1 of the technical documentation `_. -- ``data/bundle/GEBCO_2014_2D.nc``: A `bathymetric +- ``data/bundle/gebco/GEBCO_2014_2D.nc``: A `bathymetric `_ data set with a global terrain model for ocean and land at 15 arc-second intervals by the `General Bathymetric Chart of the Oceans (GEBCO) @@ -284,6 +284,12 @@ if __name__ == "__main__": func = functools.partial(np.greater, -params["max_depth"]) excluder.add_raster(snakemake.input.gebco, codes=func, crs=4326, nodata=-1000) + if params.get("min_depth"): + func = functools.partial(np.greater, -params["min_depth"]) + excluder.add_raster( + snakemake.input.gebco, codes=func, crs=4326, nodata=-1000, invert=True + ) + if "min_shore_distance" in params: buffer = params["min_shore_distance"] excluder.add_geometry(snakemake.input.country_shapes, buffer=buffer) diff --git a/scripts/build_shapes.py b/scripts/build_shapes.py index fd64411a..85afdaea 100644 --- a/scripts/build_shapes.py +++ b/scripts/build_shapes.py @@ -38,7 +38,7 @@ Inputs - ``data/bundle/nama_10r_3popgdp.tsv.gz``: Average annual population by NUTS3 region (`eurostat `__) - ``data/bundle/nama_10r_3gdp.tsv.gz``: Gross domestic product (GDP) by NUTS 3 regions (`eurostat `__) -- ``data/bundle/ch_cantons.csv``: Mapping between Swiss Cantons and NUTS3 regions +- ``data/ch_cantons.csv``: Mapping between Swiss Cantons and NUTS3 regions - ``data/bundle/je-e-21.03.02.xls``: Population and GDP data per Canton (`BFS - Swiss Federal Statistical Office `_ ) Outputs diff --git a/scripts/build_ship_raster.py b/scripts/build_ship_raster.py index 47d725d8..12befe99 100644 --- a/scripts/build_ship_raster.py +++ b/scripts/build_ship_raster.py @@ -45,12 +45,38 @@ import logging import zipfile from pathlib import Path +import atlite import rioxarray from _helpers import configure_logging, set_scenario_config -from build_natura_raster import determine_cutout_xXyY logger = logging.getLogger(__name__) + +def determine_cutout_xXyY(cutout_name): + """ + Determine the full extent of a cutout. + + Since the coordinates of the cutout data are given as the + center of the grid cells, the extent of the cutout is + calculated by adding/subtracting half of the grid cell size. + + + Parameters + ---------- + cutout_name : str + Path to the cutout. + + Returns + ------- + A list of extent coordinates in the order [x, X, y, Y]. + """ + cutout = atlite.Cutout(cutout_name) + assert cutout.crs.to_epsg() == 4326 + x, X, y, Y = cutout.extent + dx, dy = cutout.dx, cutout.dy + return [x - dx / 2.0, X + dx / 2.0, y - dy / 2.0, Y + dy / 2.0] + + if __name__ == "__main__": if "snakemake" not in globals(): from _helpers import mock_snakemake diff --git a/scripts/build_transport_demand.py b/scripts/build_transport_demand.py index 35f22a80..a052581b 100644 --- a/scripts/build_transport_demand.py +++ b/scripts/build_transport_demand.py @@ -24,14 +24,17 @@ logger = logging.getLogger(__name__) def build_nodal_transport_data(fn, pop_layout, year): + # get numbers of car and fuel efficiency per country transport_data = pd.read_csv(fn, index_col=[0, 1]) transport_data = transport_data.xs(min(2015, year), level="year") + # break number of cars down to nodal level based on population density nodal_transport_data = transport_data.loc[pop_layout.ct].fillna(0.0) nodal_transport_data.index = pop_layout.index nodal_transport_data["number cars"] = ( pop_layout["fraction"] * nodal_transport_data["number cars"] ) + # fill missing fuel efficiency with average data nodal_transport_data.loc[ nodal_transport_data["average fuel efficiency"] == 0.0, "average fuel efficiency", @@ -41,10 +44,13 @@ def build_nodal_transport_data(fn, pop_layout, year): def build_transport_demand(traffic_fn, airtemp_fn, nodes, nodal_transport_data): - ## Get overall demand curve for all vehicles - + """ + Returns transport demand per bus in unit km driven [100 km]. + """ + # averaged weekly counts from the year 2010-2015 traffic = pd.read_csv(traffic_fn, skiprows=2, usecols=["count"]).squeeze("columns") + # create annual profile take account time zone + summer time transport_shape = generate_periodic_profiles( dt_index=snapshots, nodes=nodes, @@ -52,15 +58,6 @@ def build_transport_demand(traffic_fn, airtemp_fn, nodes, nodal_transport_data): ) transport_shape = transport_shape / transport_shape.sum() - # electric motors are more efficient, so alter transport demand - - plug_to_wheels_eta = options["bev_plug_to_wheel_efficiency"] - battery_to_wheels_eta = plug_to_wheels_eta * options["bev_charge_efficiency"] - - efficiency_gain = ( - nodal_transport_data["average fuel efficiency"] / battery_to_wheels_eta - ) - # get heating demand for correction to demand time series temperature = xr.open_dataarray(airtemp_fn).to_pandas() @@ -73,16 +70,7 @@ def build_transport_demand(traffic_fn, airtemp_fn, nodes, nodal_transport_data): options["ICE_upper_degree_factor"], ) - dd_EV = transport_degree_factor( - temperature, - options["transport_heating_deadband_lower"], - options["transport_heating_deadband_upper"], - options["EV_lower_degree_factor"], - options["EV_upper_degree_factor"], - ) - # divide out the heating/cooling demand from ICE totals - # and multiply back in the heating/cooling demand for EVs ice_correction = (transport_shape * (1 + dd_ICE)).sum() / transport_shape.sum() energy_totals_transport = ( @@ -91,10 +79,11 @@ def build_transport_demand(traffic_fn, airtemp_fn, nodes, nodal_transport_data): - pop_weighted_energy_totals["electricity rail"] ) - return ( - (transport_shape.multiply(energy_totals_transport) * 1e6 * nyears) - .divide(efficiency_gain * ice_correction) - .multiply(1 + dd_EV) + # convert average fuel efficiency from kW/100 km -> MW/100km + eff = nodal_transport_data["average fuel efficiency"] / 1e3 + + return (transport_shape.multiply(energy_totals_transport) * 1e6 * nyears).divide( + eff * ice_correction ) @@ -131,11 +120,14 @@ def bev_availability_profile(fn, snapshots, nodes, options): """ Derive plugged-in availability for passenger electric vehicles. """ + # car count in typical week traffic = pd.read_csv(fn, skiprows=2, usecols=["count"]).squeeze("columns") - + # maximum share plugged-in availability for passenger electric vehicles avail_max = options["bev_avail_max"] + # average share plugged-in availability for passenger electric vehicles avail_mean = options["bev_avail_mean"] + # linear scaling, highest when traffic is lowest, decreases if traffic increases avail = avail_max - (avail_max - avail_mean) * (traffic - traffic.min()) / ( traffic.mean() - traffic.min() ) @@ -156,6 +148,8 @@ def bev_availability_profile(fn, snapshots, nodes, options): def bev_dsm_profile(snapshots, nodes, options): dsm_week = np.zeros((24 * 7,)) + # assuming that at a certain time ("bev_dsm_restriction_time") EVs have to + # be charged to a minimum value (defined in bev_dsm_restriction_value) dsm_week[(np.arange(0, 7, 1) * 24 + options["bev_dsm_restriction_time"])] = options[ "bev_dsm_restriction_value" ] @@ -167,6 +161,7 @@ def bev_dsm_profile(snapshots, nodes, options): ) +# %% if __name__ == "__main__": if "snakemake" not in globals(): from _helpers import mock_snakemake @@ -174,7 +169,7 @@ if __name__ == "__main__": snakemake = mock_snakemake( "build_transport_demand", simpl="", - clusters=60, + clusters=37, ) configure_logging(snakemake) set_scenario_config(snakemake) diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index f58e5f8b..87762b36 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -135,7 +135,7 @@ import pypsa import seaborn as sns from _helpers import configure_logging, set_scenario_config, update_p_nom_max from add_electricity import load_costs -from build_bus_regions import append_bus_shapes +from base_network import append_bus_shapes from packaging.version import Version, parse from pypsa.clustering.spatial import ( busmap_by_greedy_modularity, diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 8c2a1aea..5746697b 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -413,6 +413,85 @@ def calculate_supply_energy(n, label, supply_energy): return supply_energy +def calculate_nodal_supply_energy(n, label, nodal_supply_energy): + """ + Calculate the total energy supply/consumption of each component at the + buses aggregated by carrier and node. + """ + + bus_carriers = n.buses.carrier.unique() + + for i in bus_carriers: + bus_map = n.buses.carrier == i + bus_map.at[""] = False + + for c in n.iterate_components(n.one_port_components): + items = c.df.index[c.df.bus.map(bus_map).fillna(False)] + + if len(items) == 0: + continue + + s = ( + pd.concat( + [ + ( + c.pnl.p[items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + .multiply(c.df.loc[items, "sign"]) + ), + c.df.loc[items][["bus", "carrier"]], + ], + axis=1, + ) + .groupby(by=["bus", "carrier"]) + .sum()[0] + ) + s = pd.concat([s], keys=[c.list_name]) + s = pd.concat([s], keys=[i]) + + nodal_supply_energy = nodal_supply_energy.reindex( + s.index.union(nodal_supply_energy.index) + ) + nodal_supply_energy.loc[s.index, label] = s + + for c in n.iterate_components(n.branch_components): + for end in [col[3:] for col in c.df.columns if col[:3] == "bus"]: + items = c.df.index[c.df["bus" + str(end)].map(bus_map).fillna(False)] + + if (len(items) == 0) or c.pnl["p" + end].empty: + continue + + s = ( + pd.concat( + [ + ( + (-1) + * c.pnl["p" + end][items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + ), + c.df.loc[items][["bus0", "carrier"]], + ], + axis=1, + ) + .groupby(by=["bus0", "carrier"]) + .sum()[0] + ) + + s.index = s.index.map(lambda x: (x[0], x[1] + end)) + s = pd.concat([s], keys=[c.list_name]) + s = pd.concat([s], keys=[i]) + + nodal_supply_energy = nodal_supply_energy.reindex( + s.index.union(nodal_supply_energy.index) + ) + + nodal_supply_energy.loc[s.index, label] = s + + return nodal_supply_energy + + def calculate_metrics(n, label, metrics): metrics_list = [ "line_volume", @@ -637,6 +716,7 @@ def make_summaries(networks_dict): "energy", "supply", "supply_energy", + "nodal_supply_energy", "prices", "weighted_prices", "price_statistics", diff --git a/scripts/plot_summary.py b/scripts/plot_summary.py index bfe9995f..39fbba03 100644 --- a/scripts/plot_summary.py +++ b/scripts/plot_summary.py @@ -60,6 +60,7 @@ def rename_techs(label): "offwind": "offshore wind", "offwind-ac": "offshore wind (AC)", "offwind-dc": "offshore wind (DC)", + "offwind-float": "offshore wind (Float)", "onwind": "onshore wind", "ror": "hydroelectricity", "hydro": "hydroelectricity", @@ -476,9 +477,10 @@ def plot_carbon_budget_distribution(input_eurostat, options): ) emissions = historical_emissions(countries) # add other years https://sdi.eea.europa.eu/data/0569441f-2853-4664-a7cd-db969ef54de0 - emissions.loc[2019] = 2.971372 - emissions.loc[2020] = 2.691958 - emissions.loc[2021] = 2.869355 + emissions.loc[2019] = 3.414362 + emissions.loc[2020] = 3.092434 + emissions.loc[2021] = 3.290418 + emissions.loc[2022] = 3.213025 if snakemake.config["foresight"] == "myopic": path_cb = "results/" + snakemake.params.RDIR + "/csvs/" diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index b6ec98b2..0e4367d1 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -29,6 +29,7 @@ from build_energy_totals import ( build_eurostat, build_eurostat_co2, ) +from build_transport_demand import transport_degree_factor from networkx.algorithms import complement from networkx.algorithms.connectivity.edge_augmentation import k_edge_augmentation from prepare_network import maybe_adjust_costs_and_potentials @@ -97,7 +98,7 @@ def define_spatial(nodes, options): spatial.gas.industry = nodes + " gas for industry" spatial.gas.industry_cc = nodes + " gas for industry CC" spatial.gas.biogas_to_gas = nodes + " biogas to gas" - spatial.gas.biogas_to_gas_cc = nodes + "biogas to gas CC" + spatial.gas.biogas_to_gas_cc = nodes + " biogas to gas CC" else: spatial.gas.nodes = ["EU gas"] spatial.gas.locations = ["EU"] @@ -145,10 +146,12 @@ def define_spatial(nodes, options): if options["regional_methanol_demand"]: spatial.methanol.demand_locations = nodes + spatial.methanol.industry = nodes + " industry methanol" spatial.methanol.shipping = nodes + " shipping methanol" else: spatial.methanol.demand_locations = ["EU"] spatial.methanol.shipping = ["EU shipping methanol"] + spatial.methanol.industry = ["EU industry methanol"] # oil spatial.oil = SimpleNamespace() @@ -809,33 +812,6 @@ def add_co2limit(n, options, nyears=1.0, limit=0.0): ) -# TODO PyPSA-Eur merge issue -def average_every_nhours(n, offset): - logger.info(f"Resampling the network to {offset}") - m = n.copy(with_time=False) - - snapshot_weightings = n.snapshot_weightings.resample(offset).sum() - sns = snapshot_weightings.index - if snakemake.params.drop_leap_day: - sns = sns[~((sns.month == 2) & (sns.day == 29))] - snapshot_weightings = snapshot_weightings.loc[sns] - m.set_snapshots(snapshot_weightings.index) - m.snapshot_weightings = snapshot_weightings - - for c in n.iterate_components(): - pnl = getattr(m, c.list_name + "_t") - for k, df in c.pnl.items(): - if not df.empty: - if c.list_name == "stores" and k == "e_max_pu": - pnl[k] = df.resample(offset).min() - elif c.list_name == "stores" and k == "e_min_pu": - pnl[k] = df.resample(offset).max() - else: - pnl[k] = df.resample(offset).mean() - - return m - - def cycling_shift(df, steps=1): """ Cyclic shift on index of pd.Series|pd.DataFrame by number of steps. @@ -906,8 +882,6 @@ def add_ammonia(n, costs): nodes = pop_layout.index - cf_industry = snakemake.params.industry - n.add("Carrier", "NH3") n.madd( @@ -994,6 +968,18 @@ def insert_electricity_distribution_grid(n, costs): capital_cost=costs.at["electricity distribution grid", "fixed"] * cost_factor, ) + # deduct distribution losses from electricity demand as these are included in total load + # https://nbviewer.org/github/Open-Power-System-Data/datapackage_timeseries/blob/2020-10-06/main.ipynb + if ( + efficiency := options["transmission_efficiency"] + .get("electricity distribution grid", {}) + .get("efficiency_static") + ): + logger.info( + f"Deducting distribution losses from electricity demand: {100*(1-efficiency)}%" + ) + n.loads_t.p_set.loc[:, n.loads.carrier == "electricity"] *= efficiency + # this catches regular electricity load and "industry electricity" and # "agriculture machinery electric" and "agriculture electricity" loads = n.loads.index[n.loads.carrier.str.contains("electric")] @@ -1025,9 +1011,9 @@ def insert_electricity_distribution_grid(n, costs): else: pop_solar = pop_layout.total.rename(index=lambda x: x + " solar") - # add max solar rooftop potential assuming 0.1 kW/m2 and 10 m2/person, - # i.e. 1 kW/person (population data is in thousands of people) so we get MW - potential = 0.1 * 10 * pop_solar + # add max solar rooftop potential assuming 0.1 kW/m2 and 20 m2/person, + # i.e. 2 kW/person (population data is in thousands of people) so we get MW + potential = 0.1 * 20 * pop_solar n.madd( "Generator", @@ -1115,7 +1101,7 @@ def insert_gas_distribution_costs(n, costs): def add_electricity_grid_connection(n, costs): - carriers = ["onwind", "solar"] + carriers = ["onwind", "solar", "solar-hsat"] gens = n.generators.index[n.generators.carrier.isin(carriers)] @@ -1503,11 +1489,224 @@ def add_storage_and_grids(n, costs): ) +def check_land_transport_shares(shares): + # Sums up the shares, ignoring None values + total_share = sum(filter(None, shares)) + if total_share != 1: + logger.warning( + f"Total land transport shares sum up to {total_share:.2%}," + "corresponding to increased or decreased demand assumptions." + ) + + +def get_temp_efficency( + car_efficiency, + temperature, + deadband_lw, + deadband_up, + degree_factor_lw, + degree_factor_up, +): + """ + Correct temperature depending on heating and cooling for respective car + type. + """ + # temperature correction for EVs + dd = transport_degree_factor( + temperature, + deadband_lw, + deadband_up, + degree_factor_lw, + degree_factor_up, + ) + + temp_eff = 1 / (1 + dd) + + return car_efficiency * temp_eff + + +def add_EVs( + n, + avail_profile, + dsm_profile, + p_set, + electric_share, + number_cars, + temperature, +): + + n.add("Carrier", "Li ion") + + n.madd( + "Bus", + spatial.nodes, + suffix=" EV battery", + location=spatial.nodes, + carrier="Li ion", + unit="MWh_el", + ) + + car_efficiency = options["transport_electric_efficiency"] + + # temperature corrected efficiency + efficiency = get_temp_efficency( + car_efficiency, + temperature, + options["transport_heating_deadband_lower"], + options["transport_heating_deadband_upper"], + options["EV_lower_degree_factor"], + options["EV_upper_degree_factor"], + ) + + p_shifted = (p_set + cycling_shift(p_set, 1) + cycling_shift(p_set, 2)) / 3 + + cyclic_eff = p_set.div(p_shifted) + + efficiency *= cyclic_eff + + profile = electric_share * p_set.div(efficiency) + + n.madd( + "Load", + spatial.nodes, + suffix=" land transport EV", + bus=spatial.nodes + " EV battery", + carrier="land transport EV", + p_set=profile, + ) + + p_nom = number_cars * options.get("bev_charge_rate", 0.011) * electric_share + + n.madd( + "Link", + spatial.nodes, + suffix=" BEV charger", + bus0=spatial.nodes, + bus1=spatial.nodes + " EV battery", + p_nom=p_nom, + carrier="BEV charger", + p_max_pu=avail_profile[spatial.nodes], + lifetime=1, + efficiency=options.get("bev_charge_efficiency", 0.9), + ) + + if options["v2g"]: + n.madd( + "Link", + spatial.nodes, + suffix=" V2G", + bus1=spatial.nodes, + bus0=spatial.nodes + " EV battery", + p_nom=p_nom, + carrier="V2G", + p_max_pu=avail_profile[spatial.nodes], + lifetime=1, + efficiency=options.get("bev_charge_efficiency", 0.9), + ) + + if options["bev_dsm"]: + e_nom = ( + number_cars + * options.get("bev_energy", 0.05) + * options["bev_availability"] + * electric_share + ) + + n.madd( + "Store", + spatial.nodes, + suffix=" battery storage", + bus=spatial.nodes + " EV battery", + carrier="battery storage", + e_cyclic=True, + e_nom=e_nom, + e_max_pu=1, + e_min_pu=dsm_profile[spatial.nodes], + ) + + +def add_fuel_cell_cars(n, p_set, fuel_cell_share, temperature): + + car_efficiency = options["transport_fuel_cell_efficiency"] + + # temperature corrected efficiency + efficiency = get_temp_efficency( + car_efficiency, + temperature, + options["transport_heating_deadband_lower"], + options["transport_heating_deadband_upper"], + options["ICE_lower_degree_factor"], + options["ICE_upper_degree_factor"], + ) + + profile = fuel_cell_share * p_set.div(efficiency) + + n.madd( + "Load", + spatial.nodes, + suffix=" land transport fuel cell", + bus=spatial.h2.nodes, + carrier="land transport fuel cell", + p_set=profile, + ) + + +def add_ice_cars(n, p_set, ice_share, temperature): + + add_carrier_buses(n, "oil") + + car_efficiency = options["transport_ice_efficiency"] + + # temperature corrected efficiency + efficiency = get_temp_efficency( + car_efficiency, + temperature, + options["transport_heating_deadband_lower"], + options["transport_heating_deadband_upper"], + options["ICE_lower_degree_factor"], + options["ICE_upper_degree_factor"], + ) + + profile = ice_share * p_set.div(efficiency).rename( + columns=lambda x: x + " land transport oil" + ) + + if not options["regional_oil_demand"]: + profile = profile.sum(axis=1).to_frame(name="EU land transport oil") + + n.madd( + "Bus", + spatial.oil.land_transport, + location=spatial.oil.demand_locations, + carrier="land transport oil", + unit="land transport", + ) + + n.madd( + "Load", + spatial.oil.land_transport, + bus=spatial.oil.land_transport, + carrier="land transport oil", + p_set=profile, + ) + + n.madd( + "Link", + spatial.oil.land_transport, + bus0=spatial.oil.nodes, + bus1=spatial.oil.land_transport, + bus2="co2 atmosphere", + carrier="land transport oil", + efficiency2=costs.at["oil", "CO2 intensity"], + p_nom_extendable=True, + ) + + def add_land_transport(n, costs): - # TODO options? logger.info("Add land transport") + # read in transport demand in units driven km [100 km] transport = pd.read_csv( snakemake.input.transport_demand, index_col=0, parse_dates=True ) @@ -1521,158 +1720,36 @@ def add_land_transport(n, costs): snakemake.input.dsm_profile, index_col=0, parse_dates=True ) - fuel_cell_share = get(options["land_transport_fuel_cell_share"], investment_year) - electric_share = get(options["land_transport_electric_share"], investment_year) - ice_share = get(options["land_transport_ice_share"], investment_year) + # exogenous share of passenger car type + engine_types = ["fuel_cell", "electric", "ice"] + shares = pd.Series() + for engine in engine_types: + shares[engine] = get(options[f"land_transport_{engine}_share"], investment_year) + logger.info(f"{engine} share: {shares[engine]*100}%") - total_share = fuel_cell_share + electric_share + ice_share - if total_share != 1: - logger.warning( - f"Total land transport shares sum up to {total_share:.2%}, corresponding to increased or decreased demand assumptions." + check_land_transport_shares(shares) + + p_set = transport[spatial.nodes] + + # temperature for correction factor for heating/cooling + temperature = xr.open_dataarray(snakemake.input.temp_air_total).to_pandas() + + if shares["electric"] > 0: + add_EVs( + n, + avail_profile, + dsm_profile, + p_set, + shares["electric"], + number_cars, + temperature, ) - logger.info(f"FCEV share: {fuel_cell_share*100}%") - logger.info(f"EV share: {electric_share*100}%") - logger.info(f"ICEV share: {ice_share*100}%") + if shares["fuel_cell"] > 0: + add_fuel_cell_cars(n, p_set, shares["fuel_cell"], temperature) - nodes = pop_layout.index - - if electric_share > 0: - n.add("Carrier", "Li ion") - - n.madd( - "Bus", - nodes, - suffix=" EV battery", - location=nodes, - carrier="Li ion", - unit="MWh_el", - ) - - p_set = ( - electric_share - * ( - transport[nodes] - + cycling_shift(transport[nodes], 1) - + cycling_shift(transport[nodes], 2) - ) - / 3 - ) - - n.madd( - "Load", - nodes, - suffix=" land transport EV", - bus=nodes + " EV battery", - carrier="land transport EV", - p_set=p_set, - ) - - p_nom = number_cars * options.get("bev_charge_rate", 0.011) * electric_share - - n.madd( - "Link", - nodes, - suffix=" BEV charger", - bus0=nodes, - bus1=nodes + " EV battery", - p_nom=p_nom, - carrier="BEV charger", - p_max_pu=avail_profile[nodes], - efficiency=options.get("bev_charge_efficiency", 0.9), - # These were set non-zero to find LU infeasibility when availability = 0.25 - # p_nom_extendable=True, - # p_nom_min=p_nom, - # capital_cost=1e6, #i.e. so high it only gets built where necessary - ) - - if electric_share > 0 and options["v2g"]: - n.madd( - "Link", - nodes, - suffix=" V2G", - bus1=nodes, - bus0=nodes + " EV battery", - p_nom=p_nom, - carrier="V2G", - p_max_pu=avail_profile[nodes], - efficiency=options.get("bev_charge_efficiency", 0.9), - ) - - if electric_share > 0 and options["bev_dsm"]: - e_nom = ( - number_cars - * options.get("bev_energy", 0.05) - * options["bev_availability"] - * electric_share - ) - - n.madd( - "Store", - nodes, - suffix=" battery storage", - bus=nodes + " EV battery", - carrier="battery storage", - e_cyclic=True, - e_nom=e_nom, - e_max_pu=1, - e_min_pu=dsm_profile[nodes], - ) - - if fuel_cell_share > 0: - n.madd( - "Load", - nodes, - suffix=" land transport fuel cell", - bus=nodes + " H2", - carrier="land transport fuel cell", - p_set=fuel_cell_share - / options["transport_fuel_cell_efficiency"] - * transport[nodes], - ) - - if ice_share > 0: - add_carrier_buses(n, "oil") - - ice_efficiency = options["transport_internal_combustion_efficiency"] - - p_set_land_transport_oil = ( - ice_share - / ice_efficiency - * transport[nodes].rename(columns=lambda x: x + " land transport oil") - ) - - if not options["regional_oil_demand"]: - p_set_land_transport_oil = p_set_land_transport_oil.sum(axis=1).to_frame( - name="EU land transport oil" - ) - - n.madd( - "Bus", - spatial.oil.land_transport, - location=spatial.oil.demand_locations, - carrier="land transport oil", - unit="land transport", - ) - - n.madd( - "Load", - spatial.oil.land_transport, - bus=spatial.oil.land_transport, - carrier="land transport oil", - p_set=p_set_land_transport_oil, - ) - - n.madd( - "Link", - spatial.oil.land_transport, - bus0=spatial.oil.nodes, - bus1=spatial.oil.land_transport, - bus2="co2 atmosphere", - carrier="land transport oil", - efficiency2=costs.at["oil", "CO2 intensity"], - p_nom_extendable=True, - ) + if shares["ice"] > 0: + add_ice_cars(n, p_set, shares["ice"], temperature) def build_heat_demand(n): @@ -2602,6 +2679,86 @@ def add_industry(n, costs): p_set=industrial_demand.loc[nodes, "hydrogen"] / nhours, ) + # methanol for industry + + n.madd( + "Bus", + spatial.methanol.nodes, + carrier="methanol", + location=spatial.methanol.locations, + unit="MWh_LHV", + ) + + n.madd( + "Store", + spatial.methanol.nodes, + suffix=" Store", + bus=spatial.methanol.nodes, + e_nom_extendable=True, + e_cyclic=True, + carrier="methanol", + ) + + n.madd( + "Bus", + spatial.methanol.industry, + carrier="industry methanol", + location=spatial.methanol.demand_locations, + unit="MWh_LHV", + ) + + p_set_methanol = ( + industrial_demand["methanol"] + .rename(lambda x: x + " industry methanol") + / nhours + ) + + if not options["regional_methanol_demand"]: + p_set_methanol = p_set_methanol.sum() + + n.madd( + "Load", + spatial.methanol.industry, + bus=spatial.methanol.industry, + carrier="industry methanol", + p_set=p_set_methanol, + ) + + n.madd( + "Link", + spatial.methanol.industry, + bus0=spatial.methanol.nodes, + bus1=spatial.methanol.industry, + bus2="co2 atmosphere", + carrier="industry methanol", + p_nom_extendable=True, + efficiency2=1 + / options[ + "MWh_MeOH_per_tCO2" + ], + # CO2 intensity methanol based on stoichiometric calculation with 22.7 GJ/t methanol (32 g/mol), CO2 (44 g/mol), 277.78 MWh/TJ = 0.218 t/MWh + ) + + n.madd( + "Link", + spatial.h2.locations + " methanolisation", + bus0=spatial.h2.nodes, + bus1=spatial.methanol.nodes, + bus2=nodes, + bus3=spatial.co2.nodes, + carrier="methanolisation", + p_nom_extendable=True, + p_min_pu=options.get("min_part_load_methanolisation", 0), + capital_cost=costs.at["methanolisation", "fixed"] + * options["MWh_MeOH_per_MWh_H2"], # EUR/MW_H2/a + marginal_cost=options["MWh_MeOH_per_MWh_H2"] + * costs.at["methanolisation", "VOM"], + lifetime=costs.at["methanolisation", "lifetime"], + efficiency=options["MWh_MeOH_per_MWh_H2"], + efficiency2=-options["MWh_MeOH_per_MWh_H2"] / options["MWh_MeOH_per_MWh_e"], + efficiency3=-options["MWh_MeOH_per_MWh_H2"] / options["MWh_MeOH_per_tCO2"], + ) + shipping_hydrogen_share = get(options["shipping_hydrogen_share"], investment_year) shipping_methanol_share = get(options["shipping_methanol_share"], investment_year) shipping_oil_share = get(options["shipping_oil_share"], investment_year) @@ -2671,56 +2828,18 @@ def add_industry(n, costs): ) if shipping_methanol_share: - n.madd( - "Bus", - spatial.methanol.nodes, - carrier="methanol", - location=spatial.methanol.locations, - unit="MWh_LHV", - ) - - n.madd( - "Store", - spatial.methanol.nodes, - suffix=" Store", - bus=spatial.methanol.nodes, - e_nom_extendable=True, - e_cyclic=True, - carrier="methanol", - ) - - n.madd( - "Link", - spatial.h2.locations + " methanolisation", - bus0=spatial.h2.nodes, - bus1=spatial.methanol.nodes, - bus2=nodes, - bus3=spatial.co2.nodes, - carrier="methanolisation", - p_nom_extendable=True, - p_min_pu=options.get("min_part_load_methanolisation", 0), - capital_cost=costs.at["methanolisation", "fixed"] - * options["MWh_MeOH_per_MWh_H2"], # EUR/MW_H2/a - marginal_cost=options["MWh_MeOH_per_MWh_H2"] - * costs.at["methanolisation", "VOM"], - lifetime=costs.at["methanolisation", "lifetime"], - efficiency=options["MWh_MeOH_per_MWh_H2"], - efficiency2=-options["MWh_MeOH_per_MWh_H2"] / options["MWh_MeOH_per_MWh_e"], - efficiency3=-options["MWh_MeOH_per_MWh_H2"] / options["MWh_MeOH_per_tCO2"], - ) - efficiency = ( options["shipping_oil_efficiency"] / options["shipping_methanol_efficiency"] ) - p_set_methanol = ( + p_set_methanol_shipping = ( shipping_methanol_share * p_set.rename(lambda x: x + " shipping methanol") * efficiency ) if not options["regional_methanol_demand"]: - p_set_methanol = p_set_methanol.sum() + p_set_methanol_shipping = p_set_methanol_shipping.sum() n.madd( "Bus", @@ -2735,7 +2854,7 @@ def add_industry(n, costs): spatial.methanol.shipping, bus=spatial.methanol.shipping, carrier="shipping methanol", - p_set=p_set_methanol, + p_set=p_set_methanol_shipping, ) n.madd( @@ -2865,7 +2984,7 @@ def add_industry(n, costs): if demand_factor != 1: logger.warning(f"Changing HVC demand by {demand_factor*100-100:+.2f}%.") - p_set_plastics = ( + p_set_naphtha = ( demand_factor * industrial_demand.loc[nodes, "naphtha"].rename( lambda x: x + " naphtha for industry" @@ -2874,7 +2993,7 @@ def add_industry(n, costs): ) if not options["regional_oil_demand"]: - p_set_plastics = p_set_plastics.sum() + p_set_naphtha = p_set_naphtha.sum() n.madd( "Bus", @@ -2889,7 +3008,7 @@ def add_industry(n, costs): spatial.oil.naphtha, bus=spatial.oil.naphtha, carrier="naphtha for industry", - p_set=p_set_plastics, + p_set=p_set_naphtha, ) # some CO2 from naphtha are process emissions from steam cracker @@ -2900,19 +3019,114 @@ def add_industry(n, costs): ) emitted_co2_per_naphtha = costs.at["oil", "CO2 intensity"] - process_co2_per_naphtha - n.madd( - "Link", - spatial.oil.naphtha, - bus0=spatial.oil.nodes, - bus1=spatial.oil.naphtha, - bus2="co2 atmosphere", - bus3=spatial.co2.process_emissions, - carrier="naphtha for industry", - p_nom_extendable=True, - efficiency2=emitted_co2_per_naphtha, - efficiency3=process_co2_per_naphtha, + non_sequestered = 1 - get( + cf_industry["HVC_environment_sequestration_fraction"], + investment_year, ) + if cf_industry["waste_to_energy"] or cf_industry["waste_to_energy_cc"]: + + non_sequestered_hvc_locations = ( + pd.Index(spatial.oil.demand_locations) + " non-sequestered HVC" + ) + + n.madd( + "Bus", + non_sequestered_hvc_locations, + location=spatial.oil.demand_locations, + carrier="non-sequestered HVC", + unit="MWh_LHV", + ) + + n.madd( + "Link", + spatial.oil.naphtha, + bus0=spatial.oil.nodes, + bus1=spatial.oil.naphtha, + bus2=non_sequestered_hvc_locations, + bus3=spatial.co2.process_emissions, + carrier="naphtha for industry", + p_nom_extendable=True, + efficiency2=non_sequestered + * emitted_co2_per_naphtha + / costs.at["oil", "CO2 intensity"], + efficiency3=process_co2_per_naphtha, + ) + + n.madd( + "Link", + spatial.oil.demand_locations, + suffix=" HVC to air", + bus0=non_sequestered_hvc_locations, + bus1="co2 atmosphere", + carrier="HVC to air", + p_nom_extendable=True, + efficiency=costs.at["oil", "CO2 intensity"], + ) + + if len(non_sequestered_hvc_locations) == 1: + waste_source = non_sequestered_hvc_locations[0] + else: + waste_source = non_sequestered_hvc_locations + + if cf_industry["waste_to_energy"]: + + n.madd( + "Link", + spatial.nodes + " waste CHP", + bus0=waste_source, + bus1=spatial.nodes, + bus2=spatial.nodes + " urban central heat", + bus3="co2 atmosphere", + carrier="waste CHP", + p_nom_extendable=True, + capital_cost=costs.at["waste CHP", "fixed"] + * costs.at["waste CHP", "efficiency"], + marginal_cost=costs.at["waste CHP", "VOM"], + efficiency=costs.at["waste CHP", "efficiency"], + efficiency2=costs.at["waste CHP", "efficiency-heat"], + efficiency3=costs.at["oil", "CO2 intensity"], + lifetime=costs.at["waste CHP", "lifetime"], + ) + + if cf_industry["waste_to_energy_cc"]: + + n.madd( + "Link", + spatial.nodes + " waste CHP CC", + bus0=waste_source, + bus1=spatial.nodes, + bus2=spatial.nodes + " urban central heat", + bus3="co2 atmosphere", + bus4=spatial.co2.nodes, + carrier="waste CHP CC", + p_nom_extendable=True, + capital_cost=costs.at["waste CHP CC", "fixed"] + * costs.at["waste CHP CC", "efficiency"], + marginal_cost=costs.at["waste CHP CC", "VOM"], + efficiency=costs.at["waste CHP CC", "efficiency"], + efficiency2=costs.at["waste CHP CC", "efficiency-heat"], + efficiency3=costs.at["oil", "CO2 intensity"] + * (1 - options["cc_fraction"]), + efficiency4=costs.at["oil", "CO2 intensity"] * options["cc_fraction"], + lifetime=costs.at["waste CHP CC", "lifetime"], + ) + + else: + + n.madd( + "Link", + spatial.oil.naphtha, + bus0=spatial.oil.nodes, + bus1=spatial.oil.naphtha, + bus2="co2 atmosphere", + bus3=spatial.co2.process_emissions, + carrier="naphtha for industry", + p_nom_extendable=True, + efficiency2=emitted_co2_per_naphtha * non_sequestered, + efficiency3=process_co2_per_naphtha, + ) + # aviation demand_factor = options.get("aviation_demand_factor", 1) if demand_factor != 1: @@ -3070,13 +3284,7 @@ def add_industry(n, costs): p_set=p_set, ) - primary_steel = get( - snakemake.config["industry"]["St_primary_fraction"], investment_year - ) - dri_steel = get(snakemake.config["industry"]["DRI_fraction"], investment_year) - bof_steel = primary_steel - dri_steel - - if bof_steel > 0: + if industrial_demand[["coke", "coal"]].sum().sum() > 0: add_carrier_buses(n, "coal") mwh_coal_per_mwh_coke = 1.366 # from eurostat energy balance @@ -3122,7 +3330,6 @@ def add_waste_heat(n): # TODO options? logger.info("Add possibility to use industrial waste heat in district heating") - cf_industry = snakemake.params.industry # AC buses with district heating urban_central = n.buses.index[n.buses.carrier == "urban central heat"] @@ -3421,100 +3628,48 @@ def cluster_heat_buses(n): import_components_from_dataframe(n, df.loc[to_add], c.name) -def apply_time_segmentation( - n, segments, solver_name="cbc", overwrite_time_dependent=True -): +def set_temporal_aggregation(n, resolution, snapshot_weightings): """ - Aggregating time series to segments with different lengths. - - Input: - n: pypsa Network - segments: (int) number of segments in which the typical period should be - subdivided - solver_name: (str) name of solver - overwrite_time_dependent: (bool) overwrite time dependent data of pypsa network - with typical time series created by tsam + Aggregate time-varying data to the given snapshots. """ - try: - import tsam.timeseriesaggregation as tsam - except ImportError: - raise ModuleNotFoundError( - "Optional dependency 'tsam' not found." "Install via 'pip install tsam'" - ) - - # get all time-dependent data - columns = pd.MultiIndex.from_tuples([], names=["component", "key", "asset"]) - raw = pd.DataFrame(index=n.snapshots, columns=columns) - for c in n.iterate_components(): - for attr, pnl in c.pnl.items(): - # exclude e_min_pu which is used for SOC of EVs in the morning - if not pnl.empty and attr != "e_min_pu": - df = pnl.copy() - df.columns = pd.MultiIndex.from_product([[c.name], [attr], df.columns]) - raw = pd.concat([raw, df], axis=1) - - # normalise all time-dependent data - annual_max = raw.max().replace(0, 1) - raw = raw.div(annual_max, level=0) - - # get representative segments - agg = tsam.TimeSeriesAggregation( - raw, - hoursPerPeriod=len(raw), - noTypicalPeriods=1, - noSegments=int(segments), - segmentation=True, - solver=solver_name, - ) - segmented = agg.createTypicalPeriods() - - weightings = segmented.index.get_level_values("Segment Duration") - offsets = np.insert(np.cumsum(weightings[:-1]), 0, 0) - timesteps = [raw.index[0] + pd.Timedelta(f"{offset}h") for offset in offsets] - snapshots = pd.DatetimeIndex(timesteps) - sn_weightings = pd.Series( - weightings, index=snapshots, name="weightings", dtype="float64" - ) - logger.info(f"Distribution of snapshot durations:\n{weightings.value_counts()}") - - n.set_snapshots(sn_weightings.index) - n.snapshot_weightings = n.snapshot_weightings.mul(sn_weightings, axis=0) - - # overwrite time-dependent data with timeseries created by tsam - if overwrite_time_dependent: - values_t = segmented.mul(annual_max).set_index(snapshots) - for component, key in values_t.columns.droplevel(2).unique(): - n.pnl(component)[key] = values_t[component, key] - - return n - - -def set_temporal_aggregation(n, resolution, solver_name): - """ - Aggregate network temporally. - """ - if not resolution: - return n - - # representative snapshots if "sn" in resolution.lower(): + # Representative snapshots are dealt with directly sn = int(resolution[:-2]) logger.info("Use every %s snapshot as representative", sn) n.set_snapshots(n.snapshots[::sn]) n.snapshot_weightings *= sn + else: + # Otherwise, use the provided snapshots + snapshot_weightings = pd.read_csv( + snapshot_weightings, index_col=0, parse_dates=True + ) - # segments with package tsam - elif "seg" in resolution.lower(): - segments = int(resolution[:-3]) - logger.info("Use temporal segmentation with %s segments", segments) - n = apply_time_segmentation(n, segments, solver_name=solver_name) + n.set_snapshots(snapshot_weightings.index) + n.snapshot_weightings = snapshot_weightings - # temporal averaging - elif "h" in resolution.lower(): - logger.info("Aggregate to frequency %s", resolution) - n = average_every_nhours(n, resolution) + # Define a series used for aggregation, mapping each hour in + # n.snapshots to the closest previous timestep in + # snapshot_weightings.index + aggregation_map = ( + pd.Series( + snapshot_weightings.index.get_indexer(n.snapshots), index=n.snapshots + ) + .replace(-1, np.nan) + .ffill() + .astype(int) + .map(lambda i: snapshot_weightings.index[i]) + ) - return n + # Aggregation all time-varying data. + for c in n.iterate_components(): + for k, df in c.pnl.items(): + if not df.empty: + if c.list_name == "stores" and k == "e_max_pu": + c.pnl[k] = df.groupby(aggregation_map).min() + elif c.list_name == "stores" and k == "e_min_pu": + c.pnl[k] = df.groupby(aggregation_map).max() + else: + c.pnl[k] = df.groupby(aggregation_map).mean() def lossy_bidirectional_links(n, carrier, efficiencies={}): @@ -3567,19 +3722,20 @@ def lossy_bidirectional_links(n, carrier, efficiencies={}): ) +# %% if __name__ == "__main__": if "snakemake" not in globals(): from _helpers import mock_snakemake snakemake = mock_snakemake( "prepare_sector_network", - configfiles="test/config.overnight.yaml", + # configfiles="test/config.overnight.yaml", simpl="", opts="", clusters="37", ll="v1.0", - sector_opts="CO2L0-24H-T-H-B-I-A-dist1", - planning_horizons="2030", + sector_opts="730H-T-H-B-I-A-dist1", + planning_horizons="2050", ) configure_logging(snakemake) @@ -3587,6 +3743,7 @@ if __name__ == "__main__": update_config_from_wildcards(snakemake.config, snakemake.wildcards) options = snakemake.params.sector + cf_industry = snakemake.params.industry investment_year = int(snakemake.wildcards.planning_horizons[-4:]) @@ -3665,9 +3822,9 @@ if __name__ == "__main__": if options["allam_cycle"]: add_allam(n, costs) - solver_name = snakemake.config["solving"]["solver"]["name"] - resolution = snakemake.params.time_resolution - n = set_temporal_aggregation(n, resolution, solver_name) + set_temporal_aggregation( + n, snakemake.params.time_resolution, snakemake.input.snapshot_weightings + ) co2_budget = snakemake.params.co2_budget if isinstance(co2_budget, str) and co2_budget.startswith("cb"): diff --git a/scripts/retrieve_databundle.py b/scripts/retrieve_databundle.py index 996bbeab..e2736f63 100644 --- a/scripts/retrieve_databundle.py +++ b/scripts/retrieve_databundle.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2019-2022 Fabian Hofmann (TUB, FIAS) +# Copyright 2019-2024 Fabian Hofmann (TUB, FIAS), Fabian Neumann (TUB) # SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors # # SPDX-License-Identifier: MIT @@ -7,24 +7,15 @@ .. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3517935.svg :target: https://doi.org/10.5281/zenodo.3517935 -The data bundle (1.4 GB) contains common GIS datasets like NUTS3 shapes, EEZ shapes, CORINE Landcover, Natura 2000 and also electricity specific summary statistics like historic per country yearly totals of hydro generation, GDP and POP on NUTS3 levels and per-country load time-series. +The data bundle contains common GIS datasets like NUTS3 shapes, EEZ shapes, +CORINE Landcover, Natura 2000 and also electricity specific summary statistics +like historic per country yearly totals of hydro generation, GDP and population +data on NUTS3 levels and energy balances. -This rule downloads the data bundle from `zenodo `_ and extracts it in the ``data`` sub-directory, such that all files of the bundle are stored in the ``data/bundle`` subdirectory. - -The :ref:`tutorial` uses a smaller `data bundle `_ than required for the full model (188 MB) - -.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3517921.svg - :target: https://doi.org/10.5281/zenodo.3517921 - -**Relevant Settings** - -.. code:: yaml - - tutorial: - -.. seealso:: - Documentation of the configuration file ``config/config.yaml`` at - :ref:`toplevel_cf` +This rule downloads the data bundle from `zenodo +`_ and extracts it in the ``data`` +sub-directory, such that all files of the bundle are stored in the +``data/bundle`` subdirectory. **Outputs** @@ -57,10 +48,7 @@ if __name__ == "__main__": configure_logging(snakemake) set_scenario_config(snakemake) - if snakemake.config["tutorial"]: - url = "https://zenodo.org/record/3517921/files/pypsa-eur-tutorial-data-bundle.tar.xz" - else: - url = "https://zenodo.org/record/3517935/files/pypsa-eur-data-bundle.tar.xz" + url = "https://zenodo.org/records/10973944/files/bundle.tar.xz" tarball_fn = Path(f"{rootpath}/bundle.tar.xz") to_fn = Path(rootpath) / Path(snakemake.output[0]).parent.parent @@ -74,6 +62,7 @@ if __name__ == "__main__": logger.info("Extracting databundle.") tarfile.open(tarball_fn).extractall(to_fn) + logger.info("Unlinking tarball.") tarball_fn.unlink() logger.info(f"Databundle available in '{to_fn}'.") diff --git a/scripts/retrieve_gas_infrastructure_data.py b/scripts/retrieve_gas_infrastructure_data.py index 8d7d0e08..972e08c5 100644 --- a/scripts/retrieve_gas_infrastructure_data.py +++ b/scripts/retrieve_gas_infrastructure_data.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT """ Retrieve gas infrastructure data from -https://zenodo.org/record/4767098/files/IGGIELGN.zip. +https://zenodo.org/records/4767098/files/IGGIELGN.zip. """ import logging @@ -32,7 +32,7 @@ if __name__ == "__main__": configure_logging(snakemake) set_scenario_config(snakemake) - url = "https://zenodo.org/record/4767098/files/IGGIELGN.zip" + url = "https://zenodo.org/records/4767098/files/IGGIELGN.zip" # Save locations zip_fn = Path(f"{rootpath}/IGGIELGN.zip") diff --git a/scripts/retrieve_irena.py b/scripts/retrieve_irena.py deleted file mode 100644 index 04e48db1..00000000 --- a/scripts/retrieve_irena.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Thomas Gilon (Climact) -# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors -# -# SPDX-License-Identifier: MIT -""" -This rule downloads the existing capacities from `IRENASTAT `_ and extracts it in the ``data/existing_capacities`` sub-directory. - -**Relevant Settings** - -.. code:: yaml - - enable: - retrieve_irena: - -.. seealso:: - Documentation of the configuration file ``config.yaml`` at - :ref:`enable_cf` - -**Outputs** - -- ``data/existing_capacities``: existing capacities for offwind, onwind and solar - -""" - -import logging - -import pandas as pd -from _helpers import configure_logging, set_scenario_config - -logger = logging.getLogger(__name__) - -REGIONS = [ - "Albania", - "Austria", - "Belgium", - "Bosnia and Herzegovina", - "Bulgaria", - "Croatia", - "Czechia", - "Denmark", - "Estonia", - "Finland", - "France", - "Germany", - "Greece", - "Hungary", - "Ireland", - "Italy", - "Latvia", - "Lithuania", - "Luxembourg", - "Montenegro", - # "Netherlands", - "Netherlands (Kingdom of the)", - "North Macedonia", - "Norway", - "Poland", - "Portugal", - "Romania", - "Serbia", - "Slovakia", - "Slovenia", - "Spain", - "Sweden", - "Switzerland", - # "United Kingdom", - "United Kingdom of Great Britain and Northern Ireland (the)", -] - -REGIONS_DICT = { - "Bosnia and Herzegovina": "Bosnia Herzg", - "Netherlands (Kingdom of the)": "Netherlands", - "United Kingdom of Great Britain and Northern Ireland (the)": "UK", -} - -if __name__ == "__main__": - if "snakemake" not in globals(): - from _helpers import mock_snakemake - - snakemake = mock_snakemake("retrieve_irena") - configure_logging(snakemake) - set_scenario_config(snakemake) - - irena_raw = pd.read_csv( - "https://pxweb.irena.org:443/sq/99e64b12-fe03-4a7b-92ea-a22cc3713b92", - skiprows=2, - index_col=[0, 1, 3], - encoding="latin-1", - ) - - var = "Installed electricity capacity (MW)" - irena = irena_raw[var].unstack(level=2).reset_index(level=1).replace(0, "") - - irena = irena[irena.index.isin(REGIONS)] - irena.rename(index=REGIONS_DICT, inplace=True) - - df_offwind = irena[irena.Technology.str.contains("Offshore")].drop( - columns=["Technology"] - ) - df_onwind = irena[irena.Technology.str.contains("Onshore")].drop( - columns=["Technology"] - ) - df_pv = irena[irena.Technology.str.contains("Solar")].drop(columns=["Technology"]) - - df_offwind.to_csv(snakemake.output["offwind"]) - df_onwind.to_csv(snakemake.output["onwind"]) - df_pv.to_csv(snakemake.output["solar"]) diff --git a/scripts/retrieve_sector_databundle.py b/scripts/retrieve_sector_databundle.py deleted file mode 100644 index 3b825da2..00000000 --- a/scripts/retrieve_sector_databundle.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-FileCopyrightText: : 2021-2024 The PyPSA-Eur Authors -# -# SPDX-License-Identifier: MIT -""" -Retrieve and extract data bundle for sector-coupled studies. -""" - -import logging -import tarfile -from pathlib import Path - -from _helpers import ( - configure_logging, - progress_retrieve, - set_scenario_config, - validate_checksum, -) - -logger = logging.getLogger(__name__) - -if __name__ == "__main__": - if "snakemake" not in globals(): - from _helpers import mock_snakemake - - snakemake = mock_snakemake("retrieve_databundle") - rootpath = ".." - else: - rootpath = "." - configure_logging(snakemake) - set_scenario_config(snakemake) - - url = "https://zenodo.org/record/5824485/files/pypsa-eur-sec-data-bundle.tar.gz" - - tarball_fn = Path(f"{rootpath}/sector-bundle.tar.gz") - to_fn = Path(rootpath) / Path(snakemake.output[0]).parent.parent - - logger.info(f"Downloading databundle from '{url}'.") - disable_progress = snakemake.config["run"].get("disable_progressbar", False) - progress_retrieve(url, tarball_fn, disable=disable_progress) - - validate_checksum(tarball_fn, url) - - logger.info("Extracting databundle.") - tarfile.open(tarball_fn).extractall(to_fn) - - tarball_fn.unlink() - - logger.info(f"Databundle available in '{to_fn}'.") diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 8f2a84cd..558e4cf2 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -95,7 +95,7 @@ import pypsa import scipy as sp from _helpers import configure_logging, set_scenario_config, update_p_nom_max from add_electricity import load_costs -from build_bus_regions import append_bus_shapes +from base_network import append_bus_shapes from cluster_network import cluster_regions, clustering_for_n_clusters from pypsa.clustering.spatial import ( aggregateoneport, diff --git a/scripts/solve_network.py b/scripts/solve_network.py index dbde8813..67f39d16 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -31,6 +31,7 @@ import logging import os import re import sys +from functools import reduce import numpy as np import pandas as pd @@ -123,7 +124,15 @@ def add_land_use_constraint_perfect(n): def _add_land_use_constraint(n): # warning: this will miss existing offwind which is not classed AC-DC and has carrier 'offwind' - for carrier in ["solar", "onwind", "offwind-ac", "offwind-dc"]: + for carrier in [ + "solar", + "solar rooftop", + "solar-hsat", + "onwind", + "offwind-ac", + "offwind-dc", + "offwind-float", + ]: extendable_i = (n.generators.carrier == carrier) & n.generators.p_nom_extendable n.generators.loc[extendable_i, "p_nom_min"] = 0 @@ -158,7 +167,14 @@ def _add_land_use_constraint_m(n, planning_horizons, config): grouping_years = config["existing_capacities"]["grouping_years_power"] current_horizon = snakemake.wildcards.planning_horizons - for carrier in ["solar", "onwind", "offwind-ac", "offwind-dc"]: + for carrier in [ + "solar", + "solar rooftop", + "solar-hsat", + "onwind", + "offwind-ac", + "offwind-dc", + ]: extendable_i = (n.generators.carrier == carrier) & n.generators.p_nom_extendable n.generators.loc[extendable_i, "p_nom_min"] = 0 @@ -199,6 +215,83 @@ def _add_land_use_constraint_m(n, planning_horizons, config): n.generators.p_nom_max.clip(lower=0, inplace=True) +def add_solar_potential_constraints(n, config): + """ + Add constraint to make sure the sum capacity of all solar technologies (fixed, tracking, ets. ) is below the region potential. + Example: + ES1 0: total solar potential is 10 GW, meaning: + solar potential : 10 GW + solar-hsat potential : 8 GW (solar with single axis tracking is assumed to have higher land use) + The constraint ensures that: + solar_p_nom + solar_hsat_p_nom * 1.13 <= 10 GW + """ + land_use_factors = { + "solar-hsat": config["renewable"]["solar"]["capacity_per_sqkm"] + / config["renewable"]["solar-hsat"]["capacity_per_sqkm"], + } + rename = {"Generator-ext": "Generator"} + + solar_carriers = ["solar", "solar-hsat"] + solar = n.generators[ + n.generators.carrier.isin(solar_carriers) & n.generators.p_nom_extendable + ].index + + solar_today = n.generators[ + (n.generators.carrier == "solar") & (n.generators.p_nom_extendable) + ].index + solar_hsat = n.generators[(n.generators.carrier == "solar-hsat")].index + + if solar.empty: + return + + land_use = pd.DataFrame(1, index=solar, columns=["land_use_factor"]) + for carrier, factor in land_use_factors.items(): + land_use = land_use.apply( + lambda x: (x * factor) if carrier in x.name else x, axis=1 + ) + + if "m" in snakemake.wildcards.clusters: + location = pd.Series( + [" ".join(i.split(" ")[:2]) for i in n.generators.index], + index=n.generators.index, + ) + ggrouper = pd.Series( + n.generators.loc[solar].index.rename("bus").map(location), + index=n.generators.loc[solar].index, + ).to_xarray() + rhs = ( + n.generators.loc[solar_today, "p_nom_max"] + .groupby(n.generators.loc[solar_today].index.rename("bus").map(location)) + .sum() + - n.generators.loc[solar_hsat, "p_nom_opt"] + .groupby(n.generators.loc[solar_hsat].index.rename("bus").map(location)) + .sum() + * land_use_factors["solar-hsat"] + ).clip(lower=0) + + else: + location = pd.Series(n.buses.index, index=n.buses.index) + ggrouper = n.generators.loc[solar].bus + rhs = ( + n.generators.loc[solar_today, "p_nom_max"] + .groupby(n.generators.loc[solar_today].bus.map(location)) + .sum() + - n.generators.loc[solar_hsat, "p_nom_opt"] + .groupby(n.generators.loc[solar_hsat].bus.map(location)) + .sum() + * land_use_factors["solar-hsat"] + ).clip(lower=0) + + lhs = ( + (n.model["Generator-p_nom"].rename(rename).loc[solar] * land_use.squeeze()) + .groupby(ggrouper) + .sum() + ) + + logger.info("Adding solar potential constraint.") + n.model.add_constraints(lhs <= rhs, name="solar_potential") + + def add_co2_sequestration_limit(n, limit=200): """ Add a global constraint on the amount of Mt CO2 that can be sequestered. @@ -438,23 +531,66 @@ def add_CCL_constraints(n, config): agg_p_nom_limits: data/agg_p_nom_minmax.csv """ agg_p_nom_minmax = pd.read_csv( - config["electricity"]["agg_p_nom_limits"], index_col=[0, 1] - ) + config["solving"]["agg_p_nom_limits"]["file"], index_col=[0, 1], header=[0, 1] + )[snakemake.wildcards.planning_horizons] logger.info("Adding generation capacity constraints per carrier and country") p_nom = n.model["Generator-p_nom"] gens = n.generators.query("p_nom_extendable").rename_axis(index="Generator-ext") - grouper = pd.concat([gens.bus.map(n.buses.country), gens.carrier]) + if config["solving"]["agg_p_nom_limits"]["agg_offwind"]: + rename_offwind = { + "offwind-ac": "offwind-all", + "offwind-dc": "offwind-all", + "offwind": "offwind-all", + } + gens = gens.replace(rename_offwind) + grouper = pd.concat([gens.bus.map(n.buses.country), gens.carrier], axis=1) lhs = p_nom.groupby(grouper).sum().rename(bus="country") - minimum = xr.DataArray(agg_p_nom_minmax["min"].dropna()).rename(dim_0="group") + if config["solving"]["agg_p_nom_limits"]["include_existing"]: + gens_cst = n.generators.query("~p_nom_extendable").rename_axis( + index="Generator-cst" + ) + gens_cst = gens_cst[ + (gens_cst["build_year"] + gens_cst["lifetime"]) + >= int(snakemake.wildcards.planning_horizons) + ] + if config["solving"]["agg_p_nom_limits"]["agg_offwind"]: + gens_cst = gens_cst.replace(rename_offwind) + rhs_cst = ( + pd.concat( + [gens_cst.bus.map(n.buses.country), gens_cst[["carrier", "p_nom"]]], + axis=1, + ) + .groupby(["bus", "carrier"]) + .sum() + ) + rhs_cst.index = rhs_cst.index.rename({"bus": "country"}) + rhs_min = agg_p_nom_minmax["min"].dropna() + idx_min = rhs_min.index.join(rhs_cst.index, how="left") + rhs_min = rhs_min.reindex(idx_min).fillna(0) + rhs = (rhs_min - rhs_cst.reindex(idx_min).fillna(0).p_nom).dropna() + rhs[rhs < 0] = 0 + minimum = xr.DataArray(rhs).rename(dim_0="group") + else: + minimum = xr.DataArray(agg_p_nom_minmax["min"].dropna()).rename(dim_0="group") + index = minimum.indexes["group"].intersection(lhs.indexes["group"]) if not index.empty: n.model.add_constraints( lhs.sel(group=index) >= minimum.loc[index], name="agg_p_nom_min" ) - maximum = xr.DataArray(agg_p_nom_minmax["max"].dropna()).rename(dim_0="group") + if config["solving"]["agg_p_nom_limits"]["include_existing"]: + rhs_max = agg_p_nom_minmax["max"].dropna() + idx_max = rhs_max.index.join(rhs_cst.index, how="left") + rhs_max = rhs_max.reindex(idx_max).fillna(0) + rhs = (rhs_max - rhs_cst.reindex(idx_max).fillna(0).p_nom).dropna() + rhs[rhs < 0] = 0 + maximum = xr.DataArray(rhs).rename(dim_0="group") + else: + maximum = xr.DataArray(agg_p_nom_minmax["max"].dropna()).rename(dim_0="group") + index = maximum.indexes["group"].intersection(lhs.indexes["group"]) if not index.empty: n.model.add_constraints( @@ -642,9 +778,9 @@ def add_operational_reserve_margin(n, sns, config): .loc[vres_i.intersection(ext_i)] .rename({"Generator-ext": "Generator"}) ) - lhs = summed_reserve + (p_nom_vres * (-EPSILON_VRES * capacity_factor)).sum( - "Generator" - ) + lhs = summed_reserve + ( + p_nom_vres * (-EPSILON_VRES * xr.DataArray(capacity_factor)) + ).sum("Generator") # Total demand per t demand = get_as_dense(n, "Load", "p_set").sum(axis=1) @@ -674,7 +810,7 @@ def add_operational_reserve_margin(n, sns, config): p_max_pu = get_as_dense(n, "Generator", "p_max_pu") - lhs = dispatch + reserve - capacity_variable * p_max_pu[ext_i] + lhs = dispatch + reserve - capacity_variable * xr.DataArray(p_max_pu[ext_i]) rhs = (p_max_pu[fix_i] * capacity_fixed).reindex(columns=gen_i, fill_value=0) @@ -862,6 +998,9 @@ def extra_functionality(n, snapshots): if EQ_o := constraints["EQ"]: add_EQ_constraints(n, EQ_o.replace("EQ", "")) + if {"solar-hsat", "solar"}.issubset(config["renewable"].keys()): + add_solar_potential_constraints(n, config) + add_battery_constraints(n) add_lossy_bidirectional_link_constraints(n) add_pipe_retrofit_constraint(n) @@ -911,7 +1050,7 @@ def solve_network(n, config, solving, **kwargs): # add to network for extra_functionality n.config = config - if rolling_horizon: + if rolling_horizon and snakemake.rule == "solve_operations_network": kwargs["horizon"] = cf_solving.get("horizon", 365) kwargs["overlap"] = cf_solving.get("overlap", 0) n.optimize.optimize_with_rolling_horizon(**kwargs) @@ -919,9 +1058,12 @@ def solve_network(n, config, solving, **kwargs): elif skip_iterations: status, condition = n.optimize(**kwargs) else: - kwargs["track_iterations"] = (cf_solving.get("track_iterations", False),) - kwargs["min_iterations"] = (cf_solving.get("min_iterations", 4),) - kwargs["max_iterations"] = (cf_solving.get("max_iterations", 6),) + kwargs["track_iterations"] = cf_solving["track_iterations"] + kwargs["min_iterations"] = cf_solving["min_iterations"] + kwargs["max_iterations"] = cf_solving["max_iterations"] + if cf_solving["post_discretization"].pop("enable"): + logger.info("Add post-discretization parameters.") + kwargs.update(cf_solving["post_discretization"]) status, condition = n.optimize.optimize_transmission_expansion_iteratively( **kwargs ) diff --git a/scripts/time_aggregation.py b/scripts/time_aggregation.py new file mode 100644 index 00000000..3792a39f --- /dev/null +++ b/scripts/time_aggregation.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- +# SPDX-FileCopyrightText: : 2017-2024 The PyPSA-Eur Authors +# +# SPDX-License-Identifier: MIT +""" +Defines the time aggregation to be used for sector-coupled network. + +Relevant Settings +----------------- + +.. code:: yaml + + clustering: + temporal: + resolution_sector: + + enable: + drop_leap_day: + +Inputs +------ + +- ``networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc``: the network whose + snapshots are to be aggregated +- ``resources/hourly_heat_demand_total_elec_s{simpl}_{clusters}.nc``: the total + hourly heat demand +- ``resources/solar_thermal_total_elec_s{simpl}_{clusters}.nc``: the total + hourly solar thermal generation + +Outputs +------- + +- ``snapshot_weightings_elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.csv`` + +Description +----------- +Computes a time aggregation scheme for the given network, in the form of a CSV +file with the snapshot weightings, indexed by the new subset of snapshots. This +rule only computes said aggregation scheme; aggregation of time-varying network +data is done in ``prepare_sector_network.py``. +""" + + +import logging + +import numpy as np +import pandas as pd +import pypsa +import xarray as xr +from _helpers import ( + configure_logging, + set_scenario_config, + update_config_from_wildcards, +) + +logger = logging.getLogger(__name__) + +if __name__ == "__main__": + if "snakemake" not in globals(): + from _helpers import mock_snakemake + + snakemake = mock_snakemake( + "time_aggregation", + configfiles="test/config.overnight.yaml", + simpl="", + opts="", + clusters="37", + ll="v1.0", + sector_opts="Co2L0-24h-T-H-B-I-A-dist1", + planning_horizons="2030", + ) + + configure_logging(snakemake) + set_scenario_config(snakemake) + update_config_from_wildcards(snakemake.config, snakemake.wildcards) + + n = pypsa.Network(snakemake.input.network) + resolution = snakemake.params.time_resolution + + # Representative snapshots + if "sn" in resolution.lower(): + logger.info("Use representative snapshots") + # Output an empty csv; this is taken care of in prepare_sector_network.py + pd.DataFrame().to_csv(snakemake.output.snapshot_weightings) + + # Plain resampling + elif "h" in resolution.lower(): + offset = resolution.lower() + logger.info(f"Averaging every {offset} hours") + snapshot_weightings = n.snapshot_weightings.resample(offset).sum() + sns = snapshot_weightings.index + if snakemake.params.drop_leap_day: + sns = sns[~((sns.month == 2) & (sns.day == 29))] + snapshot_weightings = snapshot_weightings.loc[sns] + snapshot_weightings.to_csv(snakemake.output.snapshot_weightings) + + # Temporal segmentation + elif "seg" in resolution.lower(): + segments = int(resolution[:-3]) + logger.info(f"Use temporal segmentation with {segments} segments") + + # Get all time-dependent data + dfs = [ + pnl + for c in n.iterate_components() + for attr, pnl in c.pnl.items() + if not pnl.empty and attr != "e_min_pu" + ] + if snakemake.input.hourly_heat_demand_total: + dfs.append( + xr.open_dataset(snakemake.input.hourly_heat_demand_total) + .to_dataframe() + .unstack(level=1) + ) + if snakemake.input.solar_thermal_total: + dfs.append( + xr.open_dataset(snakemake.input.solar_thermal_total) + .to_dataframe() + .unstack(level=1) + ) + df = pd.concat(dfs, axis=1) + + # Reset columns to flat index + df = df.T.reset_index(drop=True).T + + # Normalise all time-dependent data + annual_max = df.max().replace(0, 1) + df = df.div(annual_max, level=0) + + # Get representative segments + agg = tsam.TimeSeriesAggregation( + df, + hoursPerPeriod=len(df), + noTypicalPeriods=1, + noSegments=segments, + segmentation=True, + solver=snakemake.params.solver_name, + ) + agg = agg.createTypicalPeriods() + + weightings = agg.index.get_level_values("Segment Duration") + offsets = np.insert(np.cumsum(weightings[:-1]), 0, 0) + snapshot_weightings = n.snapshot_weightings.loc[n.snapshots[offsets]].mul( + weightings, axis=0 + ) + + logger.info( + f"Distribution of snapshot durations:\n{snapshot_weightings.objective.value_counts()}" + ) + + snapshot_weightings.to_csv(snakemake.output.snapshot_weightings)