Skip to content

Commit

Permalink
Merge branch 'dev' into feature/pickle_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan.schirmeister committed Sep 18, 2024
2 parents d19b28a + 4cfecc9 commit 6b993a2
Show file tree
Hide file tree
Showing 32 changed files with 1,897 additions and 900 deletions.
13 changes: 10 additions & 3 deletions data/examples/simba.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# general info: identifier of scenario, appended to results
scenario_name = example

##### Paths #####
### Input and output files and paths ###
# Input file containing trip information (required)
Expand All @@ -7,9 +10,9 @@ input_schedule = data/examples/trips_example.csv
# Deactivate storage of output by setting output_directory = null
output_directory = data/output/
# Electrified stations (required)
electrified_stations = data/examples/electrified_stations.json
electrified_stations_path = data/examples/electrified_stations.json
# Vehicle types (defaults to: ./data/examples/vehicle_types.json)
vehicle_types = data/examples/vehicle_types.json
vehicle_types_path = data/examples/vehicle_types.json
# Path to station data with stations heights
# (Optional: needed if mileage in vehicle types not constant and inclination should be considered)
station_data_path = data/examples/all_stations.csv
Expand All @@ -22,7 +25,7 @@ level_of_loading_over_day_path = data/examples/default_level_of_loading_over_da
# Path to configuration file for the station optimization. Only needed for mode "station_optimization"
optimizer_config = data/examples/default_optimizer.cfg
# Cost parameters (needed if cost_calculation flag is set to true, see Flag section below)
cost_parameters_file = data/examples/cost_params.json
cost_parameters_path = data/examples/cost_params.json
# Path to rotation filter
rotation_filter = data/examples/rotation_filter.csv

Expand Down Expand Up @@ -76,6 +79,10 @@ strategy_opps = greedy
strategy_options_deps = {"CONCURRENCY": 1}
strategy_options_opps = {}

# Cost calculation strategy
cost_calculation_strategy_deps = balanced
cost_calculation_strategy_opps = greedy

