eflips-depot 4.13.3__tar.gz → 4.13.5__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.13.3 → eflips_depot-4.13.5}/PKG-INFO +1 -1
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/private/consumption.py +72 -22
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/pyproject.toml +1 -1
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/LICENSE.md +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/README.md +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/defaults/default_settings.json +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/private/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/private/depot.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/private/results_to_database.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/api/private/util.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/configuration.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/depot.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/evaluation.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/filters.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/input_epex_power_price.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/doc/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/doc/direct_details.pdf +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/evaluation.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/__init__.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/crossover.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/fitness_util.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/init.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/mutation.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/optimize_c_urfd.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/packing.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/settings.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/template_creation.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/util.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/plots.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/processes.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/rating.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/resources.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/settings_config.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/simple_vehicle.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/simulation.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/smart_charging.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/standalone.py +0 -0
- {eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/validation.py +0 -0
|
@@ -5,9 +5,9 @@ from datetime import timedelta, datetime
|
|
|
5
5
|
from math import ceil
|
|
6
6
|
from typing import Tuple, List
|
|
7
7
|
from zoneinfo import ZoneInfo
|
|
8
|
-
import scipy
|
|
9
8
|
|
|
10
9
|
import numpy as np
|
|
10
|
+
import scipy
|
|
11
11
|
import sqlalchemy.orm
|
|
12
12
|
from eflips.model import (
|
|
13
13
|
Event,
|
|
@@ -99,31 +99,61 @@ class ConsumptionInformation:
|
|
|
99
99
|
|
|
100
100
|
def calculate(self):
|
|
101
101
|
"""
|
|
102
|
-
Calculates the consumption for the trip.
|
|
102
|
+
Calculates the consumption for the trip.
|
|
103
|
+
|
|
104
|
+
Returns a float in kWh.
|
|
103
105
|
|
|
104
106
|
:return: The energy consumption in kWh. This is already the consumption for the whole trip.
|
|
105
107
|
"""
|
|
106
108
|
|
|
107
|
-
# Make sure the consumption lut has 4 dimensions
|
|
108
|
-
if
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
# Make sure the consumption lut has 4 dimensions with the correct columns
|
|
110
|
+
if not all(
|
|
111
|
+
col in self.consumption_lut.columns
|
|
112
|
+
for col in [
|
|
113
|
+
"incline",
|
|
114
|
+
"t_amb",
|
|
115
|
+
"level_of_loading",
|
|
116
|
+
"mean_speed_kmh",
|
|
117
|
+
]
|
|
118
|
+
):
|
|
114
119
|
raise ValueError(
|
|
115
120
|
"The consumption LUT must have the columns 'incline', 't_amb', 'level_of_loading', 'mean_speed_kmh'"
|
|
116
121
|
)
|
|
117
122
|
|
|
118
123
|
# Recover the scales along each of the four axes from the datapoints
|
|
119
|
-
|
|
124
|
+
|
|
125
|
+
incline_scale = sorted(
|
|
126
|
+
set(
|
|
127
|
+
[
|
|
128
|
+
x[self.consumption_lut.columns.index("incline")]
|
|
129
|
+
for x in self.consumption_lut.data_points
|
|
130
|
+
]
|
|
131
|
+
)
|
|
132
|
+
)
|
|
120
133
|
temperature_scale = sorted(
|
|
121
|
-
set(
|
|
134
|
+
set(
|
|
135
|
+
[
|
|
136
|
+
x[self.consumption_lut.columns.index("t_amb")]
|
|
137
|
+
for x in self.consumption_lut.data_points
|
|
138
|
+
]
|
|
139
|
+
)
|
|
122
140
|
)
|
|
123
141
|
level_of_loading_scale = sorted(
|
|
124
|
-
set(
|
|
142
|
+
set(
|
|
143
|
+
[
|
|
144
|
+
x[self.consumption_lut.columns.index("level_of_loading")]
|
|
145
|
+
for x in self.consumption_lut.data_points
|
|
146
|
+
]
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
speed_scale = sorted(
|
|
150
|
+
set(
|
|
151
|
+
[
|
|
152
|
+
x[self.consumption_lut.columns.index("mean_speed_kmh")]
|
|
153
|
+
for x in self.consumption_lut.data_points
|
|
154
|
+
]
|
|
155
|
+
)
|
|
125
156
|
)
|
|
126
|
-
speed_scale = sorted(set([x[3] for x in self.consumption_lut.data_points]))
|
|
127
157
|
|
|
128
158
|
# Create the 4d array
|
|
129
159
|
consumption_lut = np.zeros(
|
|
@@ -171,12 +201,26 @@ class ConsumptionInformation:
|
|
|
171
201
|
ConsistencyWarning,
|
|
172
202
|
)
|
|
173
203
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
204
|
+
x, y, z, alpha = np.meshgrid(
|
|
205
|
+
incline_scale,
|
|
206
|
+
temperature_scale,
|
|
207
|
+
level_of_loading_scale,
|
|
208
|
+
speed_scale,
|
|
209
|
+
indexing="ij",
|
|
210
|
+
)
|
|
211
|
+
points_array = np.column_stack(
|
|
212
|
+
[x.ravel(), y.ravel(), z.ravel(), alpha.ravel()]
|
|
213
|
+
)
|
|
214
|
+
consumption_lut_flattened = consumption_lut.ravel()
|
|
215
|
+
|
|
216
|
+
# Remove the NaN entries from consumption_lut and points_array
|
|
217
|
+
valid_mask = ~np.isnan(consumption_lut_flattened)
|
|
218
|
+
points_array = points_array[valid_mask]
|
|
219
|
+
consumption_lut = consumption_lut_flattened[valid_mask]
|
|
220
|
+
|
|
221
|
+
interpolator_nn = scipy.interpolate.NearestNDInterpolator(
|
|
222
|
+
x=points_array,
|
|
223
|
+
y=consumption_lut.ravel(),
|
|
180
224
|
)
|
|
181
225
|
consumption_per_km = interpolator_nn(
|
|
182
226
|
[
|
|
@@ -228,9 +272,7 @@ def extract_trip_information(
|
|
|
228
272
|
passenger_mass=68,
|
|
229
273
|
passenger_count=17.6,
|
|
230
274
|
) -> ConsumptionInformation:
|
|
231
|
-
"""
|
|
232
|
-
Extracts the information needed for the consumption simulation from a trip.
|
|
233
|
-
"""
|
|
275
|
+
"""Extracts the information needed for the consumption simulation from a trip."""
|
|
234
276
|
|
|
235
277
|
with create_session(scenario) as (session, scenario):
|
|
236
278
|
# Load the trip with its route and rotation, including vehicle type and consumption LUT
|
|
@@ -272,6 +314,14 @@ def extract_trip_information(
|
|
|
272
314
|
temperature = temperature_for_trip(trip_id, session)
|
|
273
315
|
|
|
274
316
|
payload_mass = passenger_mass * passenger_count
|
|
317
|
+
assert (
|
|
318
|
+
trip.rotation.vehicle_type.allowed_mass is not None
|
|
319
|
+
), f"allowed_mass of vehicle {trip.rotation.vehicle_type} must be set"
|
|
320
|
+
|
|
321
|
+
assert (
|
|
322
|
+
trip.rotation.vehicle_type.empty_mass is not None
|
|
323
|
+
), f"empty_mass of vehicle {trip.rotation.vehicle_type} must be set"
|
|
324
|
+
|
|
275
325
|
full_payload = (
|
|
276
326
|
trip.rotation.vehicle_type.allowed_mass
|
|
277
327
|
- trip.rotation.vehicle_type.empty_mass
|
|
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
|
|
File without changes
|
{eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py
RENAMED
|
File without changes
|
{eflips_depot-4.13.3 → eflips_depot-4.13.5}/eflips/depot/layout_opt/opt_tools/fitness_util.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
|