Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions doc/configtables/solving.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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 ",,,
Expand Down
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
========================================

Expand Down
19 changes: 13 additions & 6 deletions scripts/add_existing_baseyear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_transmission_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions scripts/solve_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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"]]],
Expand Down
Loading