diff --git a/scripts/solve_network.py b/scripts/solve_network.py index a3a3f58c..7dbccb23 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -63,18 +63,18 @@ def _add_land_use_constraint(n): existing.index += " " + carrier + "-" + snakemake.wildcards.planning_horizons n.generators.loc[existing.index, "p_nom_max"] -= existing - # # check if existing capacities are larger than technical potential - # existing_large = n.generators[ - # n.generators["p_nom_min"] > n.generators["p_nom_max"] - # ].index - # if len(existing_large): - # logger.warning( - # f"Existing capacities larger than technical potential for {existing_large},\ - # adjust technical potential to existing capacities" - # ) - # n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[ - # existing_large, "p_nom_min" - # ] + # check if existing capacities are larger than technical potential + existing_large = n.generators[ + n.generators["p_nom_min"] > n.generators["p_nom_max"] + ].index + if len(existing_large): + logger.warning( + f"Existing capacities larger than technical potential for {existing_large},\ + adjust technical potential to existing capacities" + ) + n.generators.loc[existing_large, "p_nom_max"] = n.generators.loc[ + existing_large, "p_nom_min" + ] n.generators.p_nom_max.clip(lower=0, inplace=True)