@@ -58,17 +58,6 @@ def add_capacity_limits(
5858
5959 cname = f"capacity_{ sense } -{ ct } -{ c .name } -{ carrier .replace (' ' , '-' )} "
6060
61- if snakemake .params .get ("regret_run" ):
62- logger .info (
63- f"Skipping capacity limit adjustment for { c .name } { carrier } with planning horizons { investment_year } , because of regret run."
64- )
65- if cname in n .global_constraints .index :
66- logger .warning (
67- f"Global constraint { cname } already exists. Dropping it."
68- )
69- n .global_constraints .drop (cname , inplace = True )
70- continue
71-
7261 if cname in n .global_constraints .index :
7362 logger .warning (
7463 f"Global constraint { cname } already exists. Dropping and adding it again."
@@ -842,44 +831,46 @@ def additional_functionality(n, snapshots, snakemake):
842831 investment_year = int (snakemake .wildcards .planning_horizons [- 4 :])
843832 constraints = snakemake .params .solving ["constraints" ]
844833
845- add_capacity_limits (
846- n , investment_year , constraints ["limits_capacity_min" ], snakemake , "minimum"
847- )
848-
849- add_capacity_limits (
850- n , investment_year , constraints ["limits_capacity_max" ], snakemake , "maximum"
851- )
834+ if not snakemake .config .get ("regret_run" ):
835+ add_capacity_limits (
836+ n , investment_year , constraints ["limits_capacity_min" ], snakemake , "minimum"
837+ )
852838
853- add_power_limits (n , investment_year , constraints ["limits_power_max" ])
839+ add_capacity_limits (
840+ n , investment_year , constraints ["limits_capacity_max" ], snakemake , "maximum"
841+ )
854842
855- if snakemake .wildcards .clusters != "1" :
856- h2_import_limits (n , investment_year , constraints ["limits_volume_max" ])
843+ add_power_limits (n , investment_year , constraints ["limits_power_max" ])
857844
858- electricity_import_limits (n , investment_year , constraints ["limits_volume_max" ])
845+ if snakemake .wildcards .clusters != "1" :
846+ h2_import_limits (n , investment_year , constraints ["limits_volume_max" ])
859847
860- if investment_year >= 2025 :
861- h2_production_limits (
862- n ,
863- investment_year ,
864- constraints ["limits_volume_min" ],
865- constraints ["limits_volume_max" ],
866- )
848+ electricity_import_limits (
849+ n , investment_year , constraints ["limits_volume_max" ]
850+ )
867851
868- add_h2_derivate_limit (n , investment_year , constraints ["limits_volume_max" ])
852+ if investment_year >= 2025 :
853+ h2_production_limits (
854+ n ,
855+ investment_year ,
856+ constraints ["limits_volume_min" ],
857+ constraints ["limits_volume_max" ],
858+ )
859+ add_h2_derivate_limit (n , investment_year , constraints ["limits_volume_max" ])
860+
861+ if isinstance (constraints ["co2_budget_national" ], dict ):
862+ add_national_co2_budgets (
863+ n ,
864+ snakemake ,
865+ constraints ["co2_budget_national" ],
866+ investment_year ,
867+ )
868+ else :
869+ logger .warning ("No national CO2 budget specified!" )
869870
870871 # force_boiler_profiles_existing_per_load(n)
871872 force_boiler_profiles_existing_per_boiler (n )
872873
873- if isinstance (constraints ["co2_budget_national" ], dict ):
874- add_national_co2_budgets (
875- n ,
876- snakemake ,
877- constraints ["co2_budget_national" ],
878- investment_year ,
879- )
880- else :
881- logger .warning ("No national CO2 budget specified!" )
882-
883874 if isinstance (constraints .get ("decentral_heat_pump_budgets" ), dict ):
884875 add_decentral_heat_pump_budgets (
885876 n ,
0 commit comments