Skip to content

Commit 1d954ce

Browse files
committed
Removes constraint "_add_resistive_heater_vollaststunden_constraint_linopy" because it's not needed anymore and remove "update_capital_cost_of_solar_ingolstadt" in utitilities.py
1 parent 1dfba2d commit 1d954ce

File tree

5 files changed

+89
-109
lines changed

5 files changed

+89
-109
lines changed

etrago/appl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,8 @@ def run_etrago(args, json_path):
779779

780780
#etrago.add_biomass_boiler_extendable()
781781

782-
#etrago.set_battery_parameter_interest_area()
783-
etrago.set_battery_and_heat_store_parameters_interest_area()
782+
etrago.set_battery_parameter_interest_area()
783+
#etrago.set_battery_and_heat_store_parameters_interest_area()
784784

785785
etrago.set_cyclic_constraints()
786786

etrago/network.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@
123123
reset_gas_CHP_capacities,
124124
add_biogas_CHP_extendable,
125125
add_biomass_CHP_extendable,
126-
update_capital_cost_of_solar_ingolstadt,
127126
add_biomass_boiler_extendable,
128127
adjust_capital_costs,
129128
print_capital_costs,
@@ -417,8 +416,6 @@ def __init__(
417416

418417
add_waste_CHP_ingolstadt = add_waste_CHP_ingolstadt
419418

420-
update_capital_cost_of_solar_ingolstadt = update_capital_cost_of_solar_ingolstadt
421-
422419
reset_gas_CHP_capacities = reset_gas_CHP_capacities
423420

424421
add_biogas_CHP_extendable = add_biogas_CHP_extendable

etrago/tools/constraints.py

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3847,8 +3847,6 @@ def _add_chp_ratio_constraint_linopy(self, network, snapshots):
38473847
-------
38483848
None
38493849
"""
3850-
import logging
3851-
logger = logging.getLogger(__name__)
38523850
logger.info("🚀 Start writing CHP ratio constraints for all supported CHP types.")
38533851

38543852
chp_techs = {
@@ -3906,63 +3904,4 @@ def _add_chp_ratio_constraint_linopy(self, network, snapshots):
39063904
logger.error(f"❌ Error for {carrier_el}, bus {bus}, snapshot {snapshot}: {e}")
39073905
continue
39083906

3909-
logger.info("✅ Finished writing CHP ratio constraints for all supported CHP types.")
3910-
3911-
3912-
def _add_resistive_heater_vollaststunden_constraint_linopy(network, snapshots):
3913-
"""
3914-
Limits the annual full-load hours of the regional electric boiler (resistive heater)
3915-
with bus0 = "16" to max. 500 hours.
3916-
3917-
Parameters
3918-
----------
3919-
network : pypsa.Network
3920-
Network container.
3921-
snapshots : pandas.Index
3922-
Timesteps to optimize.
3923-
3924-
Returns
3925-
-------
3926-
None.
3927-
"""
3928-
3929-
logger.info("✔️ add_resistive_heater_vollaststunden_constraint constraint activated")
3930-
3931-
# Filtere den spezifischen Link am Bus 16
3932-
heater_links = network.links[
3933-
(network.links.carrier == "central_resistive_heater")
3934-
& (network.links.bus0 == "16")
3935-
]
3936-
3937-
if heater_links.empty:
3938-
print("Keine passenden Links für den Elektroboiler an Bus 16 gefunden!")
3939-
return
3940-
3941-
# Summe der Nennleistung (p_nom) in MW
3942-
p_nom_sum = heater_links.p_nom.sum()
3943-
3944-
# Dispatch-Summe über alle Zeitschritte in MWh
3945-
dispatch_sum = 0
3946-
3947-
for snapshot in snapshots:
3948-
# Zeitschrittgewichtung in Stunden
3949-
timestep_hours = network.snapshot_weightings["objective"].loc[snapshot]
3950-
3951-
# Summiere alle Dispatch-Werte dieses Zeitpunkts (MW)
3952-
dispatch_sum += (
3953-
get_var(network, "Link", "p").loc[snapshot, heater_links.index].sum()
3954-
* timestep_hours
3955-
)
3956-
3957-
# Maximal zulässige Energie = Volllaststunden * Nennleistung (MWh)
3958-
max_energy_mwh = 500 * p_nom_sum
3959-
3960-
# Constraint definieren: Gesamterzeugung <= max. zulässige MWh
3961-
define_constraints(
3962-
network,
3963-
dispatch_sum,
3964-
"<=",
3965-
max_energy_mwh,
3966-
"Link",
3967-
f"vollaststunden_limit_bus16",
3968-
)
3907+
logger.info("✅ Finished writing CHP ratio constraints for all supported CHP types.")

etrago/tools/utilities.py

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4675,7 +4675,7 @@ def add_extendable_heat_pumps_to_interest_area(self):
46754675

46764676
marginal_cost_map = {
46774677
"central_heat_pump": 2.4868
4678-
# rural_heat_pump bleibt bei vorhandenem Wert
4678+
# rural_heat_pump remains at existing value
46794679
}
46804680

46814681
connected_links = find_links_connected_to_interest_buses(self)
@@ -4717,6 +4717,7 @@ def add_extendable_heat_pumps_to_interest_area(self):
47174717
self.network.links.at[new_index, "scn_name"] = "eGon2035"
47184718
print(f"Heat pump {new_index} ({carrier}) duplicated as extendable with time series.")
47194719

4720+
47204721
def set_battery_parameter_interest_area(self):
47214722
"""
47224723
Set minimum capacity and capital cost for all battery storage units in the interest area.
@@ -4817,7 +4818,7 @@ def set_battery_and_heat_store_parameters_interest_area(self):
48174818

48184819
# Capital costs per heat-store carrier
48194820
capital_cost_store_values = {
4820-
"rural_heat_store": 27312.6386,
4821+
"rural_heat_store": 19118.7469,
48214822
"central_heat_store": 69.0976,
48224823
}
48234824

@@ -5085,43 +5086,4 @@ def set_cyclic_constraints(self):
50855086
store_mask = self.network.stores.carrier.isin(stores_carrier)
50865087
self.network.stores.loc[store_mask, "e_cyclic"] = True
50875088

5088-
print("Cyclic constraints set for battery storage_units and defined store carriers.")
5089-
5090-
5091-
def update_capital_cost_of_solar_ingolstadt(self, new_capital_cost):
5092-
"""
5093-
Update the capital cost of all solar rooftop generators located in the
5094-
interest area (e.g., Ingolstadt).
5095-
5096-
Parameters
5097-
----------
5098-
self : :class:`Etrago`
5099-
Model instance providing:
5100-
- ``network`` : pypsa.Network
5101-
Must contain ``generators`` with columns ``bus``, ``carrier``, ``capital_cost``.
5102-
- ``find_interest_buses`` : callable
5103-
Helper to resolve buses in the interest area.
5104-
new_capital_cost : float
5105-
New capital cost value [EUR/kW] to assign to all rooftop PV generators
5106-
in the interest area.
5107-
5108-
Returns
5109-
-------
5110-
None
5111-
"""
5112-
buses_ingolstadt = find_interest_buses(self)
5113-
bus_list = buses_ingolstadt.index.to_list()
5114-
5115-
gens = self.network.generators
5116-
is_solar_in_ingolstadt = (gens.carrier == "solar_rooftop") & (gens.bus.isin(bus_list))
5117-
solar_generators = gens[is_solar_in_ingolstadt]
5118-
5119-
if solar_generators.empty:
5120-
print("⚠️ Keine passenden Solar-Generatoren in Ingolstadt gefunden.")
5121-
return
5122-
5123-
self.network.generators.loc[solar_generators.index, "capital_cost"] = new_capital_cost
5124-
print(
5125-
f"Updated capital_cost to {new_capital_cost:.2f} €/kW "
5126-
f"for {len(solar_generators)} solar_rooftop generator(s) in the interest area."
5127-
)
5089+
print("Cyclic constraints set for battery storage_units and defined store carriers.")

requirements.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
backports.tarfile==1.2.0
2+
blosc2==2.7.1
3+
Bottleneck==1.4.2
4+
certifi==2025.1.31
5+
cffi==1.17.1
6+
cftime==1.6.4.post1
7+
charset-normalizer==3.4.1
8+
click==8.1.8
9+
cloudpickle==3.1.1
10+
contourpy==1.3.2
11+
cryptography==44.0.2
12+
cycler==0.12.1
13+
dask==2025.3.0
14+
deprecation==2.1.0
15+
-e git+ssh://[email protected]/openego/eTraGo.git@1dfba2dac87c227cb7debfb0541036e486e9f8bc#egg=eTraGo
16+
fonttools==4.57.0
17+
fsspec==2025.3.2
18+
GeoAlchemy2==0.6.3
19+
geopandas==1.0.1
20+
greenlet==3.2.0
21+
gurobipy==10.0.0
22+
highspy==1.10.0
23+
idna==3.10
24+
importlib_metadata==8.6.1
25+
jaraco.classes==3.4.0
26+
jaraco.context==6.0.1
27+
jaraco.functools==4.1.0
28+
jeepney==0.9.0
29+
joblib==1.4.2
30+
keyring==25.6.0
31+
kiwisolver==1.4.8
32+
linopy==0.3.2
33+
locket==1.0.0
34+
loguru==0.7.3
35+
matplotlib==3.10.1
36+
more-itertools==10.6.0
37+
msgpack==1.1.0
38+
ndindex==1.9.2
39+
netCDF4==1.7.2
40+
networkx==3.4.2
41+
numexpr==2.10.2
42+
numpy==1.26.4
43+
oedialect==0.1.1
44+
packaging==24.2
45+
pandas==2.1.4
46+
partd==1.4.2
47+
pillow==11.2.1
48+
pkg_resources==0.0.0
49+
ply==3.11
50+
polars==1.27.1
51+
psycopg2-binary==2.9.10
52+
py-cpuinfo==9.0.0
53+
pycparser==2.22
54+
pyogrio==0.10.0
55+
Pyomo==6.5.0
56+
pyparsing==3.2.3
57+
pyproj==3.7.1
58+
pypsa==0.26.2
59+
python-dateutil==2.9.0.post0
60+
pytz==2025.2
61+
PyYAML==6.0.2
62+
requests==2.32.3
63+
rtree==1.4.0
64+
saio==0.2.1
65+
scikit-learn==1.6.1
66+
scipy==1.15.2
67+
SecretStorage==3.3.3
68+
shapely==2.1.0
69+
six==1.17.0
70+
SQLAlchemy==1.4.54
71+
tables==3.10.1
72+
threadpoolctl==3.6.0
73+
tilemapbase==0.4.5
74+
toolz==1.0.0
75+
tqdm==4.67.1
76+
tsam==2.3.6
77+
typing_extensions==4.13.2
78+
tzdata==2025.2
79+
urllib3==2.4.0
80+
validators==0.34.0
81+
xarray==2023.11.0
82+
zipp==3.21.0

0 commit comments

Comments
 (0)