Skip to content

Commit b1bee0c

Browse files
committed
rename overnight_cost for compatibility with pypsa 1.1
1 parent c2259d0 commit b1bee0c

9 files changed

Lines changed: 183 additions & 197 deletions

config/config.de.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#run
66
run:
7-
prefix: 20260220_merge_v2026.02
7+
prefix: 20260227_compat_pypsa1.1
88
name:
99
# - ExPol
1010
- KN2045_Mix

config/config.default.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,12 +1122,12 @@ clustering:
11221122
ramp_limit_up: max
11231123
ramp_limit_down: max
11241124
investment: mean
1125-
overnight_cost: mean
1126-
connection_overnight_cost: mean
1125+
onight_cost: mean
1126+
connection_onight_cost: mean
11271127
lines:
1128-
overnight_cost: mean
1128+
onight_cost: mean
11291129
one_ports:
1130-
overnight_cost: mean
1130+
onight_cost: mean
11311131
buses: {}
11321132
temporal:
11331133
resolution_elec: false

pixi.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pre-commit = ">=4.3.0"
8282
proj = ">=9.6.2"
8383
pylint = ">=4.0.2"
8484
pydeck = ">0.6" # pypsa fails to import with pydeck <0.6, lower bound was only added from pypsa 1.0.6
85-
pypsa = "<1.1"
85+
pypsa = ">=1.1.2"
8686
pyscipopt = ">=5.6.0"
8787
pytables = ">=3.10.2"
8888
python = ">=3.10"

