From d36077760cb4c67943bd0c4c827fb12a82b445ae Mon Sep 17 00:00:00 2001 From: "paul.scheer" Date: Tue, 24 Sep 2024 11:56:31 +0200 Subject: [PATCH] Change attribute name from allow_opp_charging to allow_oppb_charging Rewrite comment --- simba/rotation.py | 2 +- simba/schedule.py | 4 ++-- tests/test_schedule.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/simba/rotation.py b/simba/rotation.py index ec5649c..0ae8e9f 100644 --- a/simba/rotation.py +++ b/simba/rotation.py @@ -11,7 +11,7 @@ def __init__(self, id, vehicle_type, schedule) -> None: self.trips = [] self.schedule = schedule - self.allow_opp_charging: bool = True + self.allow_oppb_charging: bool = True self.vehicle_type = vehicle_type self.vehicle_id = None self.charging_type = None diff --git a/simba/schedule.py b/simba/schedule.py index 9bfbf9d..cdac35b 100644 --- a/simba/schedule.py +++ b/simba/schedule.py @@ -922,9 +922,9 @@ def generate_scenario(self, args): station_type = station["type"] if (station_type == 'opps' and (trip.rotation.charging_type == 'depb' or - not trip.rotation.allow_opp_charging)): + not trip.rotation.allow_oppb_charging)): # a depot bus cannot charge at an opp station. - # a bus can only charge at opps if its allowed + # a bus cannot charge at opps if it's not allowed station_type = None else: # get desired soc by station type and trip diff --git a/tests/test_schedule.py b/tests/test_schedule.py index fbb2e54..ad9cfbb 100644 --- a/tests/test_schedule.py +++ b/tests/test_schedule.py @@ -68,7 +68,7 @@ def test_allow_opp_charging(self): assert len(oppb_rotations) >= 1 oppb_rotation = oppb_rotations[0] vehicle = oppb_rotation.vehicle_id - assert oppb_rotation.allow_opp_charging is True + assert oppb_rotation.allow_oppb_charging is True index = list(scen.components.vehicles.keys()).index(vehicle) min_soc = min(s[index] for s in scen.socs if s[index] is not None) vehicle_event = [e for e in scen.events.vehicle_events if e.vehicle_id == vehicle] @@ -78,9 +78,9 @@ def test_allow_opp_charging(self): charge_events += 1 assert charge_events > 0, \ - "Rotation has no charge events to check if allow_opp_charging works" + "Rotation has no charge events to check if allow_oppb_charging works" for rot in oppb_rotations: - rot.allow_opp_charging = False + rot.allow_oppb_charging = False scen2 = sched.run(args) index = list(scen2.components.vehicles.keys()).index(vehicle)