##### Physical setup of environment #####
### Parametrization of the physical setup ###
# Default max power [kW] of grid connectors at depot and opp stations,
Expand Down
26 changes: 13 additions & 13 deletions data/examples/trips_example.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distance,vehicle_type,temperature,level_of_loading,charging_type
1,LINE_0,Station-0,2022-03-07 21:31:00,2022-03-07 21:31:00,Station-1,0.06,AB,20,0,oppb
1,LINE_0,Station-0,2022-03-07 21:30:00,2022-03-07 21:31:00,Station-1,0.06,AB,20,0,oppb
1,LINE_0,Station-1,2022-03-07 21:31:00,2022-03-07 22:04:00,Station-2,14519,AB,-5,0.9,oppb
1,LINE_0,Station-2,2022-03-07 22:08:00,2022-03-07 22:43:00,Station-1,13541,AB,,,oppb
1,LINE_0,Station-1,2022-03-07 22:51:00,2022-03-07 23:24:00,Station-2,14519,AB,,,oppb
Expand All @@ -12,8 +12,8 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
1,LINE_1,Station-4,2022-03-08 02:48:00,2022-03-08 03:06:00,Station-3,9067,AB,,,oppb
1,LINE_1,Station-3,2022-03-08 03:19:00,2022-03-08 03:42:00,Station-4,8.36,AB,,,oppb
1,LINE_1,Station-4,2022-03-08 03:48:00,2022-03-08 04:06:00,Station-3,9067,AB,,,oppb
1,LINE_1,Station-3,2022-03-08 04:06:00,2022-03-08 04:06:00,Station-0,0.06,AB,,,oppb
2,LINE_0,Station-0,2022-03-07 22:11:00,2022-03-07 22:11:00,Station-1,0.06,AB,,,
1,LINE_1,Station-3,2022-03-08 04:06:00,2022-03-08 04:07:00,Station-0,0.06,AB,,,oppb
2,LINE_0,Station-0,2022-03-07 22:10:00,2022-03-07 22:11:00,Station-1,0.06,AB,,,
2,LINE_0,Station-1,2022-03-07 22:11:00,2022-03-07 22:44:00,Station-2,14519,AB,,,
2,LINE_0,Station-2,2022-03-07 22:48:00,2022-03-07 23:23:00,Station-1,13541,AB,,,
2,LINE_0,Station-1,2022-03-07 23:31:00,2022-03-08 00:04:00,Station-2,14519,AB,,,
Expand All @@ -26,7 +26,7 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
2,LINE_1,Station-3,2022-03-08 02:49:00,2022-03-08 03:12:00,Station-4,8.36,AB,,,
2,LINE_1,Station-4,2022-03-08 03:18:00,2022-03-08 03:36:00,Station-3,9067,AB,,,
2,LINE_1,Station-3,2022-03-08 03:49:00,2022-03-08 04:12:00,Station-4,8.36,AB,,,
2,LINE_1,Station-4,2022-03-08 04:12:00,2022-03-08 04:12:00,Station-0,0.06,AB,,,
2,LINE_1,Station-4,2022-03-08 04:12:00,2022-03-08 04:13:00,Station-0,0.06,AB,,,
3,LINE_2,Station-0,2022-03-07 21:06:00,2022-03-07 21:06:00,Station-6,0.06,AB,,,
3,LINE_2,Station-6,2022-03-07 21:06:00,2022-03-07 21:34:00,Station-7,13018,AB,,,
3,LINE_2,Station-7,2022-03-07 21:53:00,2022-03-07 22:13:00,Station-8,10332,AB,,,
Expand All @@ -44,7 +44,7 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
3,LINE_3,Station-10,2022-03-08 03:47:00,2022-03-08 04:10:00,Station-11,10579,AB,,,
3,LINE_3,Station-11,2022-03-08 04:17:00,2022-03-08 04:44:00,Station-10,12007,AB,,,
3,LINE_3,Station-10,2022-03-08 04:44:00,2022-03-08 04:54:00,Station-0,4999,AB,,,
4,LINE_2,Station-0,2022-03-07 20:26:00,2022-03-07 20:26:00,Station-6,0.06,AB,,,
4,LINE_2,Station-0,2022-03-07 20:25:00,2022-03-07 20:26:00,Station-6,0.06,AB,,,
4,LINE_2,Station-6,2022-03-07 20:26:00,2022-03-07 20:56:00,Station-12,14097,AB,,,
4,LINE_2,Station-12,2022-03-07 21:10:00,2022-03-07 21:38:00,Station-6,13.19,AB,,,
4,LINE_2,Station-6,2022-03-07 21:46:00,2022-03-07 22:14:00,Station-7,13018,AB,,,
Expand All @@ -62,8 +62,8 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
4,LINE_3,Station-11,2022-03-08 03:47:00,2022-03-08 04:14:00,Station-10,12007,AB,,,
4,LINE_3,Station-10,2022-03-08 04:17:00,2022-03-08 04:40:00,Station-11,10579,AB,,,
4,LINE_4,Station-11,2022-03-08 04:43:00,2022-03-08 04:58:00,Station-13,6161,AB,,,
4,LINE_4,Station-13,2022-03-08 04:58:00,2022-03-08 04:58:00,Station-0,0.06,AB,,,
11,LINE_0,Station-0,2022-03-08 21:31:00,2022-03-08 21:31:00,Station-1,0.06,AB,20,0,oppb
4,LINE_4,Station-13,2022-03-08 04:58:00,2022-03-08 04:59:00,Station-0,0.06,AB,,,
11,LINE_0,Station-0,2022-03-08 21:30:00,2022-03-08 21:31:00,Station-1,0.06,AB,20,0,oppb
11,LINE_0,Station-1,2022-03-08 21:31:00,2022-03-08 22:04:00,Station-2,14519,AB,-5,0.9,oppb
11,LINE_0,Station-2,2022-03-08 22:08:00,2022-03-08 22:43:00,Station-1,13541,AB,,,oppb
11,LINE_0,Station-1,2022-03-08 22:51:00,2022-03-08 23:24:00,Station-2,14519,AB,,,oppb
Expand All @@ -76,8 +76,8 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
11,LINE_1,Station-4,2022-03-09 02:48:00,2022-03-09 03:06:00,Station-3,9067,AB,,,oppb
11,LINE_1,Station-3,2022-03-09 03:19:00,2022-03-09 03:42:00,Station-4,8.36,AB,,,oppb
11,LINE_1,Station-4,2022-03-09 03:48:00,2022-03-09 04:06:00,Station-3,9067,AB,,,oppb
11,LINE_1,Station-3,2022-03-09 04:06:00,2022-03-09 04:06:00,Station-0,0.06,AB,,,oppb
21,LINE_0,Station-0,2022-03-08 22:11:00,2022-03-08 22:11:00,Station-1,0.06,AB,,,
11,LINE_1,Station-3,2022-03-09 04:06:00,2022-03-09 04:07:00,Station-0,0.06,AB,,,oppb
21,LINE_0,Station-0,2022-03-08 22:10:00,2022-03-08 22:11:00,Station-1,0.06,AB,,,
21,LINE_0,Station-1,2022-03-08 22:11:00,2022-03-08 22:44:00,Station-2,14519,AB,,,
21,LINE_0,Station-2,2022-03-08 22:48:00,2022-03-08 23:23:00,Station-1,13541,AB,,,
21,LINE_0,Station-1,2022-03-08 23:31:00,2022-03-09 00:04:00,Station-2,14519,AB,,,
Expand All @@ -90,8 +90,8 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
21,LINE_1,Station-3,2022-03-09 02:49:00,2022-03-09 03:12:00,Station-4,8.36,AB,,,
21,LINE_1,Station-4,2022-03-09 03:18:00,2022-03-09 03:36:00,Station-3,9067,AB,,,
21,LINE_1,Station-3,2022-03-09 03:49:00,2022-03-09 04:12:00,Station-4,8.36,AB,,,
21,LINE_1,Station-4,2022-03-09 04:12:00,2022-03-09 04:12:00,Station-0,0.06,AB,,,
31,LINE_2,Station-0,2022-03-08 21:06:00,2022-03-08 21:06:00,Station-6,0.06,AB,,,
21,LINE_1,Station-4,2022-03-09 04:12:00,2022-03-09 04:13:00,Station-0,0.06,AB,,,
31,LINE_2,Station-0,2022-03-08 21:05:00,2022-03-08 21:06:00,Station-6,0.06,AB,,,
31,LINE_2,Station-6,2022-03-08 21:06:00,2022-03-08 21:34:00,Station-7,13018,AB,,,
31,LINE_2,Station-7,2022-03-08 21:53:00,2022-03-08 22:13:00,Station-8,10332,AB,,,
31,LINE_2,Station-8,2022-03-08 22:30:00,2022-03-08 22:54:00,Station-7,10.48,AB,,,
Expand All @@ -108,7 +108,7 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
31,LINE_3,Station-10,2022-03-09 03:47:00,2022-03-09 04:10:00,Station-11,10579,AB,,,
31,LINE_3,Station-11,2022-03-09 04:17:00,2022-03-09 04:44:00,Station-10,12007,AB,,,
31,LINE_3,Station-10,2022-03-09 04:44:00,2022-03-09 04:54:00,Station-0,4999,AB,,,
41,LINE_2,Station-0,2022-03-08 20:26:00,2022-03-08 20:26:00,Station-6,0.06,AB,,,
41,LINE_2,Station-0,2022-03-08 20:25:00,2022-03-08 20:26:00,Station-6,0.06,AB,,,
41,LINE_2,Station-6,2022-03-08 20:26:00,2022-03-08 20:56:00,Station-12,14097,AB,,,
41,LINE_2,Station-12,2022-03-08 21:10:00,2022-03-08 21:38:00,Station-6,13.19,AB,,,
41,LINE_2,Station-6,2022-03-08 21:46:00,2022-03-08 22:14:00,Station-7,13018,AB,,,
Expand All @@ -126,4 +126,4 @@ rotation_id,line,departure_name,departure_time,arrival_time,arrival_name,distanc
41,LINE_3,Station-11,2022-03-09 03:47:00,2022-03-09 04:14:00,Station-10,12007,AB,,,
41,LINE_3,Station-10,2022-03-09 04:17:00,2022-03-09 04:40:00,Station-11,10579,AB,,,
41,LINE_4,Station-11,2022-03-09 04:43:00,2022-03-09 04:58:00,Station-13,6161,AB,,,
41,LINE_4,Station-13,2022-03-09 04:58:00,2022-03-09 04:58:00,Station-0,0.06,AB,,,
41,LINE_4,Station-13,2022-03-09 04:58:00,2022-03-09 04:59:00,Station-0,0.06,AB,,,
22 changes: 21 additions & 1 deletion docs/source/simulation_parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The example (data/simba.cfg) contains parameter descriptions which are explained
- Default value
- Expected values
- Description
* - scenario_name
- Optional: no default given
- string
- scenario identifier, appended to output directory name and report file names
* - input_schedule
- Mandatory: no default given
- Path as string
Expand All @@ -36,7 +40,7 @@ The example (data/simba.cfg) contains parameter descriptions which are explained
- Data/sim_outputs
- Path as string
- Output files are stored here; set to null to deactivate
* - electrified_stations
* - electrified_stations_path
- ./data/examples/vehicle_types.json
- Path as string
- Path to Electrified stations data
Expand Down Expand Up @@ -97,6 +101,22 @@ The example (data/simba.cfg) contains parameter descriptions which are explained
- Path to pickle file
- Load schedule and scenario from this pickle file, expects load_pickle as first mode

