Skip to content

Commit

Permalink
Accounting renewable CH4 without spatially resolved CH4 network (#146)
Browse files Browse the repository at this point in the history
* first stab at accounting CH4 when not spatially resolving CH4 network

* unravelling in prepare_sector_network

* changing H2_retrofit config

* fix regions without boiler profiles

* stash

* add option for high spatial resolution in config

* config fixes

* more config fixes

* ...

* Update scenarios.manual.yaml

* ignore errors when dropping stores

* Update pypsa version

* adding CH4 to national CO2 target

* config revert

* disable additional scenarios

* correctly assign renewable gas bus to

* avoid cycle flows of renewable gas

* fix AI hallucination

* add tech_color

* fix exporter

* update submodule

* account for carrier shares in imports and exports of renewable gases

* update submodule

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: JulianGeis <JulianGeis@gmx.net>
Co-authored-by: Julian Geis <j.geis@tu-berlin.de>
Co-authored-by: Michael Lindner <michaellindner@posteo.de>
Co-authored-by: Micha <michaellindner@pik-potsdam.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
6 people authored Aug 7, 2024
1 parent d90aca1 commit 0a060dc
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 91 deletions.
12 changes: 7 additions & 5 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

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

prefix: 20240807fix_hydrogen_import_constraint

prefix: 20240807unravelCH4coarse
name:
# - CurrentPolicies
- KN2045_Bal_v4
Expand All @@ -32,6 +30,7 @@ run:
debug_co2_limit: false
debug_h2deriv_limit: false
debug_unravel_oilbus: false
debug_unravel_gasbus: false

iiasa_database:
db_name: ariadne2_intern
Expand Down Expand Up @@ -205,8 +204,8 @@ costs:

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#sector
sector:
solar_thermal: false
v2g: false
solar_thermal: false
district_heating:
potential: 0.3
progress:
Expand All @@ -226,7 +225,9 @@ sector:
regional_methanol_demand: true #set to true if regional CO2 constraints needed
regional_oil_demand: true #set to true if regional CO2 constraints needed
regional_coal_demand: true #set to true if regional CO2 constraints needed
gas_network: true
gas_network: false
regional_gas_demand: true
H2_retrofit: true
biogas_upgrading_cc: true
cluster_heat_buses: true
# calculated based on ariadne "Stock|Space Heating"
Expand Down Expand Up @@ -478,6 +479,7 @@ plotting:
load: "#111100"
H2 pipeline (Kernnetz): '#6b3161'
renewable oil: '#c9c9c9'
renewable gas: '#e05b09'
countries:
- all
- DE
Expand Down
6 changes: 6 additions & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ rule modify_prenetwork:
"mobility_demand_aladin_{simpl}_{clusters}_{planning_horizons}.csv"
),
transport_data=resources("transport_data_s{simpl}_{clusters}.csv"),
biomass_potentials=resources(
"biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"
),
industrial_demand=resources(
"industrial_energy_demand_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
output:
network=RESULTS
+ "prenetworks-final/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
Expand Down
33 changes: 30 additions & 3 deletions workflow/scripts/additional_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,26 @@ def add_co2limit_country(n, limit_countries, snakemake, debug=False):
).sum()
)

# Methane still missing, because its complicated
# Methane
incoming_CH4 = n.links.index[n.links.index == "EU renewable gas -> DE gas"]
outgoing_CH4 = n.links.index[n.links.index == "DE renewable gas -> EU gas"]

lhs.append(
(
-1
* n.model["Link-p"].loc[:, incoming_CH4]
* 0.198
* n.snapshot_weightings.generators
).sum()
)

lhs.append(
(
n.model["Link-p"].loc[:, outgoing_CH4]
* 0.198
* n.snapshot_weightings.generators
).sum()
)

lhs = sum(lhs)

Expand Down Expand Up @@ -507,10 +526,18 @@ def add_h2_derivate_limit(n, investment_year, limits_volume_max):
logger.info(f"limiting H2 derivate imports in {ct} to {limit/1e6} TWh/a")

incoming = n.links.loc[
["EU renewable oil -> DE oil", "EU methanol -> DE methanol"]
[
"EU renewable oil -> DE oil",
"EU methanol -> DE methanol",
"EU renewable gas -> DE gas",
]
].index
outgoing = n.links.loc[
["DE renewable oil -> EU oil", "DE methanol -> EU methanol"]
[
"DE renewable oil -> EU oil",
"DE methanol -> EU methanol",
"DE renewable gas -> EU gas",
]
].index

incoming_p = (
Expand Down
Loading

0 comments on commit 0a060dc

Please sign in to comment.