eflips-depot 4.12.1__py3-none-any.whl → 4.13.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1135,13 +1135,11 @@ def generate_depot_optimal_size(
1135
1135
  logger = logging.getLogger(__name__)
1136
1136
 
1137
1137
  with create_session(scenario, database_url) as (session, scenario):
1138
- # Delete all vehicles and events, also disconnect the vehicles from the rotations
1139
- rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
1140
- rotation_q.update({"vehicle_id": None})
1141
- session.query(Event).filter(Event.scenario_id == scenario.id).delete()
1142
- session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
1138
+ # Delete all depot events
1139
+ session.query(Event).filter(
1140
+ Event.scenario_id == scenario.id, Event.area_id.isnot(None)
1141
+ ).delete()
1143
1142
 
1144
- # Handles existing depot
1145
1143
  if session.query(Depot).filter(Depot.scenario_id == scenario.id).count() != 0:
1146
1144
  if delete_existing_depot is False:
1147
1145
  raise ValueError(
@@ -1150,6 +1148,15 @@ def generate_depot_optimal_size(
1150
1148
 
1151
1149
  delete_depots(scenario, session)
1152
1150
 
1151
+ outer_savepoint = session.begin_nested()
1152
+ # Delete all vehicles and events, also disconnect the vehicles from the rotations
1153
+ rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
1154
+ rotation_q.update({"vehicle_id": None})
1155
+ session.query(Event).filter(Event.scenario_id == scenario.id).delete()
1156
+ session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
1157
+
1158
+ # Handles existing depot
1159
+
1153
1160
  ##### Step 0: Consumption Simulation #####
1154
1161
  # Run the consumption simulation for all depots
1155
1162
 
@@ -1189,7 +1196,7 @@ def generate_depot_optimal_size(
1189
1196
  len(rotations) for vehicle_type, rotations in vehicle_type_dict.items()
1190
1197
  )
1191
1198
 
1192
- savepoint = session.begin_nested()
1199
+ inner_savepoint = session.begin_nested()
1193
1200
  try:
1194
1201
  # (Temporarily) Delete all rotations not starting or ending at the station
1195
1202
  logger.debug(
@@ -1228,10 +1235,11 @@ def generate_depot_optimal_size(
1228
1235
  depot_capacities_for_scenario[station] = vt_capacities_for_station
1229
1236
  num_rotations_for_scenario[station] = rotation_count_depot
1230
1237
  finally:
1231
- savepoint.rollback()
1238
+ inner_savepoint.rollback()
1232
1239
 
1233
- # Create depot using the calculated capacities
1240
+ outer_savepoint.rollback()
1234
1241
 
1242
+ # Create depot using the calculated capacities
1235
1243
  for depot_station, capacities in depot_capacities_for_scenario.items():
1236
1244
  generate_depot(
1237
1245
  capacities,
@@ -1243,10 +1251,3 @@ def generate_depot_optimal_size(
1243
1251
  num_shunting_slots=num_rotations_for_scenario[depot_station] // 10,
1244
1252
  num_cleaning_slots=num_rotations_for_scenario[depot_station] // 10,
1245
1253
  )
1246
-
1247
- # Delete all vehicles and events again. Only depot layout is kept
1248
-
1249
- rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
1250
- rotation_q.update({"vehicle_id": None})
1251
- session.query(Event).filter(Event.scenario_id == scenario.id).delete()
1252
- session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
@@ -18,7 +18,8 @@ from eflips.model import (
18
18
  Depot,
19
19
  Temperatures,
20
20
  )
21
- from sqlalchemy import inspect, create_engine
21
+ from eflips.model import create_engine
22
+ from sqlalchemy import inspect
22
23
  from sqlalchemy.orm import Session
23
24
 
24
25
  from eflips.depot import SimpleTrip, Timetable as EflipsTimeTable
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: eflips-depot
3
- Version: 4.12.1
3
+ Version: 4.13.0
4
4
  Summary: Depot Simulation for eFLIPS
5
5
  License: AGPL-3.0-or-later
6
6
  Author: Enrico Lauth
@@ -13,8 +13,8 @@ Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Requires-Dist: eflips (>=0.1.3,<0.2.0)
16
- Requires-Dist: eflips-model (>8.1.0,<10.0.0)
17
- Requires-Dist: eflips-opt (>=0.3.3,<0.4.0)
16
+ Requires-Dist: eflips-model (>=10.0.0,<11.0.0)
17
+ Requires-Dist: eflips-opt (>=0.3.0,<0.4.0)
18
18
  Requires-Dist: pandas (>=2.2.0,<3.0.0)
19
19
  Requires-Dist: scipy (>=1.14.0,<2.0.0)
20
20
  Requires-Dist: simpy (>=4.0.1,<5.0.0)
@@ -1,11 +1,11 @@
1
1
  eflips/depot/__init__.py,sha256=06GUem0JIEunIyJ0_P_MLAGfibGEnNqcPPY0OBpO2NQ,1662
2
- eflips/depot/api/__init__.py,sha256=t5BsJIheFF9B2732j0bbWGo0dUE7gF5cxuIveJDICIU,55170
2
+ eflips/depot/api/__init__.py,sha256=bxxRaknhMc_9xxBATFe_bcGzZQI9sYDhYwRF5Z74B1E,55055
3
3
  eflips/depot/api/defaults/default_settings.json,sha256=0eUDTw_rtLQFvthP8oJL93iRXlmAOravAg-4qqGMQAY,5375
4
4
  eflips/depot/api/private/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  eflips/depot/api/private/consumption.py,sha256=nImegyhKrZlEwKTNdmAmDxjTQCvwfPgxA588e0M_F9o,27282
6
6
  eflips/depot/api/private/depot.py,sha256=YyC_jMDGkg8yOAiYkKzb5HboFM1P4x-GTJSfD8srdvE,43640
7
7
  eflips/depot/api/private/results_to_database.py,sha256=_qXB9046dWHek4ys669J3IojJt4xlZRkW1HxT7OTLFo,25524
8
- eflips/depot/api/private/util.py,sha256=rDqVuB4sllFZmNvXuDktIsFRoR9l-AWc4QM00e1Quvw,17966
8
+ eflips/depot/api/private/util.py,sha256=DasTkuGUhlBpY_BtTFWoxSNZU_CRyM3RqEDgO07Eks8,17990
9
9
  eflips/depot/configuration.py,sha256=Op3hlir-dEN7yHr0kTqbYANoCBKFWK6uKOv3NJl8w_w,35678
10
10
  eflips/depot/depot.py,sha256=pREutXtJlDxjgfwRobAy7UqTHh-tldbVWHN8DIyxs8s,106986
11
11
  eflips/depot/evaluation.py,sha256=qqXyP4jA1zFcKuWhliQ6n25ZlGl9mJV-vtXf0yu8WN8,140842
@@ -36,7 +36,7 @@ eflips/depot/simulation.py,sha256=ee0qTzOzG-8ybN36ie_NJallXfC7jUaS9JZvaYFziLs,10
36
36
  eflips/depot/smart_charging.py,sha256=C3BYqzn2-OYY4ipXm0ETtavbAM9QXZMYULBpVoChf0E,54311
37
37
  eflips/depot/standalone.py,sha256=8O01zEXghFG9zZBu0fUD0sXvbHQ-AXw6RB5M750a_sM,22419
38
38
  eflips/depot/validation.py,sha256=TIuY7cQtEJI4H2VVMSuY5IIVkacEEZ67weeMuY3NSAM,7097
39
- eflips_depot-4.12.1.dist-info/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
40
- eflips_depot-4.12.1.dist-info/METADATA,sha256=1txE-lc2o62p-gf7CLKUVQ4PWzDfn1-7axYKXeV1gGA,5985
41
- eflips_depot-4.12.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
42
- eflips_depot-4.12.1.dist-info/RECORD,,
39
+ eflips_depot-4.13.0.dist-info/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
40
+ eflips_depot-4.13.0.dist-info/METADATA,sha256=82eSbc6SK6ZRm8TyyGQTUzHdB1ELolId_gLS7BCxjTY,5987
41
+ eflips_depot-4.13.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
42
+ eflips_depot-4.13.0.dist-info/RECORD,,