diff --git a/config/config.default.yaml b/config/config.default.yaml index a971da8841..9f54ecff48 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -1000,6 +1000,7 @@ solving: agg_p_nom_limits: agg_offwind: false + agg_solar: false include_existing: false file: data/agg_p_nom_minmax.csv diff --git a/doc/configtables/solving.csv b/doc/configtables/solving.csv index f1004c1786..c850986fb1 100644 --- a/doc/configtables/solving.csv +++ b/doc/configtables/solving.csv @@ -29,6 +29,7 @@ options,,, -- keep_files, bool, False, Whether to keep LPs and MPS files after solving. agg_p_nom_limits,,,Configure per carrier generator nominal capacity constraints for individual countries if ``'CCL'`` is in ``{opts}`` wildcard. -- agg_offwind,bool,"{'true','false'}",Aggregate together all the types of offwind when writing the constraint. Default is false. +-- agg_solar,bool,"{'true','false'}",Aggregate together all the types of electric solar when writing the constraint. Default is false. -- include_existing,bool,"{'true','false'}",Take existing capacities into account when writing the constraint. Default is false. -- file,file,path,Reference to ``.csv`` file specifying per carrier generator nominal capacity constraints for individual countries and planning horizons. Defaults to ``data/agg_p_nom_minmax.csv``. "constraints ",,, diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 9028b65b1f..9ff76ccc38 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -80,6 +80,8 @@ Release Notes SVG output format has also been added for these graphs, and error handling during graph generation has been enhanced. +* Improved the behavior of ``agg_p_nom_limits``: added the ability to aggregate all ``solar`` electric technologies. + Open-TYNDP v0.1 (14th April 2025) ======================================== diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index a4803c0668..52fde554bb 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -562,12 +562,19 @@ def add_heating_capacities_installed_before_baseyear( assert valid_grouping_years.is_monotonic_increasing - # get number of years of each interval - _years = valid_grouping_years.diff() - # Fill NA from .diff() with value for the first interval - _years[0] = valid_grouping_years[0] - baseyear + default_lifetime - # Installation is assumed to be linear for the past - ratios = _years / _years.sum() + if len(valid_grouping_years) == 0: + logger.warning( + f"No valid grouping years found for {heat_system}. " + "No existing capacities will be added." + ) + ratios = [] + else: + # get number of years of each interval + _years = valid_grouping_years.diff() + # Fill NA from .diff() with value for the first interval + _years[0] = valid_grouping_years[0] - baseyear + default_lifetime + # Installation is assumed to be linear for the past + ratios = _years / _years.sum() for ratio, grouping_year in zip(ratios, valid_grouping_years): # Add heat pumps diff --git a/scripts/build_transmission_projects.py b/scripts/build_transmission_projects.py index 771da78be8..1d164ac278 100644 --- a/scripts/build_transmission_projects.py +++ b/scripts/build_transmission_projects.py @@ -48,7 +48,7 @@ def add_new_buses(n, new_ports): to_add = new_ports[~duplicated] added_buses = n.add( "Bus", - names=to_add.index, + name=to_add.index, suffix=" bus", x=to_add.x, y=to_add.y, diff --git a/scripts/solve_network.py b/scripts/solve_network.py index ee305b1800..4769abfa6f 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -564,6 +564,13 @@ def add_CCL_constraints( "offwind": "offwind-all", } gens = gens.replace(rename_offwind) + if config["solving"]["agg_p_nom_limits"]["agg_solar"]: + rename_solar = { + "solar": "solar-all", + "solar-hsat": "solar-all", + "solar rooftop": "solar-all", + } + gens = gens.replace(rename_solar) grouper = pd.concat([gens.bus.map(n.buses.country), gens.carrier], axis=1) lhs = p_nom.groupby(grouper).sum().rename(bus="country") @@ -576,6 +583,8 @@ def add_CCL_constraints( ] if config["solving"]["agg_p_nom_limits"]["agg_offwind"]: gens_cst = gens_cst.replace(rename_offwind) + if config["solving"]["agg_p_nom_limits"]["agg_solar"]: + gens_cst = gens_cst.replace(rename_solar) rhs_cst = ( pd.concat( [gens_cst.bus.map(n.buses.country), gens_cst[["carrier", "p_nom"]]],