Step 0. Building Plexe
This quick tutorial assumes that you already have installed OMNeT++ 5.0, all library dependencies for SUMO, tools such as
clang++, and the R statistical framework. Also, the tutorial assumes you are working on a Unix-like operating system. Please also consider to install ccache (see the FAQ section for an explanation).
We will put all the source code in the
src folder under your home (
C:\Users\<user>\src\ in Windows). You can download and build Plexe-Veins and Plexe-SUMO with the following commands:
cd ~/src git clone https://github.com/michele-segata/plexe-veins.git git clone https://github.com/michele-segata/plexe-sumo.git cd plexe-veins git checkout plexe-2.0 ./configure make -j <number of cores of your PC> MODE=release cd ~/src/plexe-sumo git checkout plexe-2.0 make -f Makefile.cvs ./configure make -j <number of cores of your PC>
Now you need to tell your system where to find SUMO binaries, which can be done by changing your
PATH environmental variable under your
.profile, or any other, depending on the shell you are using. Edit the file, add
and re-open your terminal (or
source your configuration file).
sumo in your terminal you should now get something similar to
PLEXE SUMO Version 0.26.0 Build features: x86_64-unknown-linux-gnu InternalLanes DoublePrecision TRACI PROJ GDAL GUI Copyright (C) 2001-2016 DLR and contributors; http://sumo.dlr.de Copyright (C) 2012-2016 Michele Segata <firstname.lastname@example.org> License GPLv3+: GNU GPL Version 3 or later <http://gnu.org/licenses/gpl.html> Use --help to get the list of options.
The first example shows a comparison between the ACC and the CACC models that Plexe provides. A platoon of 8 cars is injected in a stretch of freeway. The scenario includes two sub-scenarios. In the first one the leader accelerates and decelerates in a sinusoidal fashion to show some properties of the controllers, while in the second the leader performs and emergency braking maneuver.
The simulation provides five configurations for each scenario: In the first two, the followers enable the ACC to control the car, but with two different headway times (i.e., 0.3 s and 1.2 s). The aim is to show that the ACC is unstable in the first case, and stable in the second one. In the other scenarios instead, the followers use the CACCs available in Plexe. The example shows how, thanks to IVC, the cooperative control systems are stable even when vehicles are closely following each other.
We first run one simulation with the SUMO GUI to actually see the vehicles. Go to the
~/src/plexe-veins/examples/platooning folder and type
./run -u Cmdenv -c Sinusoidal -r 2
On Windows, you might need to substitute
python ../../run. You should see the SUMO interface popping up and showing an empty freeway. Set a delay time of 0.01 seconds and zoom-in at the beginning of the highway. Click on the play button: at 1 second you should see the platoon of 8 cars appear in the highway. To follow the platoon, right click on the leader and choose "Start tracking". The vehicles will run for 60 s and then the simulation will stop. To run all the other scenarios, let's avoid the GUI. Copy-paste the following in your terminal
./run -u Cmdenv -c SinusoidalNoGui -r 0 ./run -u Cmdenv -c SinusoidalNoGui -r 1 ./run -u Cmdenv -c SinusoidalNoGui -r 3 ./run -u Cmdenv -c SinusoidalNoGui -r 4 ./run -u Cmdenv -c BrakingNoGui -r 0 ./run -u Cmdenv -c BrakingNoGui -r 1 ./run -u Cmdenv -c BrakingNoGui -r 2 ./run -u Cmdenv -c BrakingNoGui -r 3 ./run -u Cmdenv -c BrakingNoGui -r 4
At this point you should have all the results ready to be processed in the
First, we pre-process the data from all simulation and merge the results into a single file using the new scripts provided by Plexe. To do this, go into the
analysis folder and type
./genmakefile.py parse-config > Makefile make
On Windows, you might need to type
python genmakefile.py instead of
./genmakefile.py. The script will parse the content of all
.vec files and generate
Braking.Rdata, which will include all the results from the two scenarios. These files are very easy to load in
R and give you immediate access to all the results (actually, the ones that you decided to extract).
To plot the graphs to compare the controllers run the R script
Rscript plot-sinusoidal.R Rscript plot-braking.R
The script generates the following graphs, showing the evolution of control input, acceleration, speed, and distances in time.