From 7575dd03514d5fb6c0c81b90a537b2bef7b2bceb Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Wed, 26 Jul 2023 07:24:12 +0200 Subject: [PATCH] handling of natural gas in add_existing_baseyear and add_electricity --- scripts/add_electricity.py | 7 +++++++ scripts/add_existing_baseyear.py | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 7cea165b..68d2d5fa 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -426,6 +426,13 @@ def attach_conventional_generators( add_missing_carriers(n, carriers) add_co2_emissions(n, costs, carriers) + # Replace carrier "natural gas" with the respective technology (OCGT or + # CCGT) to align with PyPSA names of "carriers" and avoid filtering "natural + # gas" powerplants in ppl.query("carrier in @carriers") + ppl.loc[ppl["carrier"] == "natural gas", "carrier"] = ppl.loc[ + ppl["carrier"] == "natural gas", "technology" + ] + ppl = ( ppl.query("carrier in @carriers") .join(costs, on="carrier", rsuffix="_r") diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index f80bffb8..668fab67 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -129,10 +129,14 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas "Oil": "oil", "OCGT": "OCGT", "CCGT": "CCGT", - "Natural Gas": "gas", "Bioenergy": "urban central solid biomass CHP", } + # Replace Fueltype "Natural Gas" with the respective technology (OCGT or CCGT) + df_agg.loc[df_agg["Fueltype"] == "Natural Gas", "Fueltype"] = df_agg.loc[ + df_agg["Fueltype"] == "Natural Gas", "Technology" + ] + fueltype_to_drop = [ "Hydro", "Wind", @@ -601,12 +605,13 @@ if __name__ == "__main__": snakemake = mock_snakemake( "add_existing_baseyear", + configfiles="config/test/config.myopic.yaml", simpl="", - clusters="45", - ll="v1.0", + clusters="5", + ll="v1.5", opts="", - sector_opts="8760H-T-H-B-I-A-solar+p3-dist1", - planning_horizons=2020, + sector_opts="24H-T-H-B-I-A-solar+p3-dist1", + planning_horizons=2030, ) logging.basicConfig(level=snakemake.config["logging"]["level"])