eflips-depot 4.3.19__py3-none-any.whl → 4.4.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.
- eflips/depot/api/__init__.py +19 -304
- eflips/depot/api/private/depot.py +616 -524
- eflips/depot/api/private/results_to_database.py +2 -1
- eflips/depot/api/private/smart_charging.py +7 -6
- eflips/depot/api/private/util.py +3 -20
- {eflips_depot-4.3.19.dist-info → eflips_depot-4.4.0.dist-info}/METADATA +2 -1
- {eflips_depot-4.3.19.dist-info → eflips_depot-4.4.0.dist-info}/RECORD +9 -9
- {eflips_depot-4.3.19.dist-info → eflips_depot-4.4.0.dist-info}/LICENSE.md +0 -0
- {eflips_depot-4.3.19.dist-info → eflips_depot-4.4.0.dist-info}/WHEEL +0 -0
|
@@ -294,7 +294,8 @@ def complete_standby_departure_events(
|
|
|
294
294
|
# End time of a standby_departure will be the start of the following trip
|
|
295
295
|
if i == len(time_keys) - 1:
|
|
296
296
|
# The event reaches simulation end
|
|
297
|
-
end_time = latest_time
|
|
297
|
+
end_time = max(latest_time, max(time_keys))
|
|
298
|
+
# Lu: Apparently sometimes there are events going beyond the simulation end time?
|
|
298
299
|
else:
|
|
299
300
|
end_time = time_keys[i + 1]
|
|
300
301
|
|
|
@@ -6,7 +6,9 @@ import scipy
|
|
|
6
6
|
from eflips.model import Event, EventType
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def optimize_charging_events_even(
|
|
9
|
+
def optimize_charging_events_even(
|
|
10
|
+
charging_events: List[Event], debug_plots: bool = False
|
|
11
|
+
) -> None:
|
|
10
12
|
"""
|
|
11
13
|
This function optimizes the power draw of a list of charging events.
|
|
12
14
|
|
|
@@ -42,7 +44,6 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
42
44
|
# Also note down the peak power and transferred energy
|
|
43
45
|
params_for_events: List[Dict[str, float | np.ndarray | Event]] = []
|
|
44
46
|
for event in charging_events:
|
|
45
|
-
power_draw = np.zeros_like(total_time, dtype=float)
|
|
46
47
|
charging_allowed = np.zeros_like(total_time, dtype=int)
|
|
47
48
|
|
|
48
49
|
# Calculate the power draw vector, from the start SoC, end SoC and timeseries, if available
|
|
@@ -144,7 +145,7 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
144
145
|
scipy.integrate.trapezoid(optimized_power, total_time) / 3600
|
|
145
146
|
) # kWh
|
|
146
147
|
|
|
147
|
-
if
|
|
148
|
+
if debug_plots:
|
|
148
149
|
# Some plots for only this charging event
|
|
149
150
|
from matplotlib import pyplot as plt
|
|
150
151
|
|
|
@@ -152,7 +153,7 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
152
153
|
params_for_event["charging_allowed"] == 1
|
|
153
154
|
)[0]
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
_, axs = plt.subplots(3, 1, sharex=True)
|
|
156
157
|
axs[0].axhline(mean_power, color="red", linestyle="--", label="Mean power")
|
|
157
158
|
axs[0].plot(
|
|
158
159
|
total_time[valid_charging_indices],
|
|
@@ -256,10 +257,10 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
256
257
|
event.timeseries = None
|
|
257
258
|
|
|
258
259
|
# Now we have the power draw and charging allowed for each event
|
|
259
|
-
if
|
|
260
|
+
if debug_plots:
|
|
260
261
|
from matplotlib import pyplot as plt
|
|
261
262
|
|
|
262
|
-
|
|
263
|
+
_, axs = plt.subplots(3, 1, sharex=True)
|
|
263
264
|
total_power = np.sum(
|
|
264
265
|
[event["power_draw"] for event in params_for_events], axis=0
|
|
265
266
|
)
|
eflips/depot/api/private/util.py
CHANGED
|
@@ -20,7 +20,6 @@ from sqlalchemy import inspect, create_engine
|
|
|
20
20
|
from sqlalchemy.orm import Session
|
|
21
21
|
|
|
22
22
|
from eflips.depot import SimpleTrip, Timetable as EflipsTimeTable
|
|
23
|
-
from eflips.depot import VehicleType as EflipsVehicleType
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
@contextmanager
|
|
@@ -82,22 +81,6 @@ def create_session(
|
|
|
82
81
|
engine.dispose()
|
|
83
82
|
|
|
84
83
|
|
|
85
|
-
def vehicle_type_to_eflips(vt: VehicleType) -> EflipsVehicleType:
|
|
86
|
-
"""Convert a VehicleType object to an eflips-depot VehicleType object."""
|
|
87
|
-
|
|
88
|
-
# Create the depot VehicleType object
|
|
89
|
-
eflips_vehicle_type = EflipsVehicleType(
|
|
90
|
-
str(vt.id),
|
|
91
|
-
vt.battery_capacity,
|
|
92
|
-
0.0,
|
|
93
|
-
1.0,
|
|
94
|
-
1.0,
|
|
95
|
-
1.0,
|
|
96
|
-
vt.consumption,
|
|
97
|
-
)
|
|
98
|
-
return eflips_vehicle_type
|
|
99
|
-
|
|
100
|
-
|
|
101
84
|
def vehicle_type_to_global_constants_dict(vt: VehicleType) -> Dict[str, float]:
|
|
102
85
|
"""
|
|
103
86
|
This converts the VehicleType object into a dictionary, which is the input.
|
|
@@ -342,7 +325,7 @@ class VehicleSchedule:
|
|
|
342
325
|
)
|
|
343
326
|
if len(events) != len(trips):
|
|
344
327
|
raise ValueError(
|
|
345
|
-
f"Rotation {rot.id} has {len(trips)} trips but
|
|
328
|
+
f"Rotation {rot.id} has {len(trips)} trips but {len(events)} events."
|
|
346
329
|
)
|
|
347
330
|
if set([event.trip_id for event in events]) != set([trip.id for trip in trips]):
|
|
348
331
|
raise ValueError(f"The events of rotation {rot.id} do not match the trips.")
|
|
@@ -357,12 +340,12 @@ class VehicleSchedule:
|
|
|
357
340
|
start_depot = (
|
|
358
341
|
session.query(Depot)
|
|
359
342
|
.filter(Depot.station_id == trips[0].route.departure_station_id)
|
|
360
|
-
.
|
|
343
|
+
.one_or_none()
|
|
361
344
|
)
|
|
362
345
|
end_depot = (
|
|
363
346
|
session.query(Depot)
|
|
364
347
|
.filter(Depot.station_id == trips[-1].route.arrival_station_id)
|
|
365
|
-
.
|
|
348
|
+
.one_or_none()
|
|
366
349
|
)
|
|
367
350
|
|
|
368
351
|
if start_depot is None or end_depot is None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: eflips-depot
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.0
|
|
4
4
|
Summary: Depot Simulation for eFLIPS
|
|
5
5
|
Home-page: https://github.com/mpm-tu-berlin/eflips-depot
|
|
6
6
|
License: AGPL-3.0-or-later
|
|
@@ -18,6 +18,7 @@ Requires-Dist: eflips-model (>=5.0.0,<6.0.0)
|
|
|
18
18
|
Requires-Dist: pandas (>=2.1.4,<3.0.0)
|
|
19
19
|
Requires-Dist: scipy (>=1.13.1,<2.0.0)
|
|
20
20
|
Requires-Dist: simpy (>=4.0.1,<5.0.0)
|
|
21
|
+
Requires-Dist: tqdm (>=4.67.0,<5.0.0)
|
|
21
22
|
Requires-Dist: xlrd (<=1.2.0)
|
|
22
23
|
Requires-Dist: xlsxwriter (>=3.1.9,<4.0.0)
|
|
23
24
|
Project-URL: Repository, https://github.com/mpm-tu-berlin/eflips-depot
|
|
@@ -1,11 +1,11 @@
|
|
|
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=Usdwsf1OdyoRGJVsvaczuRortD5qRGo980-q_uOoxr8,45933
|
|
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/results_to_database.py,sha256=
|
|
7
|
-
eflips/depot/api/private/smart_charging.py,sha256=
|
|
8
|
-
eflips/depot/api/private/util.py,sha256=
|
|
5
|
+
eflips/depot/api/private/depot.py,sha256=v5Edb0sQP2QNIyBLvccVzAK9_kxCszar0cOu5ciFyrw,40780
|
|
6
|
+
eflips/depot/api/private/results_to_database.py,sha256=PIH1GWYpdtCQJRL7PEAy-Z0HFxB-g1KfIdemLsQd4Rs,24342
|
|
7
|
+
eflips/depot/api/private/smart_charging.py,sha256=MQ9fXdKByHAz6RSKXYcpJXDBccdJKZ2qGReCHagVCyo,13033
|
|
8
|
+
eflips/depot/api/private/util.py,sha256=gk5TJZrcvtkyrqnjR3Cq-hPRGRCovhzKz3LrBDIvN0E,16799
|
|
9
9
|
eflips/depot/configuration.py,sha256=Op3hlir-dEN7yHr0kTqbYANoCBKFWK6uKOv3NJl8w_w,35678
|
|
10
10
|
eflips/depot/depot.py,sha256=35P1P3jMBbfq9jevmZVI46oM82osEoDL_B6C65drww0,105711
|
|
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=VxcTzBaB67fNJUMmjPRwKXjhqTy6oQ41Coote2LvAmk,22338
|
|
38
38
|
eflips/depot/validation.py,sha256=TIuY7cQtEJI4H2VVMSuY5IIVkacEEZ67weeMuY3NSAM,7097
|
|
39
|
-
eflips_depot-4.
|
|
40
|
-
eflips_depot-4.
|
|
41
|
-
eflips_depot-4.
|
|
42
|
-
eflips_depot-4.
|
|
39
|
+
eflips_depot-4.4.0.dist-info/LICENSE.md,sha256=KB4XTk1fPHjtZCYDyPyreu6h1LVJVZXYg-5vePcWZAc,34143
|
|
40
|
+
eflips_depot-4.4.0.dist-info/METADATA,sha256=Qmweh--AZG_voe17R6in8ubAMemjwMtnVuZbQe5UEZE,5928
|
|
41
|
+
eflips_depot-4.4.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
42
|
+
eflips_depot-4.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|