Skip to content

Commit

Permalink
pickle: add minimal example configs
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan.schirmeister committed Sep 25, 2024
1 parent f15fae9 commit 196b382
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
9 changes: 9 additions & 0 deletions data/examples/minimal.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Input and output files and paths ###
# Input file containing trip information
schedule_path = data/examples/trips_example.csv
# Electrified stations
electrified_stations_path = data/examples/electrified_stations.json
# Vehicle types
# Not strictly needed (defaults to: ./data/examples/vehicle_types.json),
# but if vehicle types have constant mileage, no other mileage files are needed
vehicle_types_path = data/examples/vehicle_types_constant_mileage.json
3 changes: 3 additions & 0 deletions data/examples/minimal_pickle.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mode = ["load_pickle", "report"]
# Load this pickle file, expects load_pickle as first mode
load_pickle = scenario.pkl
43 changes: 43 additions & 0 deletions data/examples/vehicle_types_constant_mileage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"AB": { // vehicle_type
"depb": { // charging_type
"name": "articulated bus - depot charging", // long name
"capacity": 250, // battery capacity in kWh
"charging_curve": [[0, 150], [0.8, 150], [1, 15]], // charging curve [SoC, kW]
"min_charging_power": 0, // min charging power in KW
"v2g": false, // Is vehicle capable of vehicle to grid?
"mileage": 1.0, // mileage in kWh/km or link to consumption.csv
"battery_efficiency": 0.95, // optional. default: 0.95
"idle_consumption" : 0.0 // [kWh/h] consumption while standing during a rotation
},
"oppb": {
"name": "articulated bus - opportunity charging",
"capacity": 150,
"charging_curve": [[0, 250], [0.8, 250], [1, 25]],
"min_charging_power": 0,
"v2g": false,
"mileage": 1.0,
"idle_consumption" : 0.0
}
},
"SB": {
"depb": {
"name": "solo bus - depot charging",
"capacity": 250,
"charging_curve": [[0, 150], [0.8, 150], [1, 15]],
"min_charging_power": 0,
"v2g": false,
"mileage": 1.2,
"idle_consumption" : 0.0
},
"oppb": {
"name": "solo bus - opportunity charging",
"capacity": 150,
"charging_curve": [[0, 250], [0.8, 250], [1, 25]],
"min_charging_power": 0,
"v2g": false,
"mileage": 1.1,
"idle_consumption" : 0.0
}
}
}
12 changes: 8 additions & 4 deletions simba/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,14 @@ def get_args():
# rename special options
args.timing = args.eta

mandatory_arguments = ["schedule_path", "electrified_stations_path"]
missing = [a for a in mandatory_arguments if vars(args).get(a) is None]
if missing:
raise Exception("The following arguments are required: {}".format(", ".join(missing)))
# check mandatory arguments
if not vars(args).get("load_pickle"):
mandatory_arguments = ["schedule_path", "electrified_stations_path"]
if "load_pickle" in args.mode:
mandatory_arguments.append("load_pickle")
missing = [a for a in mandatory_arguments if vars(args).get(a) is None]
if missing:
raise Exception("The following arguments are required: {}".format(", ".join(missing)))

return args

Expand Down

0 comments on commit 196b382

Please sign in to comment.