@@ -238,9 +238,9 @@ def run_optimization_14a(edisgo):
238238edisgo .topology .grid_district ["geom" ] = mv_grid_geom .loc [0 , "geometry" ]
239239edisgo .topology .grid_district ["srid" ] = 4326
240240
241- # edisgo.topology.check_integrity()
242- # pypsa_n = edisgo.to_pypsa()
243- # edisgo.analyze()
241+ edisgo .topology .check_integrity ()
242+ pypsa_n = edisgo .to_pypsa ()
243+ edisgo .analyze ()
244244
245245############################# MANUAL FIXES ####################################
246246edisgo .topology .generators_df = edisgo .topology .generators_df [
@@ -262,13 +262,27 @@ def run_optimization_14a(edisgo):
262262 buses_with_existing_loads ,
263263)
264264
265+ #Temporary Check: Amount of CPs before importing eDisGo CPs
266+ names = edisgo .topology .loads_df .query ("type == 'charging_point'" ).index .astype (str )
267+ print ({
268+ "existing" : names .str .contains ("Existing" , case = False ).sum (),
269+ "additional" : names .str .contains ("Additional" , case = False ).sum (),
270+ "rest" : (~ (names .str .contains ("Existing" , case = False ) |
271+ names .str .contains ("Additional" , case = False ))).sum (),
272+ "total" : len (names )
273+ })
274+
265275# -------------------------
266276# Import + distribute + integrate EV data (creates new charging points)
267277# -------------------------
268278'''
269279After this function there are no time series yet. Only charging points and
270280a overall demand which is then transferred into a time series in
271281apply_charging_strategy.
282+
283+ Note: Afterwards there should be the Existing CP (411) and Additional CP (589)
284+ from the LoMa side for the 2035 scenario and all new eDisGo CP (for whole Husum
285+ there should be 2337). So the total should be 3337.
272286'''
273287edisgo .import_electromobility_14a (
274288 scenario = "eGon2035" ,
@@ -277,13 +291,25 @@ def run_optimization_14a(edisgo):
277291 },
278292)
279293
294+ #Temporary Check: Amount of CPs after importing eDisGo CPs
295+ names = edisgo .topology .loads_df .query ("type == 'charging_point'" ).index .astype (str )
296+ print ({
297+ "existing" : names .str .contains ("Existing" , case = False ).sum (),
298+ "additional" : names .str .contains ("Additional" , case = False ).sum (),
299+ "rest" : (~ (names .str .contains ("Existing" , case = False ) |
300+ names .str .contains ("Additional" , case = False ))).sum (),
301+ "total" : len (names )
302+ })
303+
280304# -------------------------
281- # Apply charging strategy (writes time series for the new integrated charging points from eDisGo)
305+ # Apply charging strategy
282306# -------------------------
283307'''
308+ This step created the time series for the new eDisGo charging points.
284309Without the preparation of Q before charging strategy I got an error while
285- apply_charging_strategy which was caused by deviating time index.
286- After this step only the charging point from eDisGo have a time series.
310+ apply_charging_strategy which was caused by a deviating time index.
311+
312+ Note: After this step ONLY the charging points from eDisGo have a time series.
287313'''
288314# Prepare Q before charging strategy
289315ti = edisgo .timeseries .timeindex
@@ -304,6 +330,10 @@ def run_optimization_14a(edisgo):
304330This step then finally transfers the time series from suitable eDisGo
305331charging_points to Existing_ und Additional_ charging points which are
306332created on the LoMa side.
333+
334+ Note: After this step there should be 411 Existing CP and 589 Additional for
335+ the 2035 scenario and 1337 eDisGo CP as 1000 of those were used for matching
336+ and transferring the time series and deleted afterwards.
307337'''
308338ev_match_results = transfer_ts_from_new_to_existing_cp (
309339 edisgo ,
@@ -314,6 +344,16 @@ def run_optimization_14a(edisgo):
314344 tol_2 = 0.9 ,
315345)
316346
347+ #Temporary Check: Amount of CPs fter transferring time series
348+ names = edisgo .topology .loads_df .query ("type == 'charging_point'" ).index .astype (str )
349+ print ({
350+ "existing" : names .str .contains ("Existing" , case = False ).sum (),
351+ "additional" : names .str .contains ("Additional" , case = False ).sum (),
352+ "rest" : (~ (names .str .contains ("Existing" , case = False ) |
353+ names .str .contains ("Additional" , case = False ))).sum (),
354+ "total" : len (names )
355+ })
356+
317357# ============================================================
318358# Optional Utilities for sensitivity analysis/chaning the amount of cp/hp
319359# - target by absolute value or relative percentage
@@ -324,23 +364,27 @@ def run_optimization_14a(edisgo):
324364Either by percentage or by a total amount including the infrastructure from
325365LoMa. When deleting CP/HP there is an option to export the deleted ones.
326366New CP/HP will have 'dup' in their name.
367+
368+ Note: for the 2035 scenario the target total would need to be set to 1000.
369+ CPs with the marker Additional and Existing in their name will be removed last.
370+ This way only the remaining 1337 eDisGo CP would be deleted.
327371'''
328372output_dir = "/home/paul/LoMa/test/shapes"
329373
330374cp_eligible_buses = buses_with_existing_loads (edisgo )
331375hp_eligible_buses = buses_with_existing_loads (edisgo )
332376
333- # change_cp_amount = set_charging_points_to_target(
334- # edisgo,
335- # target_total=500 , # sets total amount of CP to 1000
336- # #percentage=0.10, # increases total amount of CP by 10%
337- # #percentage=-0.10, # decreases total amount of CP by 10%
338- # eligible_buses=cp_eligible_buses,
339- # removal_priority=["Additional", "Existing"],
340- # add_tracking_columns=False,
341- # export_removed=True, # only applies when negative percentage for debugging
342- # export_dir=output_dir, # only applies when negative percentage for debugging
343- # )
377+ change_cp_amount = set_charging_points_to_target (
378+ edisgo ,
379+ target_total = 1000 , # sets total amount of CP to 1000
380+ #percentage=0.10, # increases total amount of CP by 10%
381+ #percentage=-0.10, # decreases total amount of CP by 10%
382+ eligible_buses = cp_eligible_buses ,
383+ removal_priority = ["Additional" , "Existing" ],
384+ add_tracking_columns = False ,
385+ export_removed = True , # only applies when there are deleted CP
386+ export_dir = output_dir , # only applies when there are deleted CP
387+ )
344388
345389# change_hp_amount = set_heat_pumps_to_target(
346390# edisgo,
@@ -349,10 +393,20 @@ def run_optimization_14a(edisgo):
349393# #percentage=-0.10, # decreases total amount of CP by 10%
350394# eligible_buses=hp_eligible_buses,
351395# add_tracking_columns=False,
352- # export_removed=True, # only applies when negative percentage for debugging
353- # export_dir=output_dir, # only applies when negative percentage for debugging
396+ # export_removed=True, # only applies when there are deleted HP
397+ # export_dir=output_dir, # only applies when there are deleted HP
354398# )
355399
400+ #Temporary Check: Amount of CPs after total amount changed
401+ names = edisgo .topology .loads_df .query ("type == 'charging_point'" ).index .astype (str )
402+ print ({
403+ "existing" : names .str .contains ("Existing" , case = False ).sum (),
404+ "additional" : names .str .contains ("Additional" , case = False ).sum (),
405+ "rest" : (~ (names .str .contains ("Existing" , case = False ) |
406+ names .str .contains ("Additional" , case = False ))).sum (),
407+ "total" : len (names )
408+ })
409+
356410############################ EV INTEGRATION PART ##############################
357411
358412# Set Zero active power for batteries (let the OPF optimize dispatch freely)
0 commit comments