scripts/add_electricity.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def set_transmission_costs(
442442
* line_length_factor
443443
* costs.at["HVAC overhead", "capital_cost"]
444444
)
445-
n.lines["overnight_cost"] = (
445+
n.lines["onight_cost"] = (
446446
n.lines["length"] * line_length_factor * costs.at["HVAC overhead", "investment"]
447447
)
448448

@@ -467,7 +467,7 @@ def set_transmission_costs(
467467
)
468468
+ costs.at["HVDC inverter pair", "capital_cost"]
469469
)
470-
overnight_cost = (
470+
onight_cost = (
471471
n.links.loc[dc_b, "length"]
472472
* line_length_factor
473473
* (
@@ -480,7 +480,7 @@ def set_transmission_costs(
480480
)
481481

482482
n.links.loc[dc_b, "capital_cost"] = capital_cost
483-
n.links.loc[dc_b, "overnight_cost"] = overnight_cost
483+
n.links.loc[dc_b, "onight_cost"] = onight_cost
484484

485485

486486
def attach_wind_and_solar(
@@ -550,7 +550,7 @@ def attach_wind_and_solar(
550550
underground_investment = costs.at[
551551
car + "-connection-underground", "investment"
552552
]
553-
connection_overnight_cost = line_length_factor * (
553+
connection_onight_cost = line_length_factor * (
554554
distance * submarine_investment
555555
+ landfall_length * underground_investment
556556
)
@@ -563,22 +563,22 @@ def attach_wind_and_solar(
563563
+ costs.at[car + "-station", "capital_cost"]
564564
+ connection_cost
565565
)
566-
overnight_cost = costs.at[car, "investment"]
566+
onight_cost = costs.at[car, "investment"]
567567
else:
568568
capital_cost = (
569569
costs.at["offwind", "capital_cost"]
570570
+ costs.at[car + "-station", "capital_cost"]
571571
+ connection_cost
572572
)
573-
overnight_cost = costs.at["offwind", "investment"]
574-
connection_overnight_cost += costs.at[car + "-station", "investment"]
573+
onight_cost = costs.at["offwind", "investment"]
574+
connection_onight_cost += costs.at[car + "-station", "investment"]
575575
logger.info(
576576
f"Added connection cost of {connection_cost.min():0.0f}-{connection_cost.max():0.0f} Eur/MW/a to {car}"
577577
)
578578
else:
579579
capital_cost = costs.at[car, "capital_cost"]
580-
overnight_cost = costs.at[car, "investment"]
581-
connection_overnight_cost = pd.NA
580+
onight_cost = costs.at[car, "investment"]
581+
connection_onight_cost = pd.NA
582582

583583
buses = ds.indexes["bus_bin"].get_level_values("bus")
584584
bus_bins = ds.indexes["bus_bin"].map(flatten)
@@ -599,8 +599,8 @@ def attach_wind_and_solar(
599599
p_nom_max=p_nom_max,
600600
marginal_cost=costs.at[supcar, "marginal_cost"],
601601
capital_cost=capital_cost,
602-
overnight_cost=overnight_cost,
603-
connection_overnight_cost=connection_overnight_cost,
602+
onight_cost=onight_cost,
603+
connection_onight_cost=connection_onight_cost,
604604
efficiency=costs.at[supcar, "efficiency"],
605605
p_max_pu=p_max_pu,
606606
lifetime=costs.at[supcar, "lifetime"],
@@ -697,7 +697,7 @@ def attach_conventional_generators(
697697
efficiency=ppl.efficiency,
698698
marginal_cost=marginal_cost,
699699
capital_cost=ppl.capital_cost,
700-
overnight_cost=ppl.investment,
700+
onight_cost=ppl.investment,
701701
build_year=ppl.build_year,
702702
lifetime=ppl.lifetime,
703703
**committable_attrs,
@@ -838,7 +838,7 @@ def attach_hydro(
838838
p_nom=ror["p_nom"],
839839
efficiency=costs.at["ror", "efficiency"],
840840
capital_cost=costs.at["ror", "capital_cost"],
841-
overnight_cost=costs.at["ror", "investment"],
841+
onight_cost=costs.at["ror", "investment"],
842842
weight=ror["p_nom"],
843843
p_max_pu=(
844844
inflow_t[ror.index] # pylint: disable=E0606
@@ -859,7 +859,7 @@ def attach_hydro(
859859
bus=phs["bus"],
860860
p_nom=phs["p_nom"],
861861
capital_cost=costs.at["PHS", "capital_cost"],
862-
overnight_cost=costs.at["PHS", "investment"],
862+
onight_cost=costs.at["PHS", "investment"],
863863
max_hours=phs["max_hours"],
864864
efficiency_store=np.sqrt(costs.at["PHS", "efficiency"]),
865865
efficiency_dispatch=np.sqrt(costs.at["PHS", "efficiency"]),
@@ -927,7 +927,7 @@ def attach_hydro(
927927
p_nom=hydro["p_nom"],
928928
max_hours=hydro_max_hours,
929929
capital_cost=costs.at["hydro", "capital_cost"],
930-
overnight_cost=costs.at["hydro", "investment"],
930+
onight_cost=costs.at["hydro", "investment"],
931931
marginal_cost=costs.at["hydro", "marginal_cost"],
932932
p_max_pu=p_max_pu, # dispatch
933933
p_min_pu=0.0, # store
@@ -1112,7 +1112,7 @@ def attach_storageunits(
11121112
carrier=carrier,
11131113
p_nom_extendable=True,
11141114
capital_cost=costs.at[carrier, "capital_cost"],
1115-
overnight_costs=costs.at[carrier, "investment"],
1115+
onight_costs=costs.at[carrier, "investment"],
11161116
marginal_cost=costs.at[carrier, "marginal_cost"],
11171117
efficiency_store=costs.at[lookup_charge, "efficiency"]
11181118
** roundtrip_correction,
@@ -1186,7 +1186,7 @@ def attach_stores(
11861186
e_nom_extendable=True,
11871187
carrier=carrier,
11881188
capital_cost=costs.at[lookup_store, "capital_cost"],
1189-
overnight_cost=costs.at[lookup_store, "investment"],
1189+
onight_cost=costs.at[lookup_store, "investment"],
11901190
lifetime=costs.at[lookup_store, "lifetime"],
11911191
)
11921192

@@ -1201,7 +1201,7 @@ def attach_stores(
12011201
carrier=f"{carrier} {charge_name}",
12021202
efficiency=costs.at[lookup_charge, "efficiency"] ** roundtrip_correction,
12031203
capital_cost=costs.at[lookup_charge, "capital_cost"],
1204-
overnight_cost=costs.at[lookup_charge, "investment"],
1204+
onight_cost=costs.at[lookup_charge, "investment"],
12051205
p_nom_extendable=True,
12061206
marginal_cost=costs.at[lookup_charge, "marginal_cost"],
12071207
lifetime=costs.at[lookup_charge, "lifetime"],

0 commit comments

Comments
 (0)