* - strategy_deps
- balanced
- SpiceEV Strategies (greedy, balanced, peak_shaving, peak_load_windows, balanced_market)
- Charging strategy used in depots.
* - strategy_opps
- greedy
- SpiceEV Strategies (greedy, balanced, peak_shaving, peak_load_windows, balanced_market)
- Charging strategy used in opportunity stations.
* - cost_calculation_strategy_deps
- strategy_deps value
- SpiceEV Strategies (greedy, balanced, peak_shaving, peak_load_windows, balanced_market)
- Strategy for cost calculation at depots.
* - cost_calculation_strategy_opps
- strategy_opps value
- SpiceEV Strategies (greedy, balanced, peak_shaving, peak_load_windows, balanced_market)
- Strategy for cost calculation at opportunity stations.
* - preferred_charging_type
- depb
- depb, oppb
Expand Down
13 changes: 9 additions & 4 deletions simba/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
args = util.get_args()

time_str = datetime.now().strftime("%Y-%m-%d-%H-%M-%S")

if vars(args).get("scenario_name"):
dir_name = time_str + '_' + args.scenario_name
else:
dir_name = time_str
if args.output_directory is not None:
args.output_directory = Path(args.output_directory) / time_str
args.output_directory = Path(args.output_directory) / dir_name
# create subfolder for specific sim results with timestamp.
# if folder doesn't exist, create folder.
# needs to happen after set_options_from_config since
Expand All @@ -23,13 +28,13 @@
args.output_directory = None
if args.output_directory is not None:
# copy input files to output to ensure reproducibility
copy_list = [args.config, args.electrified_stations, args.vehicle_types]
copy_list = [args.config, args.electrified_stations_path, args.vehicle_types_path]
if "station_optimization" in args.mode:
copy_list.append(args.optimizer_config)

# only copy cost params if they exist
if args.cost_parameters_file is not None:
copy_list.append(args.cost_parameters_file)
if args.cost_parameters_path is not None:
copy_list.append(args.cost_parameters_path)
for c_file in map(Path, copy_list):
shutil.copy(c_file, args.output_directory_input / c_file.name)

Expand Down
Loading

0 comments on commit 6b993a2

Please sign in to comment.