eflips-depot 4.0.0__tar.gz → 4.0.1__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.
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/PKG-INFO +1 -1
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/private/smart_charging.py +39 -37
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/pyproject.toml +1 -1
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/LICENSE.md +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/README.md +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/defaults/default_settings.json +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/private/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/private/depot.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/api/private/util.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/configuration.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/depot.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/evaluation.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/filters.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/input_epex_power_price.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/doc/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/doc/direct_details.pdf +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/evaluation.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/__init__.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/crossover.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/fitness_util.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/init.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/mutation.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/optimize_c_urfd.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/packing.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/settings.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/template_creation.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/util.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/plots.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/processes.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/rating.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/resources.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/settings_config.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/simple_vehicle.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/simulation.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/smart_charging.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/standalone.py +0 -0
- {eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/validation.py +0 -0
|
@@ -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.
|
|
46
|
-
charging_allowed = np.
|
|
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,41 @@ 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
|
|
257
|
+
event.timeseries = {
|
|
258
|
+
"time": [
|
|
259
|
+
datetime.fromtimestamp(t).astimezone().isoformat()
|
|
260
|
+
for t in total_time[start_index:end_index]
|
|
261
|
+
],
|
|
262
|
+
"soc": socs.tolist(),
|
|
263
|
+
}
|
|
264
|
+
if event.timeseries["time"][0] < event.time_start.isoformat():
|
|
265
|
+
event.timeseries["time"][0] = event.time_start.isoformat()
|
|
266
|
+
if event.timeseries["time"][-1] > event.time_end.isoformat():
|
|
267
|
+
event.timeseries["time"][-1] = event.time_end.isoformat()
|
|
268
|
+
|
|
233
269
|
# Now we have the power draw and charging allowed for each event
|
|
234
270
|
if False:
|
|
235
271
|
from matplotlib import pyplot as plt
|
|
@@ -284,37 +320,3 @@ def optimize_charging_events_even(charging_events: List[Event]) -> None:
|
|
|
284
320
|
axs[2].set_xlabel("Time")
|
|
285
321
|
axs[2].set_ylabel("Vehicle count")
|
|
286
322
|
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()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eflips_depot-4.0.0 → eflips_depot-4.0.1}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|