From e98430e3ceac42c3eb08402c75afd474e4a276a5 Mon Sep 17 00:00:00 2001 From: LukasFrankenQ Date: Mon, 25 Sep 2023 15:15:51 +0100 Subject: [PATCH] cleanup of saturation check --- scripts/prepare_sector_network.py | 4 +++- scripts/solve_network.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index cb8af957..442a4f45 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -3301,6 +3301,7 @@ def add_enhanced_geothermal( ) config = snakemake.config + print(costs.loc[costs.index.str.contains("geothermal")]) overlap = pd.read_csv(egs_overlap, index_col=0) egs_potentials = pd.read_csv(egs_potentials, index_col=0) @@ -3360,7 +3361,7 @@ def add_enhanced_geothermal( bus_egs["p_nom_max"] = bus_egs["p_nom_max"].multiply(bus_overlap) bus_egs = bus_egs.loc[bus_egs.p_nom_max > 0.0] - if config["sector"]["enhanced_geothermal_best_only"]: + if config["sector"]["enhanced_geothermal_performant"]: bus_egs = bus_egs.sort_values(by="capital_cost").iloc[:1] appendix = pd.Index([""]) else: @@ -3377,6 +3378,7 @@ def add_enhanced_geothermal( n.madd( "Link", f"{bus} enhanced geothermal" + appendix, + location=bus, bus0="EU geothermal heat", bus1=bus, bus2="co2 atmosphere", diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 0adb048c..da42a5e7 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -652,12 +652,13 @@ def solve_network(n, config, solving, opts="", **kwargs): (mask := n.links.carrier == "geothermal heat") & (n.links.loc[mask, "p_nom_max"] > 0.) ) - + saturated = n.links.loc[mask, "p_nom_max"] == n.links.loc[mask, "p_nom_opt"] - if len(satbus := n.links.loc[saturated, "location"].unique()) > 0: + if saturated.any(): logger.warning(( - f"Potential for enhanced geothermal heat is saturated at bus(es): {satbus}\n" + "Potential for enhanced geothermal heat is saturated at bus(es):\n" + f"{', '.join(n.links.loc[saturated.loc[saturated.astype(bool)].index, 'location'].tolist())}.\n" "Consider setting config['sector']['enhanced_geothermal_performant'] to False." ))