Skip to content

Commit 056b320

Browse files
committed
Merge branch 'master-upstream-oet' into merge-upstream-23-06
Conflicts: doc/release_notes.rst
2 parents 6e92386 + 11ee214 commit 056b320

6 files changed

Lines changed: 27 additions & 7 deletions

File tree

config/config.default.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,7 @@ solving:
10001000

10011001
agg_p_nom_limits:
10021002
agg_offwind: false
1003+
agg_solar: false
10031004
include_existing: false
10041005
file: data/agg_p_nom_minmax.csv
10051006

doc/configtables/solving.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ options,,,
2929
-- keep_files, bool, False, Whether to keep LPs and MPS files after solving.
3030
agg_p_nom_limits,,,Configure per carrier generator nominal capacity constraints for individual countries if ``'CCL'`` is in ``{opts}`` wildcard.
3131
-- agg_offwind,bool,"{'true','false'}",Aggregate together all the types of offwind when writing the constraint. Default is false.
32+
-- agg_solar,bool,"{'true','false'}",Aggregate together all the types of electric solar when writing the constraint. Default is false.
3233
-- include_existing,bool,"{'true','false'}",Take existing capacities into account when writing the constraint. Default is false.
3334
-- 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``.
3435
"constraints ",,,

doc/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Release Notes
8080
SVG output format has also been added for these graphs, and error handling during
8181
graph generation has been enhanced.
8282

83+
* Improved the behavior of ``agg_p_nom_limits``: added the ability to aggregate all ``solar`` electric technologies.
84+
8385
Open-TYNDP v0.1 (14th April 2025)
8486
========================================
8587

scripts/add_existing_baseyear.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,12 +562,19 @@ def add_heating_capacities_installed_before_baseyear(
562562

563563
assert valid_grouping_years.is_monotonic_increasing
564564

565-
# get number of years of each interval
566-
_years = valid_grouping_years.diff()
567-
# Fill NA from .diff() with value for the first interval
568-
_years[0] = valid_grouping_years[0] - baseyear + default_lifetime
569-
# Installation is assumed to be linear for the past
570-
ratios = _years / _years.sum()
565+
if len(valid_grouping_years) == 0:
566+
logger.warning(
567+
f"No valid grouping years found for {heat_system}. "
568+
"No existing capacities will be added."
569+
)
570+
ratios = []
571+
else:
572+
# get number of years of each interval
573+
_years = valid_grouping_years.diff()
574+
# Fill NA from .diff() with value for the first interval
575+
_years[0] = valid_grouping_years[0] - baseyear + default_lifetime
576+
# Installation is assumed to be linear for the past
577+
ratios = _years / _years.sum()
571578

572579
for ratio, grouping_year in zip(ratios, valid_grouping_years):
573580
# Add heat pumps

scripts/build_transmission_projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def add_new_buses(n, new_ports):
4848
to_add = new_ports[~duplicated]
4949
added_buses = n.add(
5050
"Bus",
51-
names=to_add.index,
51+
name=to_add.index,
5252
suffix=" bus",
5353
x=to_add.x,
5454
y=to_add.y,

scripts/solve_network.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,13 @@ def add_CCL_constraints(
564564
"offwind": "offwind-all",
565565
}
566566
gens = gens.replace(rename_offwind)
567+
if config["solving"]["agg_p_nom_limits"]["agg_solar"]:
568+
rename_solar = {
569+
"solar": "solar-all",
570+
"solar-hsat": "solar-all",
571+
"solar rooftop": "solar-all",
572+
}
573+
gens = gens.replace(rename_solar)
567574
grouper = pd.concat([gens.bus.map(n.buses.country), gens.carrier], axis=1)
568575
lhs = p_nom.groupby(grouper).sum().rename(bus="country")
569576

@@ -576,6 +583,8 @@ def add_CCL_constraints(
576583
]
577584
if config["solving"]["agg_p_nom_limits"]["agg_offwind"]:
578585
gens_cst = gens_cst.replace(rename_offwind)
586+
if config["solving"]["agg_p_nom_limits"]["agg_solar"]:
587+
gens_cst = gens_cst.replace(rename_solar)
579588
rhs_cst = (
580589
pd.concat(
581590
[gens_cst.bus.map(n.buses.country), gens_cst[["carrier", "p_nom"]]],

0 commit comments

Comments
 (0)