LaneChange Model
Goals
Our goal is to refactor Plexe within SUMO in order to:
- Ensure that isolated Plexe vehicles behave exactly like native SUMO vehicles, correctly adopting a native SUMO car-following model (EIDM, Krauss, ACC, …) and, especially, take exactly the same LaneChange actions.
- Introduce a collective LaneChangeModel for vehicles that are part of a platoon, so that lane change maneuvers are coordinated and safe.
This way we can achieve realism for isolated vehicles and consistent behavior for platoons.
Introduction
Currently, Plexe vehicles suffer from several issues:
- When isolated, they still rely on
MSCFModel_CC
and related overrides which do not mimic realistic human behavior (too aggressive or unmotivated lane changes). -
laneChangeMode
bits are disabled to accommodate short gaps of followers, with the side effect that even leaders or isolated vehicles lack proper safety logic. - There is no clear separation between car-following models (longitudinal) and lane-changing models (lateral). For example,
autolaneChange
is currently implemented at the Cruise Controller (car-follow-model) side.
These limitations motivate a refactoring that makes Plexe behavior more modular, realistic, and maintainable.
Refactoring Idea
The refactoring introduces:
- A
PlexeVehicle
class extendingMSVehicle
and holding dynamic references to:-
active_cfmodel
→ one among EIDM, Krauss, ACC, MSCFModel_CC -
active_lcmodel
→ eitherLC2013
(isolated) orPlexeLCModel
(collective).
-
- The possibility to switch car-following models at runtime through dedicated APIs (e.g.,
plexe.setActiveCFModel(vehID, "EIDM")
). - A collective LaneChangeModel where:
- The leader evaluates its lane change decision.
- If willing to change, it checks that no follower is blocked.
- If all are free, the whole platoon changes lane simultaneously.
- If even a single follower is blocked, the maneuver is aborted for everyone.
UML Sketch
Test
The following tests (implemted by examples/lanechange_tests.pyhttps://tests.ing.unibs.it/ghiro/plexe-pyapi/-/blob/sumo1.24_lanechange_refactoring/examples/lanechange_tests.py on the sumo1.24_lanechange_refactoring dev-branch) are designed to validate the new design. Each case has a User Story (expected behavior from the user’s perspective) and a Refactor Story (how the refactored code ensures the outcome).
Test Case | User Story | Refactor Story | Expected Outcome |
---|---|---|---|
1 – Native SUMO | SUMO vehicles with EIDM, Krauss, and ACC (cases 1A, 2A, 3A). On a 3-lane highway with a slow car 200m ahead and an exit further ahead, each model overtakes and takes the exit according to its own style. | Baseline reference: SUMO native implementation of EIDM, Krauss, and ACC. | Each model shows its expected style: EIDM regular overtakes, Krauss more variable (σ), ACC smoother and more conservative. |
2 – Plexe Isolated | Isolated Plexe vehicle with active_cfmodel = EIDM / Krauss / ACC (cases 1B, 2B, 3B). Scenario identical to Test 1. |
PlexeVehicle delegates to the corresponding MSCFModel_* (EIDM, Krauss, ACC) and uses LC2013 for lane changes. |
Identical behavior to Test 1. No observable difference between Plexe and SUMO native vehicles with the same CF model. |
3 – Plexe Switching | Single-lane road, slow vehicle ahead. A Plexe vehicle switches every 10s between EIDM, Krauss, and ACC. | All three CFModels are instantiated at birth and continuously updated. Switching is a pointer reassignment. | Smooth transitions without discontinuities. Driving style changes at runtime according to the active model. |
4 – Platoon Collective | A platoon of 4 vehicles is present from the start. The leader can be: (a) a SUMO native (EIDM, Krauss, ACC), or (b) a Plexe leader using Plexe_CC . Followers are Plexe vehicles with CACC or PLOEG . The platoon approaches a slow vehicle, overtakes collectively, returns to the right only once all members have cleared the slow vehicle, and finally all take the exit together. |
PlexeLCModel handles collective lane change: leader decides, followers report blocked/unblocked state. Maneuver only proceeds if all are free; otherwise aborted. Followers delegate longitudinal control to their CF model (CACC or PLOEG). |
The platoon behaves as a single unit: overtakes as a block, shifts back to the right once fully clear, and exits together. Individual followers never attempt independent lane changes. |