Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Changelog
- Adjusting aviation demand (from Aladin) and emission accounting (only domestic aviation for national target)
- Increase HVC_environment_sequestration_fraction from 0.1 to 0.6
- Disallow HVC to air in DE
- Restricting the maximum capacity of CurrentPolicies and minus scenarios to the 'uba Projektionsbericht'
Expand Down
3 changes: 1 addition & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run
run:
prefix: 20241202-more-waste-CHP

prefix: 20241203-fix-aviation
name:
# - CurrentPolicies
- KN2045_Bal_v4
Expand Down
2 changes: 2 additions & 0 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ use rule solve_sector_network_myopic from pypsaeur with:
custom_extra_functionality=os.path.join(
os.path.dirname(workflow.snakefile), "scripts/additional_functionality.py"
),
energy_year=config_provider("energy", "energy_totals_year"),
input:
**{
k: v
Expand All @@ -311,6 +312,7 @@ use rule solve_sector_network_myopic from pypsaeur with:
network=RESULTS
+ "prenetworks-final/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
co2_totals_name=resources("co2_totals.csv"),
energy_totals=resources("energy_totals.csv"),


rule modify_existing_heating:
Expand Down
27 changes: 27 additions & 0 deletions workflow/scripts/additional_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ def add_co2limit_country(n, limit_countries, snakemake, debug=False):
links = n.links.index[
(n.links.index.str[:2] == ct)
& (n.links[f"bus{port}"] == "co2 atmosphere")
& (
n.links.carrier != "kerosene for aviation"
) # first exclude aviation to multiply it with a domestic factor later
]

logger.info(
Expand All @@ -394,6 +397,30 @@ def add_co2limit_country(n, limit_countries, snakemake, debug=False):
).sum()
)

# Aviation demand
energy_totals = pd.read_csv(snakemake.input.energy_totals, index_col=[0, 1])
domestic_aviation = energy_totals.loc[
("DE", snakemake.params.energy_year), "total domestic aviation"
]
international_aviation = energy_totals.loc[
("DE", snakemake.params.energy_year), "total international aviation"
]
domestic_factor = domestic_aviation / (
domestic_aviation + international_aviation
)
aviation_links = n.links[
(n.links.index.str[:2] == ct) & (n.links.carrier == "kerosene for aviation")
]
lhs.append
(
n.model["Link-p"].loc[:, aviation_links.index]
* aviation_links.efficiency2
* n.snapshot_weightings.generators
).sum() * domestic_factor
logger.info(
f"Adding domestic aviation emissions for {ct} with a factor of {domestic_factor}"
)

# Adding Efuel imports and exports to constraint
incoming_oil = n.links.index[n.links.index == "EU renewable oil -> DE oil"]
outgoing_oil = n.links.index[n.links.index == "DE renewable oil -> EU oil"]
Expand Down
18 changes: 4 additions & 14 deletions workflow/scripts/build_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@


def get_transport_growth(df, planning_horizons):
# Aviation growth factor - using REMIND-EU v1.1 since Aladin v1 does not include bunkers
aviation_model = snakemake.params.leitmodelle["general"]
try:
aviation = df.loc[aviation_model, "Final Energy|Bunkers|Aviation", "PJ/yr"]
aviation = df.loc["Final Energy|Bunkers|Aviation", "PJ/yr"]
except KeyError:
aviation = (
df.loc[aviation_model, "Final Energy|Bunkers|Aviation", "TWh/yr"] * 3.6
df.loc["Final Energy|Bunkers|Aviation", "TWh/yr"] * 3.6
) # TWh to PJ

aviation_growth_factor = aviation / aviation[2020]
Expand Down Expand Up @@ -139,11 +137,7 @@ def get_co2_budget(df, source):

## PyPSA disregards nonco2 GHG emissions, but includes bunkers

targets_pypsa = (
targets_co2
- nonco2
+ df.loc["Emissions|CO2|Energy|Demand|Bunkers", "Mt CO2/yr"]
)
targets_pypsa = targets_co2 - nonco2

target_fractions_pypsa = targets_pypsa.loc[targets_co2.index] / baseline_pypsa

Expand All @@ -160,10 +154,6 @@ def write_to_scenario_yaml(input, output, scenarios, df):
fallback_reference_scenario = config[scenario]["iiasa_database"][
"fallback_reference_scenario"
]
if fallback_reference_scenario != reference_scenario:
logger.warning(
f"For aviation demand, using {fallback_reference_scenario} as fallback reference scenario for {scenario}."
)

planning_horizons = [
2020,
Expand All @@ -175,7 +165,7 @@ def write_to_scenario_yaml(input, output, scenarios, df):
] # for 2050 we still need data

aviation_demand_factor = get_transport_growth(
df.loc[:, fallback_reference_scenario, :], planning_horizons
df.loc[snakemake.params.leitmodelle["transport"], reference_scenario, :], planning_horizons
)

if reference_scenario.startswith(
Expand Down
Loading