Skip to content

Commit

Permalink
file names chosen via config and fix soc calculation error in ride.py #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mosc5 committed Nov 23, 2022
1 parent 2627764 commit 4b38526
Show file tree
Hide file tree
Showing 8 changed files with 4,660 additions and 155 deletions.
4,501 changes: 4,501 additions & 0 deletions scenarios/public_transport_base/consumption_ez10.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scenarios/public_transport_base/incline.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Marktplatz,0,0.01,0.01,0.01,0.01
Artrium,-0.01,0,0.01,0.01,0.01
Therme,-0.01,-0.01,0,0.01,0.01
Gries,-0.01,-0.01,-0.01,0,0.01
Marktplatz,-0.01,-0.01,-0.01,-0.01,0
Bahnhof,-0.01,-0.01,-0.01,-0.01,0
3 changes: 3 additions & 0 deletions scenarios/public_transport_base/scenario.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ min_charging_power = 0.1
vehicle_types = vehicle_types.json
charging_points = charging_points.json
schedule = schedule.csv
consumption = consumption_ez10.csv
distance = distance.csv
incline = incline.csv


[grid]
Expand Down
290 changes: 145 additions & 145 deletions scenarios/public_transport_base/schedule.csv

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scenarios/public_transport_base/vehicle_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"charging_curve": [[0, 150], [0.8, 150], [1, 150]],
"charging_power": {"CCS": 50, "Type2": 22, "Schuko": 3.7}
},
"SH_oppb-0": {
"EZ10": {
"name": "shuttle bus - opportunity charging",
"capacity": 32,
"charging_curve": [[0, 150], [0.8, 150], [1, 150]],
Expand Down
4 changes: 2 additions & 2 deletions src/advantage/ride.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def calculate_consumption(
)
consumption = consumption_factor * distance

return consumption, consumption * vehicle_type.battery_capacity / 100
return consumption, consumption / vehicle_type.battery_capacity

def get_consumption(
self, vehicle_type_name: str, incline, temperature, speed, load_level
Expand Down Expand Up @@ -129,7 +129,7 @@ def get_consumption(
inc_col = df["incline"]
tmp_col = df["t_amb"]
lol_col = df["level_of_loading"]
speed_col = df["sp_type"]
speed_col = df["mean_speed"]
cons_col = df["consumption"]
data_table = list(zip(lol_col, inc_col, speed_col, tmp_col, cons_col))

Expand Down
6 changes: 3 additions & 3 deletions src/advantage/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ def from_config(cls, scenario_name):
}

# read consumption_table
consumption_path = pathlib.Path(scenario_path, "consumption.csv")
consumption_path = pathlib.Path(scenario_path, cfg["files"]["consumption"])
consumption_df = pd.read_csv(consumption_path)

# read distance table
distance_table = pathlib.Path(scenario_path, "distance.csv")
distance_table = pathlib.Path(scenario_path, cfg["files"]["distance"])
distance_df = pd.read_csv(distance_table, index_col=0)

# read incline table
incline_table = pathlib.Path(scenario_path, "incline.csv")
incline_table = pathlib.Path(scenario_path, cfg["files"]["incline"])
incline_df = pd.read_csv(incline_table, index_col=0)

consumption_dict = {
Expand Down
7 changes: 4 additions & 3 deletions src/advantage/simulation_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

if TYPE_CHECKING:
from advantage.simulation import Simulation
from advantage.simulation import Vehicle
from advantage.vehicle import Vehicle


def class_from_str(strategy_name):
Expand All @@ -25,13 +25,14 @@ def get_predicted_soc(self, vehicle: "Vehicle", start: int, end: int):
if start < task.arrival_time < end:
if task.task == "driving":
# TODO run task through driving simulation, add result to consumption
self.simulation.driving_sim.calculate_trip(
con = self.simulation.driving_sim.calculate_trip(
task.departure_point,
task.arrival_point,
vehicle.vehicle_type,
0.0,
)
consumption += con[1]
if task.task == "charging":
# TODO check how much this would charge
pass
return vehicle.soc - consumption / vehicle.vehicle_type.battery_capacity
return vehicle.soc - consumption

0 comments on commit 4b38526

Please sign in to comment.