Skip to content

Commit

Permalink
Rename flag to allow_opp_charging_for_oppb
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulScheerRLI committed Oct 10, 2024
1 parent d360777 commit 07c6048
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion simba/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, id, vehicle_type, schedule) -> None:
self.trips = []
self.schedule = schedule

self.allow_oppb_charging: bool = True
self.allow_opp_charging_for_oppb: bool = True
self.vehicle_type = vehicle_type
self.vehicle_id = None
self.charging_type = None
Expand Down
2 changes: 1 addition & 1 deletion simba/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def generate_scenario(self, args):
station_type = station["type"]
if (station_type == 'opps' and
(trip.rotation.charging_type == 'depb' or
not trip.rotation.allow_oppb_charging)):
not trip.rotation.allow_opp_charging_for_oppb)):
# a depot bus cannot charge at an opp station.
# a bus cannot charge at opps if it's not allowed
station_type = None
Expand Down
6 changes: 3 additions & 3 deletions tests/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_oppb_charging is True
assert oppb_rotation.allow_opp_charging_for_oppb 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]
Expand All @@ -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_oppb_charging works"
"Rotation has no charge events to check if allow_opp_charging_for_oppb works"
for rot in oppb_rotations:
rot.allow_oppb_charging = False
rot.allow_opp_charging_for_oppb = False
scen2 = sched.run(args)

index = list(scen2.components.vehicles.keys()).index(vehicle)
Expand Down

0 comments on commit 07c6048

Please sign in to comment.