Skip to content

Commit

Permalink
Make flake8 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulScheerRLI committed Sep 5, 2024
1 parent d643168 commit 52ad0ca
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions simba/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,3 @@ def min_standing_time(self):
desired_max_standing_time = ((capacity / charge_power) * min_recharge_soc)
min_standing_time = min(min_standing_time, desired_max_standing_time)
return min_standing_time


5 changes: 2 additions & 3 deletions simba/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def calculate_rotation_consumption(self, rotation: Rotation):
trip = rotation.trips[0]
for next_trip in rotation.trips[1:]:
# get consumption due to driving
driving_consumption = self.calculate_trip_consumption(trip)
driving_consumption = self.calculate_trip_consumption(trip)
driving_delta_soc = trip.delta_soc
# get idle consumption of the next break time
idle_consumption, idle_delta_soc = get_idle_consumption(trip, next_trip, v_info)
Expand All @@ -618,7 +618,6 @@ def calculate_rotation_consumption(self, rotation: Rotation):
rotation.consumption = rotation_consumption
return rotation.consumption


def calculate_trip_consumption(self, trip: Trip):
""" Compute consumption for this trip.
Expand Down Expand Up @@ -1362,6 +1361,7 @@ def generate_event_list_from_prices(
logging.info(f"{gc_name} price csv does not cover simulation time")
return events


def get_charge_delta_soc(charge_curves: dict, vt: str, ct: str, max_power: float,
duration_min: float, start_soc: float) -> float:
""" Get the delta soc of a charge event for a given vehicle and charge type
Expand Down Expand Up @@ -1410,7 +1410,6 @@ def get_idle_consumption(first_trip: Trip, second_trip: Trip, vehicle_info: dict
return idle_consumption, -idle_consumption / capacity



def soc_at_departure_time(v_id, deps, departure_time, vehicle_data, stations, charge_curves, args):
""" Get the possible SoC of the vehicle at a specified departure_time
Expand Down
1 change: 0 additions & 1 deletion tests/test_consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_calculate_idle_consumption(self, tmp_path):
idle_consumption, idle_delta_soc = get_idle_consumption(first_trip, second_trip, v_info)
assert idle_consumption == 0


# make all rotations depb
for r in schedule.rotations.values():
r.set_charging_type("depb")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_rotation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest

from simba.rotation import Rotation
from tests.helpers import generate_basic_schedule


Expand Down Expand Up @@ -29,4 +28,3 @@ def test_set_charging_type():
# of consumption is tested in test_consumption
consumption_depb = s.calculate_rotation_consumption(rot)
assert consumption_depb * 2 == pytest.approx(consumption_oppb)

2 changes: 1 addition & 1 deletion tests/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def test_rotation_consumption_calc(self):
r.trips = []
assert s.calculate_rotation_consumption(r) == 0

some_rot = next(rot_iter)
some_rot = next(rot_iter)
first_trip = some_rot.trips[0]
del first_trip.rotation
r.add_trip(vars(first_trip))
Expand Down
5 changes: 2 additions & 3 deletions tests/test_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_empty_report(self, tmp_path):
def test_create_trips_in_report(self, tmp_path):
# create_trips_in_report option: must generate valid input trips.csv
args_dict = vars(self.get_args())
update_dict={
update_dict = {
"mode": ["report"],
"desired_soc_deps": 0,
"ALLOW_NEGATIVE_SOC": True,
Expand All @@ -180,13 +180,12 @@ def test_create_trips_in_report(self, tmp_path):
}
args_dict.update(update_dict)


# simulate base scenario, report generates new trips.csv in (tmp) output
with warnings.catch_warnings():
warnings.simplefilter("ignore")
simulate(Namespace(**args_dict))
# new simulation with generated trips.csv
args = vars(self.get_args())
args_dict = vars(self.get_args())
args_dict["input_schedule"] = tmp_path / "report_1/trips.csv"
simulate(Namespace(**(args_dict)))

Expand Down

0 comments on commit 52ad0ca

Please sign in to comment.