eflips-depot 4.1.2__py3-none-any.whl → 4.1.4__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.
- eflips/depot/api/__init__.py +17 -64
- eflips/depot/api/private/depot.py +1 -1
- eflips/depot/api/private/smart_charging.py +7 -5
- eflips/depot/api/private/util.py +6 -0
- eflips/depot/processes.py +5 -5
- {eflips_depot-4.1.2.dist-info → eflips_depot-4.1.4.dist-info}/METADATA +1 -1
- {eflips_depot-4.1.2.dist-info → eflips_depot-4.1.4.dist-info}/RECORD +9 -9
- {eflips_depot-4.1.2.dist-info → eflips_depot-4.1.4.dist-info}/LICENSE.md +0 -0
- {eflips_depot-4.1.2.dist-info → eflips_depot-4.1.4.dist-info}/WHEEL +0 -0
eflips/depot/api/__init__.py
CHANGED
|
@@ -33,6 +33,7 @@ import warnings
|
|
|
33
33
|
from collections import OrderedDict
|
|
34
34
|
from datetime import timedelta
|
|
35
35
|
from enum import Enum
|
|
36
|
+
from math import ceil
|
|
36
37
|
from typing import Any, Dict, Optional, Union, List
|
|
37
38
|
|
|
38
39
|
import numpy as np
|
|
@@ -47,7 +48,6 @@ from eflips.model import (
|
|
|
47
48
|
Trip,
|
|
48
49
|
Vehicle,
|
|
49
50
|
)
|
|
50
|
-
from math import ceil
|
|
51
51
|
from sqlalchemy.orm import Session
|
|
52
52
|
from sqlalchemy.sql import select
|
|
53
53
|
|
|
@@ -1017,21 +1017,22 @@ def _get_finished_schedules_per_vehicle(
|
|
|
1017
1017
|
"type": "Trip",
|
|
1018
1018
|
"id": int(current_trip.ID),
|
|
1019
1019
|
}
|
|
1020
|
-
|
|
1021
1020
|
if i == 0:
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1021
|
+
raise ValueError(
|
|
1022
|
+
f"New Vehicle required for the trip {current_trip.ID}, which suggests the fleet or the "
|
|
1023
|
+
f"infrastructure might not be enough for the full electrification. Please add charging "
|
|
1024
|
+
f"interfaces or increase charging power ."
|
|
1025
|
+
)
|
|
1026
1026
|
|
|
1027
|
-
|
|
1027
|
+
elif i == len(list_of_finished_trips) - 1:
|
|
1028
1028
|
earliest_time = list_of_finished_trips[i - 1].atd
|
|
1029
|
+
latest_time = list_of_finished_trips[i].ata
|
|
1029
1030
|
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1031
|
+
else:
|
|
1032
|
+
if list_of_finished_trips[i - 1].is_copy is True:
|
|
1033
|
+
earliest_time = list_of_finished_trips[i - 1].ata
|
|
1034
|
+
if list_of_finished_trips[i + 1].is_copy is True:
|
|
1035
|
+
latest_time = list_of_finished_trips[i + 1].atd
|
|
1035
1036
|
|
|
1036
1037
|
return finished_schedules, earliest_time, latest_time
|
|
1037
1038
|
|
|
@@ -1270,7 +1271,11 @@ def _add_soc_to_events(dict_of_events, battery_log) -> None:
|
|
|
1270
1271
|
if log[0] < process_dict["end"] < battery_log_list[j + 1][0]:
|
|
1271
1272
|
soc_end = log[1]
|
|
1272
1273
|
|
|
1274
|
+
if soc_start is not None:
|
|
1275
|
+
soc_start = min(soc_start, 1) # so
|
|
1273
1276
|
process_dict["soc_start"] = soc_start
|
|
1277
|
+
if soc_end is not None:
|
|
1278
|
+
soc_end = min(soc_end, 1) # soc should not exceed 1
|
|
1274
1279
|
process_dict["soc_end"] = soc_end
|
|
1275
1280
|
|
|
1276
1281
|
else:
|
|
@@ -1348,58 +1353,6 @@ def _add_events_into_database(
|
|
|
1348
1353
|
|
|
1349
1354
|
session.add(current_event)
|
|
1350
1355
|
|
|
1351
|
-
# For non-copy schedules with no predecessor events, adding a dummy standby-departure
|
|
1352
|
-
|
|
1353
|
-
time_keys = sorted(dict_of_events.keys())
|
|
1354
|
-
if (
|
|
1355
|
-
dict_of_events[time_keys[0]]["type"]
|
|
1356
|
-
== "Trip"
|
|
1357
|
-
# and dict_of_events[time_keys[0]]["is_copy"] is False
|
|
1358
|
-
):
|
|
1359
|
-
standby_start = time_keys[0] - 1
|
|
1360
|
-
standby_end = time_keys[0]
|
|
1361
|
-
rotation_id = int(dict_of_events[time_keys[0]]["id"])
|
|
1362
|
-
area = (
|
|
1363
|
-
session.query(Area)
|
|
1364
|
-
.filter(Area.vehicle_type_id == db_vehicle.vehicle_type_id)
|
|
1365
|
-
.first()
|
|
1366
|
-
)
|
|
1367
|
-
|
|
1368
|
-
first_trip = (
|
|
1369
|
-
session.query(Trip)
|
|
1370
|
-
.filter(Trip.rotation_id == rotation_id)
|
|
1371
|
-
.order_by(Trip.departure_time)
|
|
1372
|
-
.first()
|
|
1373
|
-
)
|
|
1374
|
-
|
|
1375
|
-
soc = (
|
|
1376
|
-
session.query(Event.soc_end)
|
|
1377
|
-
.filter(Event.scenario == scenario)
|
|
1378
|
-
.filter(Event.trip_id == first_trip.id)
|
|
1379
|
-
.first()[0]
|
|
1380
|
-
)
|
|
1381
|
-
|
|
1382
|
-
standby_event = Event(
|
|
1383
|
-
scenario=scenario,
|
|
1384
|
-
vehicle_type_id=db_vehicle.vehicle_type_id,
|
|
1385
|
-
vehicle=db_vehicle,
|
|
1386
|
-
station_id=None,
|
|
1387
|
-
area_id=area.id,
|
|
1388
|
-
subloc_no=area.capacity,
|
|
1389
|
-
trip_id=None,
|
|
1390
|
-
time_start=timedelta(seconds=standby_start) + simulation_start_time,
|
|
1391
|
-
time_end=timedelta(seconds=standby_end) + simulation_start_time,
|
|
1392
|
-
soc_start=soc,
|
|
1393
|
-
soc_end=soc,
|
|
1394
|
-
event_type=EventType.STANDBY_DEPARTURE,
|
|
1395
|
-
description=f"DUMMY Standby event for {rotation_id}.",
|
|
1396
|
-
timeseries=None,
|
|
1397
|
-
)
|
|
1398
|
-
|
|
1399
|
-
session.add(standby_event)
|
|
1400
|
-
|
|
1401
|
-
session.flush()
|
|
1402
|
-
|
|
1403
1356
|
|
|
1404
1357
|
def _update_vehicle_in_rotation(session, scenario, list_of_assigned_schedules) -> None:
|
|
1405
1358
|
"""
|
|
@@ -153,7 +153,7 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
153
153
|
|
|
154
154
|
# Make sure the transferred energy is the same
|
|
155
155
|
post_opt_energy = (
|
|
156
|
-
scipy.integrate.
|
|
156
|
+
scipy.integrate.trapezoid(optimized_power, total_time) / 3600
|
|
157
157
|
) # kWh
|
|
158
158
|
|
|
159
159
|
if False:
|
|
@@ -238,7 +238,7 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
238
238
|
) # +1 to include the last index
|
|
239
239
|
powers = params_for_event["optimized_power"][start_index:end_index]
|
|
240
240
|
|
|
241
|
-
energies = scipy.integrate.
|
|
241
|
+
energies = scipy.integrate.cumulative_trapezoid(powers, initial=0) / (
|
|
242
242
|
3600 / TEMPORAL_RESOLUTION.total_seconds()
|
|
243
243
|
) # kWh
|
|
244
244
|
socs = event.soc_start + energies / event.vehicle.vehicle_type.battery_capacity
|
|
@@ -306,13 +306,15 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
306
306
|
)
|
|
307
307
|
|
|
308
308
|
# Energy transferred
|
|
309
|
-
total_energy = scipy.integrate.
|
|
309
|
+
total_energy = scipy.integrate.cumulative_trapezoid(
|
|
310
|
+
total_power, total_time, initial=0
|
|
311
|
+
)
|
|
310
312
|
axs[1].plot(total_time, total_energy, label="Original energy transferred")
|
|
311
|
-
optimized_energy = scipy.integrate.
|
|
313
|
+
optimized_energy = scipy.integrate.cumulative_trapezoid(
|
|
312
314
|
optimized_power, total_time, initial=0
|
|
313
315
|
)
|
|
314
316
|
axs[1].plot(total_time, optimized_energy, label="Optimized energy transferred")
|
|
315
|
-
optimized_energy2 = scipy.integrate.
|
|
317
|
+
optimized_energy2 = scipy.integrate.cumulative_trapezoid(
|
|
316
318
|
optimized_power2, total_time, initial=0
|
|
317
319
|
)
|
|
318
320
|
axs[1].plot(total_time, optimized_energy2, label="Mean energy transferred")
|
eflips/depot/api/private/util.py
CHANGED
|
@@ -130,6 +130,12 @@ def repeat_vehicle_schedules(
|
|
|
130
130
|
|
|
131
131
|
for vehicle_schedule in vehicle_schedules:
|
|
132
132
|
schedule_list_backward.append(vehicle_schedule.repeat(-repetition_period))
|
|
133
|
+
if repetition_period == timedelta(days=1):
|
|
134
|
+
# For daily schedules, repeat the schedule backward twice for the stability of the results
|
|
135
|
+
schedule_list_backward.append(
|
|
136
|
+
vehicle_schedule.repeat(-2 * repetition_period)
|
|
137
|
+
)
|
|
138
|
+
|
|
133
139
|
schedule_list_forward.append(vehicle_schedule.repeat(repetition_period))
|
|
134
140
|
|
|
135
141
|
vehicle_schedules = (
|
eflips/depot/processes.py
CHANGED
|
@@ -575,11 +575,11 @@ class VehicleProcess(BaseDepotProcess, ABC):
|
|
|
575
575
|
]
|
|
576
576
|
)
|
|
577
577
|
):
|
|
578
|
-
flexprint(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
)
|
|
578
|
+
# flexprint(
|
|
579
|
+
# "NOTIFYING ASSIGNMENT AFTER %s END for vehicle %s"
|
|
580
|
+
# % (self.ID, self.vehicle.ID),
|
|
581
|
+
# env=self.env,
|
|
582
|
+
# )
|
|
583
583
|
|
|
584
584
|
self.vehicle.dwd.current_depot.depot_control.trigger_dispatch()
|
|
585
585
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
eflips/depot/__init__.py,sha256=n7jte8R6j_Ad4Mp4hkklKwil5r8u8Q_SbXrCC-nf5jM,1556
|
|
2
|
-
eflips/depot/api/__init__.py,sha256=
|
|
2
|
+
eflips/depot/api/__init__.py,sha256=ONSNwj4H8bPnOdRc49ooMQhHQuDM-Q6JQk16URDgkMc,65235
|
|
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
|
-
eflips/depot/api/private/depot.py,sha256=
|
|
6
|
-
eflips/depot/api/private/smart_charging.py,sha256=
|
|
7
|
-
eflips/depot/api/private/util.py,sha256=
|
|
5
|
+
eflips/depot/api/private/depot.py,sha256=pgLk9rdjZthk35vKCTmcl4VfjYQJRnqR-CPGwBs_9zk,18111
|
|
6
|
+
eflips/depot/api/private/smart_charging.py,sha256=JqYlUv_TnEqnp1Ks3FV3Od2rkYMOSORfUhrxZ49lUyE,13775
|
|
7
|
+
eflips/depot/api/private/util.py,sha256=0l1ZFtMamdapPjk3OXiGCP5STefmN6b-RlfUyMd9PbQ,17017
|
|
8
8
|
eflips/depot/configuration.py,sha256=Op3hlir-dEN7yHr0kTqbYANoCBKFWK6uKOv3NJl8w_w,35678
|
|
9
9
|
eflips/depot/depot.py,sha256=afIlaiX-J-M5-K_oAGMr_soL3_QjIAwrQKDaZzTwle0,105566
|
|
10
10
|
eflips/depot/evaluation.py,sha256=qqXyP4jA1zFcKuWhliQ6n25ZlGl9mJV-vtXf0yu8WN8,140842
|
|
@@ -26,7 +26,7 @@ eflips/depot/layout_opt/settings.py,sha256=EUGCp4dAX22j2uF8sKqbi9a5iP8hb6QpP7t2N
|
|
|
26
26
|
eflips/depot/layout_opt/template_creation.py,sha256=H4LoFjQfbPjTt9rGvapH2tEUWcQ56kPwDucq7t6YahU,9736
|
|
27
27
|
eflips/depot/layout_opt/util.py,sha256=EYh7IN58ZjysmCFdSieQqIQ9goe1a_ZwARRHxOgjEQo,3780
|
|
28
28
|
eflips/depot/plots.py,sha256=85xInZWfJIOVm03onvppgP5yLTgQeMn-1t5aoNdavyY,2509
|
|
29
|
-
eflips/depot/processes.py,sha256=
|
|
29
|
+
eflips/depot/processes.py,sha256=Z7Bu2I8K_JcXkVMs54ljzO1g5iTju4zlmAUL2KGkz0Y,58767
|
|
30
30
|
eflips/depot/rating.py,sha256=vBUr3y31DBcA-LjZW8t6wLfpAsuB8DPkrMThtCtN908,16648
|
|
31
31
|
eflips/depot/resources.py,sha256=0SuzN8qgMmCqa7oUEXVC_XE6pCUtxTsqOfCsaM9Oh3o,13568
|
|
32
32
|
eflips/depot/settings_config.py,sha256=z7CqPdjd8QRlgZj0Zis-H13cL7LOiheRT4ctYCYGguc,2527
|
|
@@ -35,7 +35,7 @@ eflips/depot/simulation.py,sha256=ee0qTzOzG-8ybN36ie_NJallXfC7jUaS9JZvaYFziLs,10
|
|
|
35
35
|
eflips/depot/smart_charging.py,sha256=C3BYqzn2-OYY4ipXm0ETtavbAM9QXZMYULBpVoChf0E,54311
|
|
36
36
|
eflips/depot/standalone.py,sha256=VxcTzBaB67fNJUMmjPRwKXjhqTy6oQ41Coote2LvAmk,22338
|
|
37
37
|
eflips/depot/validation.py,sha256=TIuY7cQtEJI4H2VVMSuY5IIVkacEEZ67weeMuY3NSAM,7097
|
|
38
|
-
eflips_depot-4.1.
|
|
39
|
-
eflips_depot-4.1.
|
|
40
|
-
eflips_depot-4.1.
|
|
41
|
-
eflips_depot-4.1.
|
|
38
|
+
eflips_depot-4.1.4.dist-info/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
|
|
39
|
+
eflips_depot-4.1.4.dist-info/METADATA,sha256=AWjHM-eLPTc_TfvBnUqcrDMJKqWN8_H4C0g7AaIdAXk,5839
|
|
40
|
+
eflips_depot-4.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
41
|
+
eflips_depot-4.1.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|