eflips-depot 4.0.0__tar.gz → 4.0.2__tar.gz

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.

Files changed (41) hide show
  1. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/PKG-INFO +1 -1
  2. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/private/smart_charging.py +42 -37
  3. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/pyproject.toml +1 -1
  4. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/LICENSE.md +0 -0
  5. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/README.md +0 -0
  6. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/__init__.py +0 -0
  7. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/__init__.py +0 -0
  8. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/defaults/default_settings.json +0 -0
  9. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/private/__init__.py +0 -0
  10. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/private/depot.py +0 -0
  11. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/api/private/util.py +0 -0
  12. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/configuration.py +0 -0
  13. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/depot.py +0 -0
  14. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/evaluation.py +0 -0
  15. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/filters.py +0 -0
  16. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/input_epex_power_price.py +0 -0
  17. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/__init__.py +0 -0
  18. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/doc/__init__.py +0 -0
  19. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/doc/direct_details.pdf +0 -0
  20. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/evaluation.py +0 -0
  21. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/__init__.py +0 -0
  22. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/crossover.py +0 -0
  23. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py +0 -0
  24. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/fitness_util.py +0 -0
  25. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/init.py +0 -0
  26. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/opt_tools/mutation.py +0 -0
  27. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/optimize_c_urfd.py +0 -0
  28. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/packing.py +0 -0
  29. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/settings.py +0 -0
  30. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/template_creation.py +0 -0
  31. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/layout_opt/util.py +0 -0
  32. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/plots.py +0 -0
  33. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/processes.py +0 -0
  34. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/rating.py +0 -0
  35. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/resources.py +0 -0
  36. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/settings_config.py +0 -0
  37. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/simple_vehicle.py +0 -0
  38. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/simulation.py +0 -0
  39. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/smart_charging.py +0 -0
  40. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/standalone.py +0 -0
  41. {eflips_depot-4.0.0 → eflips_depot-4.0.2}/eflips/depot/validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eflips-depot
3
- Version: 4.0.0
3
+ Version: 4.0.2
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
@@ -40,10 +40,10 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
40
40
 
41
41
  # For each event, create an array of power draws and a boolean array of charging allowed
42
42
  # Also note down the peak power and transferred energy
43
- params_for_events: List[Dict[str, float | np.ndarray]] = []
43
+ params_for_events: List[Dict[str, float | np.ndarray | Event]] = []
44
44
  for event in charging_events:
45
- power_draw = np.zeros(total_duration, dtype=float)
46
- charging_allowed = np.zeros(total_duration, dtype=int)
45
+ power_draw = np.zeros_like(total_time, dtype=float)
46
+ charging_allowed = np.zeros_like(total_time, dtype=int)
47
47
 
48
48
  # Calculate the power draw vector, from the start SoC, end SoC and timeseries, if available
49
49
  event_soc = [event.soc_start]
@@ -80,6 +80,7 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
80
80
 
