@@ -28,6 +28,7 @@ def add_subnodes(
28
28
cop : xr .DataArray ,
29
29
direct_heat_source_utilisation_profile : xr .DataArray ,
30
30
head : int = 40 ,
31
+ dynamic_ptes_capacity : bool = False ,
31
32
) -> None :
32
33
"""
33
34
Add largest district heating systems subnodes to the network.
@@ -191,12 +192,30 @@ def add_subnodes(
191
192
.set_index ("Store" )
192
193
)
193
194
194
- # Restrict PTES capacity in subnodes if modeled as store
195
- if stores .carrier .str .contains ("pits$" ).any ():
196
- stores .loc [stores .carrier .str .contains ("pits$" ).index , "e_nom_max" ] = (
197
- subnode ["ptes_pot_mwh" ]
195
+ # Restrict PTES capacity in subnodes
196
+ stores .loc [stores .carrier .str .contains ("pits$" ).index , "e_nom_max" ] = subnode [
197
+ "ptes_pot_mwh"
198
+ ]
199
+
200
+ #
201
+
202
+ if dynamic_ptes_capacity :
203
+ e_max_pu_static = stores .e_max_pu
204
+ e_max_pu = (
205
+ n .stores_t .e_max_pu [f"{ subnode ['cluster' ]} urban central water pits" ]
206
+ .rename (f"{ name } water pits" )
207
+ .to_frame ()
208
+ .reindex (columns = stores .index )
209
+ .fillna (e_max_pu_static )
198
210
)
199
- n .add ("Store" , stores .index , ** stores )
211
+ n .add (
212
+ "Store" ,
213
+ stores .index ,
214
+ e_max_pu = e_max_pu ,
215
+ ** stores .drop ("e_max_pu" , axis = 1 ),
216
+ )
217
+ else :
218
+ n .add ("Store" , stores .index , ** stores )
200
219
201
220
# Replicate district heating storage units of mother node for subnodes
202
221
storage_units = (
@@ -211,30 +230,8 @@ def add_subnodes(
211
230
.set_index ("StorageUnit" )
212
231
)
213
232
214
- # Restrict PTES capacity in subnodes if modeled as storage unit
215
- if storage_units .carrier .str .contains ("pits$" ).any ():
216
- storage_units .loc [
217
- storage_units .carrier .str .contains ("pits$" ), "p_nom_max"
218
- ] = (subnode ["ptes_pot_mwh" ] / storage_units ["max_hours" ])
219
233
n .add ("StorageUnit" , storage_units .index , ** storage_units )
220
234
221
- # restrict PTES capacity in mother nodes
222
- mother_nodes_ptes_pot = subnodes_rest .groupby ("cluster" ).ptes_pot_mwh .sum ()
223
-
224
- mother_nodes_ptes_pot .index = (
225
- mother_nodes_ptes_pot .index + " urban central water pits"
226
- )
227
-
228
- if not n .storage_units .filter (like = "urban central water pits" , axis = 0 ).empty :
229
- n .storage_units .loc [mother_nodes_ptes_pot .index , "p_nom_max" ] = (
230
- mother_nodes_ptes_pot
231
- / n .storage_units .loc [mother_nodes_ptes_pot .index , "max_hours" ]
232
- )
233
- elif not n .stores .filter (like = "urban central water pits" , axis = 0 ).empty :
234
- n .stores .loc [mother_nodes_ptes_pot .index , "e_nom_max" ] = (
235
- mother_nodes_ptes_pot
236
- )
237
-
238
235
# Replicate district heating generators of mother node for subnodes
239
236
generators = (
240
237
n .generators .filter (like = f"{ subnode ['cluster' ]} urban central" , axis = 0 )
@@ -458,6 +455,9 @@ def extend_heating_distribution(
458
455
snakemake .input .direct_heat_source_utilisation_profiles
459
456
),
460
457
head = snakemake .params .district_heating ["subnodes" ]["nlargest" ],
458
+ dynamic_ptes_capacity = snakemake .params .district_heating ["ptes" ][
459
+ "dynamic_capacity"
460
+ ],
461
461
)
462
462
463
463
if snakemake .wildcards .planning_horizons == str (snakemake .params ["baseyear" ]):
0 commit comments