eflips-depot 4.14.2__py3-none-any.whl → 4.14.3__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.

Potentially problematic release.


This version of eflips-depot might be problematic. Click here for more details.

@@ -1381,10 +1381,11 @@ def auto_generate_depot_inplace(
1381
1381
  for trip in rot.trips:
1382
1382
  for stop_time in trip.stop_times:
1383
1383
  to_delete.append(stop_time)
1384
+ for event in trip.events:
1385
+ to_delete.append(event)
1384
1386
  to_delete.append(trip)
1385
1387
  to_delete.append(rot)
1386
1388
 
1387
- # debugging
1388
1389
  for obj in to_delete:
1389
1390
  session.flush()
1390
1391
  session.delete(obj)
@@ -1392,13 +1393,49 @@ def auto_generate_depot_inplace(
1392
1393
 
1393
1394
  # Consumption simulation for rotations of this depot
1394
1395
 
1395
- consumption_results = generate_consumption_result(scenario)
1396
- simple_consumption_simulation(
1397
- scenario,
1398
- initialize_vehicles=True,
1399
- consumption_result=consumption_results,
1396
+ # if the driving events are already in the database, we do not need to run the consumption simulation again
1397
+ current_driving_trips = (
1398
+ session.query(Event.trip_id)
1399
+ .filter(
1400
+ Event.scenario_id == scenario.id, Event.event_type == EventType.DRIVING
1401
+ )
1402
+ .all()
1403
+ )
1404
+ current_trips = (
1405
+ session.query(Trip.id).filter(Trip.scenario_id == scenario.id).all()
1400
1406
  )
1401
1407
 
1408
+ # if the two lists are identical, we can skip the consumption simulation
1409
+ if set([t[0] for t in current_driving_trips]) != set(
1410
+ [t[0] for t in current_trips]
1411
+ ):
1412
+ logger.info(
1413
+ "Running eflips consumption simulation for depot layout generation since the driving events do not cover all trips"
1414
+ )
1415
+ driving_events_to_delete = (
1416
+ session.query(Event)
1417
+ .filter(
1418
+ Event.scenario_id == scenario.id,
1419
+ Event.event_type == EventType.DRIVING,
1420
+ )
1421
+ .all()
1422
+ )
1423
+ if len(driving_events_to_delete) > 0:
1424
+ logger.info(
1425
+ "Deleting existing driving events before running consumption simulation"
1426
+ )
1427
+ for event in driving_events_to_delete:
1428
+ session.delete(event)
1429
+ session.flush()
1430
+
1431
+ logger.warning("Starting eflips consumption sim")
1432
+ consumption_results = generate_consumption_result(scenario)
1433
+ simple_consumption_simulation(
1434
+ scenario,
1435
+ initialize_vehicles=True,
1436
+ consumption_result=consumption_results,
1437
+ )
1438
+
1402
1439
  logger.info(f"Generating depot layout for station {station.name}")
1403
1440
  vt_capacities_for_station = depot_smallest_possible_size(
1404
1441
  station,
@@ -1460,9 +1497,9 @@ def generate_optimal_depot_layout(
1460
1497
  """
1461
1498
 
1462
1499
  with create_session(scenario, database_url) as (session, scenario):
1463
- # Delete all depot events
1500
+ # Delete all non-Driving events
1464
1501
  session.query(Event).filter(
1465
- Event.scenario_id == scenario.id, Event.area_id.isnot(None)
1502
+ Event.scenario_id == scenario.id, Event.event_type != EventType.DRIVING
1466
1503
  ).delete()
1467
1504
 
1468
1505
  if session.query(Depot).filter(Depot.scenario_id == scenario.id).count() != 0:
@@ -1486,9 +1523,7 @@ def generate_optimal_depot_layout(
1486
1523
  # Delete all vehicles and events, also disconnect the vehicles from the rotations
1487
1524
  rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
1488
1525
  rotation_q.update({"vehicle_id": None})
1489
- session.query(Event).filter(Event.scenario_id == scenario.id).delete()
1490
- session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
1491
- session.expire_all()
1526
+
1492
1527
  for depot_wish in depot_config_wishes:
1493
1528
  if depot_wish.auto_generate is False:
1494
1529
  continue
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eflips-depot
3
- Version: 4.14.2
3
+ Version: 4.14.3
4
4
  Summary: Depot Simulation for eFLIPS
5
5
  License: AGPL-3.0-or-later
6
6
  License-File: LICENSE.md
@@ -1,5 +1,5 @@
1
1
  eflips/depot/__init__.py,sha256=FCVnYU7aSfR4BNCo722I1V3uU5336qr1tTt-zT6X4UI,1555
2
- eflips/depot/api/__init__.py,sha256=TDjYjf2h_oBwm3Wmcw1J1RQrV2xct7ETOMsgVZ6c30A,65406
2
+ eflips/depot/api/__init__.py,sha256=B1Ph7nQd0W0-Io2tInnaw07bzxCXK7d1M7oWbr1jN8I,66813
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=0wfI3ryfZS9qUqPbJP0okvwY2s6ogylw1PZFyAnCRf4,28915
@@ -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.14.2.dist-info/METADATA,sha256=UvewbAnnEpknimQuan3FpVOmSmBXAvXmFPtfSxZbUdI,5961
40
- eflips_depot-4.14.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
41
- eflips_depot-4.14.2.dist-info/licenses/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
42
- eflips_depot-4.14.2.dist-info/RECORD,,
39
+ eflips_depot-4.14.3.dist-info/METADATA,sha256=7kG6MB_RgTTOyfwBxNFRle9rfIvnk3bLm5CIGHsygwk,5961
40
+ eflips_depot-4.14.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
41
+ eflips_depot-4.14.3.dist-info/licenses/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
42
+ eflips_depot-4.14.3.dist-info/RECORD,,