eflips-depot 4.12.0__tar.gz → 4.12.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.
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/PKG-INFO +1 -1
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/__init__.py +22 -18
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/private/depot.py +11 -1
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/pyproject.toml +1 -1
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/LICENSE.md +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/README.md +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/__init__.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/defaults/default_settings.json +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/private/__init__.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/private/consumption.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/private/results_to_database.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/api/private/util.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/configuration.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/depot.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/evaluation.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/filters.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/input_epex_power_price.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/__init__.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/doc/__init__.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/doc/direct_details.pdf +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/evaluation.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/__init__.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/crossover.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/fitness_util.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/init.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/mutation.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/optimize_c_urfd.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/packing.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/settings.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/template_creation.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/util.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/plots.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/processes.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/rating.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/resources.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/settings_config.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/simple_vehicle.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/simulation.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/smart_charging.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/standalone.py +0 -0
- {eflips_depot-4.12.0 → eflips_depot-4.12.2}/eflips/depot/validation.py +0 -0
|
@@ -1106,7 +1106,7 @@ def add_evaluation_to_database(
|
|
|
1106
1106
|
|
|
1107
1107
|
|
|
1108
1108
|
def generate_depot_optimal_size(
|
|
1109
|
-
scenario: Scenario,
|
|
1109
|
+
scenario: Union[Scenario, int, Any],
|
|
1110
1110
|
standard_block_length: int = 6,
|
|
1111
1111
|
charging_power: float = 90,
|
|
1112
1112
|
database_url: Optional[str] = None,
|
|
@@ -1117,7 +1117,9 @@ def generate_depot_optimal_size(
|
|
|
1117
1117
|
Generates an optimal depot layout with the smallest possible size for each depot in the scenario. Line charging areas
|
|
1118
1118
|
with given block length area preferred. The existing depot will be deleted if `delete_existing_depot` is set to True.
|
|
1119
1119
|
|
|
1120
|
-
:param scenario:
|
|
1120
|
+
:param scenario: Either a :class:`eflips.model.Scenario` object containing the input data for the simulation. Or
|
|
1121
|
+
an integer specifying the ID of a scenario in the database. Or any other object that has an attribute "id" containing
|
|
1122
|
+
an integer pointing to a unique scenario id.
|
|
1121
1123
|
:param standard_block_length: The standard block length for the depot layout in meters. Default is 6.
|
|
1122
1124
|
:param charging_power: The charging power of the charging area in kW. Default is 90.
|
|
1123
1125
|
:param database_url: An optional database URL. Used if no database url is given by the environment variable.
|
|
@@ -1133,6 +1135,20 @@ def generate_depot_optimal_size(
|
|
|
1133
1135
|
logger = logging.getLogger(__name__)
|
|
1134
1136
|
|
|
1135
1137
|
with create_session(scenario, database_url) as (session, scenario):
|
|
1138
|
+
# Delete all depot events
|
|
1139
|
+
session.query(Event).filter(
|
|
1140
|
+
Event.scenario_id == scenario.id, Event.area_id.isnot(None)
|
|
1141
|
+
).delete()
|
|
1142
|
+
|
|
1143
|
+
if session.query(Depot).filter(Depot.scenario_id == scenario.id).count() != 0:
|
|
1144
|
+
if delete_existing_depot is False:
|
|
1145
|
+
raise ValueError(
|
|
1146
|
+
"Depot already exists. Set delete_existing_depot to True to delete it."
|
|
1147
|
+
)
|
|
1148
|
+
|
|
1149
|
+
delete_depots(scenario, session)
|
|
1150
|
+
|
|
1151
|
+
outer_savepoint = session.begin_nested()
|
|
1136
1152
|
# Delete all vehicles and events, also disconnect the vehicles from the rotations
|
|
1137
1153
|
rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
|
|
1138
1154
|
rotation_q.update({"vehicle_id": None})
|
|
@@ -1140,11 +1156,6 @@ def generate_depot_optimal_size(
|
|
|
1140
1156
|
session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
|
|
1141
1157
|
|
|
1142
1158
|
# Handles existing depot
|
|
1143
|
-
if session.query(Depot).filter(Depot.scenario_id == scenario.id).count() != 0:
|
|
1144
|
-
if delete_existing_depot is False:
|
|
1145
|
-
raise ValueError("Depot already exists.")
|
|
1146
|
-
|
|
1147
|
-
delete_depots(scenario, session)
|
|
1148
1159
|
|
|
1149
1160
|
##### Step 0: Consumption Simulation #####
|
|
1150
1161
|
# Run the consumption simulation for all depots
|
|
@@ -1185,7 +1196,7 @@ def generate_depot_optimal_size(
|
|
|
1185
1196
|
len(rotations) for vehicle_type, rotations in vehicle_type_dict.items()
|
|
1186
1197
|
)
|
|
1187
1198
|
|
|
1188
|
-
|
|
1199
|
+
inner_savepoint = session.begin_nested()
|
|
1189
1200
|
try:
|
|
1190
1201
|
# (Temporarily) Delete all rotations not starting or ending at the station
|
|
1191
1202
|
logger.debug(
|
|
@@ -1224,11 +1235,11 @@ def generate_depot_optimal_size(
|
|
|
1224
1235
|
depot_capacities_for_scenario[station] = vt_capacities_for_station
|
|
1225
1236
|
num_rotations_for_scenario[station] = rotation_count_depot
|
|
1226
1237
|
finally:
|
|
1227
|
-
|
|
1238
|
+
inner_savepoint.rollback()
|
|
1228
1239
|
|
|
1229
|
-
|
|
1240
|
+
outer_savepoint.rollback()
|
|
1230
1241
|
|
|
1231
|
-
|
|
1242
|
+
# Create depot using the calculated capacities
|
|
1232
1243
|
for depot_station, capacities in depot_capacities_for_scenario.items():
|
|
1233
1244
|
generate_depot(
|
|
1234
1245
|
capacities,
|
|
@@ -1240,10 +1251,3 @@ def generate_depot_optimal_size(
|
|
|
1240
1251
|
num_shunting_slots=num_rotations_for_scenario[depot_station] // 10,
|
|
1241
1252
|
num_cleaning_slots=num_rotations_for_scenario[depot_station] // 10,
|
|
1242
1253
|
)
|
|
1243
|
-
|
|
1244
|
-
# Delete all vehicles and events again. Only depot layout is kept
|
|
1245
|
-
|
|
1246
|
-
rotation_q = session.query(Rotation).filter(Rotation.scenario_id == scenario.id)
|
|
1247
|
-
rotation_q.update({"vehicle_id": None})
|
|
1248
|
-
session.query(Event).filter(Event.scenario_id == scenario.id).delete()
|
|
1249
|
-
session.query(Vehicle).filter(Vehicle.scenario_id == scenario.id).delete()
|
|
@@ -28,6 +28,10 @@ from sqlalchemy import or_
|
|
|
28
28
|
from sqlalchemy.orm import Session
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
class MissingVehicleDimensionError(ValueError):
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
31
35
|
def delete_depots(scenario: Scenario, session: Session) -> None:
|
|
32
36
|
"""This function deletes all depot-related data from the database for a given scenario.
|
|
33
37
|
|
|
@@ -676,7 +680,10 @@ def area_needed_for_vehicle_parking(
|
|
|
676
680
|
width = vehicle_type.width
|
|
677
681
|
|
|
678
682
|
if length is None or width is None:
|
|
679
|
-
raise
|
|
683
|
+
raise MissingVehicleDimensionError(
|
|
684
|
+
f"No length or width found for VehicleType {vehicle_type}. VehicleType dimensions are required to "
|
|
685
|
+
f"calculate the area needed for parking."
|
|
686
|
+
)
|
|
680
687
|
|
|
681
688
|
# This is the angle the vehicles are parked at in direct areas
|
|
682
689
|
# zero is equivalent to the direction they would be parked in a line area
|
|
@@ -1070,6 +1077,9 @@ def depot_smallest_possible_size(
|
|
|
1070
1077
|
logger.debug(
|
|
1071
1078
|
f"Vehicle count for {vt.name} in {amount_of_line_areas} line areas configuration: {vehicle_count_q}. This is > than the all-direct configuration ({vehicle_counts_all_direct[vt]})."
|
|
1072
1079
|
)
|
|
1080
|
+
|
|
1081
|
+
except MissingVehicleDimensionError as e:
|
|
1082
|
+
raise e
|
|
1073
1083
|
except Exception as e:
|
|
1074
1084
|
# This change is made after Unstable exception and delay exceptions are introduced
|
|
1075
1085
|
if (
|
|
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.12.0 → eflips_depot-4.12.2}/eflips/depot/layout_opt/opt_tools/fitness_c_urfd.py
RENAMED
|
File without changes
|
{eflips_depot-4.12.0 → eflips_depot-4.12.2}/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
|