81
81
  params_for_events.append(
82
82
  {
83
+ "event": event,
83
84
  "power_draw": expanded_power,
84
85
  "charging_allowed": charging_allowed,
85
86
  "max_power": max_power,
@@ -230,6 +231,44 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
230
231
  params_for_event["optimized_power"] = optimized_power
231
232
  params_for_event["optimized_power2"] = optimized_power2
232
233
 
234
+ event = params_for_event["event"]
235
+ start_index = int((event.time_start - start_time) / TEMPORAL_RESOLUTION)
236
+ end_index = (
237
+ int((event.time_end - start_time) / TEMPORAL_RESOLUTION) + 1
238
+ ) # +1 to include the last index
239
+ powers = params_for_event["optimized_power"][start_index:end_index]
240
+
241
+ energies = scipy.integrate.cumtrapz(powers, initial=0) / (
242
+ 3600 / TEMPORAL_RESOLUTION.total_seconds()
243
+ ) # kWh
244
+ socs = event.soc_start + energies / event.vehicle.vehicle_type.battery_capacity
245
+
246
+ # Make sure the last SoC is the same as the end SoC
247
+ assert np.isclose(socs[-1], event.soc_end, atol=0.01)
248
+ # Make sure the first SoC is the same as the start SoC
249
+ assert np.isclose(socs[0], event.soc_start, atol=0.01)
250
+
251
+ # Make the socs match exactly, setting all those smaller than the start SoC to the start SoC and
252
+ # all those larger than the end SoC to the end SoC
253
+ socs[socs < event.soc_start] = event.soc_start
254
+ socs[socs > event.soc_end] = event.soc_end
255
+
256
+ # Add a timeseries to the event, removing the first and last index, since they will be the same as the start and
257
+ # end SoC
258
+ event.timeseries = {
259
+ "time": [
260
+ datetime.fromtimestamp(t).astimezone().isoformat()
261
+ for t in total_time[start_index:end_index]
262
+ ][
263
+ 1:-1
264
+ ], # Remove the first and last index
265
+ "soc": socs.tolist()[1:-1],
266
+ }
267
+ if event.timeseries["time"][0] < event.time_start.isoformat():
268
+ event.timeseries["time"][0] = event.time_start.isoformat()
269
+ if event.timeseries["time"][-1] > event.time_end.isoformat():
270
+ event.timeseries["time"][-1] = event.time_end.isoformat()
271
+
233
272
  # Now we have the power draw and charging allowed for each event
234
273
  if False:
235
274
  from matplotlib import pyplot as plt
@@ -284,37 +323,3 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
284
323
  axs[2].set_xlabel("Time")
285
324
  axs[2].set_ylabel("Vehicle count")
286
325
  plt.show()
287
-
288
- # Finally, update the events in the database
289
- for i in range(len(charging_events)):
290
- event = charging_events[i]
291
- start_index = int((event.time_start - start_time) / TEMPORAL_RESOLUTION)
292
- end_index = int((event.time_end - start_time) / TEMPORAL_RESOLUTION)
293
- powers = params_for_events[i]["optimized_power"][start_index:end_index]
294
- energies = scipy.integrate.cumtrapz(powers, initial=0) / (
295
- 3600 / TEMPORAL_RESOLUTION.total_seconds()
296
- ) # kWh
297
- socs = event.soc_start + energies / event.vehicle.vehicle_type.battery_capacity
298
-
299
- # Make sure the last SoC is the same as the end SoC
300
- assert np.isclose(socs[-1], event.soc_end, atol=0.01)
301
- # Make sure the first SoC is the same as the start SoC
302
- assert np.isclose(socs[0], event.soc_start, atol=0.01)
303
-
304
- # Make the socs match exactly, setting all those smaller than the start SoC to the start SoC and
305
- # all those larger than the end SoC to the end SoC
306
- socs[socs < event.soc_start] = event.soc_start
307
- socs[socs > event.soc_end] = event.soc_end
308
-
309
- # Add a timeseries to the event
310
- event.timeseries = {
311
- "time": [
312
- datetime.fromtimestamp(t).astimezone().isoformat()
313
- for t in total_time[start_index:end_index]
314
- ],
315
- "soc": socs.tolist(),
316
- }
317
- if event.timeseries["time"][0] < event.time_start.isoformat():
318
- event.timeseries["time"][0] = event.time_start.isoformat()
319
- if event.timeseries["time"][-1] > event.time_end.isoformat():
320
- event.timeseries["time"][-1] = event.time_end.isoformat()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "eflips-depot"
3
- version = "4.0.0"
3
+ version = "4.0.2"
4
4
  description = "Depot Simulation for eFLIPS"
5
5
  authors = ["Enrico Lauth <enrico.lauth@tu-berlin.de>",
6
6
  "Ludger Heide <ludger.heide@tu-berlin.de",
File without changes
File without changes