Note: This tutorial assumes you already cloned the
git repositories for running Example 1.
Step 0. Building Plexe with sample changes
To switch to the code for this example and build the source, simply do the following:
cd ~/src/plexe-veins git checkout plexe-2.0-join-example ./configure make -j <number of cores of your PC> MODE=release cd ~/src/plexe-sumo git checkout plexe-2.0 make -j <number of cores of your PC>
The third example shows how plexe can be used to implement a maneuver. In this case we show a simple example where a platoon of four cars is travelling on the freeway while a fifth requests the leader to join at the tail. Figures 1 and 2 show the state machines of the application layer protocol governing the maneuver for the leader and the joining vehicle. The leading and joining vehicles start from the LEADING and IDLE states respectively. The joiner requests the leader to join the platoon with the send_req primitive, and moves to the WAIT REPLY state. The leader answers with the join_req primitive, which relays information about the platoon (lane, join position, etc.), and moves to the WAIT POSITION state. The joiner uses such data to come close to the tail of the platoon, moving into the join position. Once in position, i.e., at a negotiated distance from the last car of the platoon, the joiner notifies the leader that it is able to join. The leader sends back a confirmation and the joiner switches to CACC, closing its gap to the predecessor to the platoon inter-car distance. At the end of the procedure, the leader switches back to the LEADING state, while the joiner to FOLLOW.
|Figure 1. State machine for the leading vehicle.||Figure 2. State machine for the joining vehicle.|
To run the example, start the
sumo-launchd.py script as usual (use
-c sumo if you just want to run the simulation without the GUI). The example is located in the
~/src/plexe-veins/examples/joinManeuver folder and has two different runs. One run uses the default CACC parameter (i.e., = 1 and = 0.2 Hz), while the second uses = 2 and = 1.0 Hz. To run the two examples type
cd ~/src/plexe-veins/examples/joinManeuver ./run -u Cmdenv -c JoinManeuverNoGui -r 0 ./run -u Cmdenv -c JoinManeuverNoGui -r 1
If you want to see the join maneuver, run the simulations removing the
NoGui substring. When the simulation terminates, plot the graphs.
As for the first example, move into the
analysis folder, generate the
Makefile, and run the R script
cd analysis ./genmakefile.py parse-config > Makefile make Rscript plot.R
The script generates the plots describing the dynamics of the simulation in terms of distance, speed, and acceleration of the vehicles. From the plots it is possible to see the evolution in time of the maneuver. The joiner accelerates up to 130 km/h to reach the platoon in front. When coming close (i.e., around 15 m from the tail of the platoon), the joiner slows down and asks the leader a confirmation for joining. The joining vehicles then speeds up a little to close the gap and finally joins the platoon. What it is interesting to notice is the slightly different behavior for different CACC parameters. For the simulation with = 2 and = 1.0 Hz, the procedure is faster, as it ends at around 70 s, while in the other case the joiner needs roughly 90 s. However, in the first case the controller is much more aggressive, and even slightly unstable, showing sudden accelerations and decelerations. This shows how the simulator can be used to perform a parameterization study and find the values with the best trade-off between convergence time and driving comfort.