Plexe

The Platooning Extension for Veins.

Pre-requirements for all OSes

Plexe currently works on Linux, macOS, and Windows as well, although the latest option is not recommended. On Linux you will have the most efficient working environment for Plexe. Downloading and building Plexe will be basically automatic, and you will have free tools available for debugging your code. On macOS, the situation is very similar to Linux, but you might need to install Xcode, which is undesirable, but besides that everything will work as on Linux. On Windows instead, building Plexe still requires manual steps (such as downloading external libraries), which is highly inefficient. If you are working on a Windows environment, or if you simply want to quickly try out Plexe, you might want to check out Instant Plexe in the download section.

Building for Linux (tested on Ubuntu 20.04.02)

Install required libraries and tools

Install build tools and required libraries:

1
sudo apt-get install build-essential gcc g++ bison flex perl python python3 qt5-default libqt5opengl5-dev tcl-dev tk-dev libxml2-dev zlib1g-dev default-jre doxygen graphviz libwebkit2gtk-4.0-dev libopenscenegraph-dev libosgearth-dev openscenegraph-plugin-osgearth libxerces-c-dev libproj-dev libgdal-dev libfox-1.6-dev libavformat-dev libavcodec-dev libswscale-dev python-dev python-configparser cmake r-base

Note: On different distributions, some packages might have a different name, so you would need to install the version available on your system. For example, on Ubuntu 16.04 you need to install libwebkitgtk-1.0-0 instead of libwebkit2gtk-4.0-dev.

Step 1: Install OMNeT++

Note: These instructions provide minimal help as the OMNeT++ install guide provides many hints on this. Should you find any problem, please refer to the official OMNeT++ manual.

Download and extract OMNeT++ 5.6.2 in your ~/src/ folder. Add the OMNeT++ folder to your PATH in your .bashrc, .zshrc, .profile, or equivalent.

1 2
echo 'export PATH=$PATH:~/src/omnetpp-5.6.2/bin' >> ~/.bashrc source ~/.bashrc

Build OMNeT++ as described in the official documentation:

1 2 3
cd ~/src/omnetpp-5.6.2 ./configure make -j <number of cores of your PC>

Step 2: Install Plexe and Veins

Download the Veins 5.1 and Plexe 3.0 zip archives and extract them in the ~/src/ folder. Alternatively, you can clone both Veins 5.1 and Plexe 3.0 from their github repositories. Once you have the source code, you can build Veins and Plexe by running

1 2 3 4 5 6
cd ~/src/veins ./configure make -j <number of cores of your PC> cd ~/src/plexe ./configure --with-veins=../veins make -j <number of cores of your PC>

Step 3: Install SUMO

As of SUMO 1.2.0, Plexe models are included within the official release. Any version starting from SUMO 1.2.0 should thus work fine. If you have to install it from scratch, choose SUMO 1.8.0: you just need to install the binary version. Please follow the official guidelines here. Alternatively, if you need to modify SUMO (e.g., to implement new control models) you can download the sources for SUMO 1.8.0 and build it following the official instructions.

Step 4: Setup up R

First, download the package for processing OMNeT++ result files without extracting the archive. Start R in the same folder where you downloaded the library by typing R in your terminal. In the R console type

1
install.packages(c('ggplot2', 'reshape2', 'data.table'))

Choose a mirror and, if asked, reply YES when asked whether libraries should be installed in a local folder. Finally install the OMNeT++ result files package by typing

1
install.packages("omnetpp_0.7-1.tar.gz", repos=NULL)

Building for macOS (tested on OS X 10.13 High Sierra)

Install required libraries and tools

On Mac OS X you will need to install MacPorts, which in turn MIGHT require you to install Xcode. It looks like you can install MacPorts without the full Xcode software, but I never tried. Feel free to send me feedbacks. Then to install the required tools type

1
sudo port install bison flex zlib tk autoconf libtool proj gdal fox xercesc R wget cmake

Installing OMNeT++, Plexe, Veins, SUMO, and setting up R

See Linux instructions

cstdint or random not found

When compiling Plexe-SUMO in debug mode with clang, CMakeLists.txt adds a compiler flag that causes the compilation to fail. Applying the following patch (remove -stdlib=libstdc++) solves the problem.

1 2 3 4 5 6 7 8 9 10 11 12 13
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f30a2a820f..c4a1171e5be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ elseif (MSVC) endif () if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++ -fsanitize=undefined,address,integer,unsigned-integer-overflow -fno-omit-frame-pointer -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/build/clang_sanitize_blacklist.txt") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address,integer,unsigned-integer-overflow -fno-omit-frame-pointer -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/build/clang_sanitize_blacklist.txt") endif () set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

Fox library not found

Apparently there is a bug in the CMakeLists.txt file that causes cmake to fail searching for the FOX library. Applying the following patch to the CMakeLists.txt file in the Plexe-SUMO root folder seems to solve the problem.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8824b282533..b549da8d1a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,9 @@ endif (PROJ_FOUND) find_package(FOX) if (FOX_FOUND) - include_directories(${FOX_INCLUDE_DIR}) + if (FOX_INCLUDE_DIR) + include_directories(${FOX_INCLUDE_DIR}) + endif (FOX_INCLUDE_DIR) add_definitions(${FOX_CXX_FLAGS}) add_definitions(-DFLOAT_MATH_FUNCTIONS) set(HAVE_FOX 1)

Proj upgrade bug

After the upgrade from version 4 to version 5, the location of headers and library files has changed. If you perform a MacPorts upgrade which updates the library, cmake will fail to locate it. To avoid this issue, you can force MacPorts to re-install the old version. To revert the library to a working version do the following:

1 2 3 4 5
cd git clone --single-branch https://github.com/macports/macports-ports.git cd macports-ports/gis/proj git checkout cec46104fb416095b0ca72f7d0c4fed6d04c714a sudo port install

This will install Proj version 4.9.3 and SUMO will correctly locate the library.

For macOS Sierra (10.12) users:

If you are having problems in building SUMO, check that you installed the full XCode version. Although you can install MacPorts without the complete XCode, it seems that you will have problems building it if you don’t do so. In addition, check wether the MacPorts path in your PATH variable comes before the system path. In case you don’t find the MacPorts path in your .profile file, MacPorts might have added /opt/local/bin to the /etc/paths file. If this is the case, move the MacPorts path at the top of the list and restart your terminal.

libFOX upgrade bug

If the SUMO GUI stopped working after a MacPorts upgrade, it might be due to an update to the FOX library. You can check the installed version by typing

1
port installed | grep fox

in your terminal. If the answer is fox @1.6.53_0 (active) then you have a bugged version of the library. To revert the library to a working version do the following:

1 2 3 4 5
cd git clone --single-branch https://github.com/macports/macports-ports.git cd macports-ports/x11/fox git checkout 34b30703366e8483e99040b52e8fb905bc9b27e8 sudo port install

The clone operation downloads roughly 130 MB of data! This will install the previous version of the library. You can check the current version by typing again port installed | grep fox which should now show

1 2
fox @1.6.46_3 (active) fox @1.6.53_0

The SUMO GUI should now be working again.

Building for Windows

Note: If you are having troubles compiling for Windows, you might want to check out Instant Plexe in the download section.

Step 1: Install OMNeT++

Download and extract the OMNeT++ Windows sources in C:\Users\<user>\src. Open the Mingw terminal inside the OMNeT++ folder and type

1 2
./configure make -j <number of cores of your PC>

Step 2: Install Plexe and Veins

Open the Mingw terminal in the OMNeT++ source folder and cd into /c/Users/<user>/src/veins (for building Veins) and into /c/Users/<user>/src/plexe (for building Plexe). To compile Veins and Plexe follow Linux instructions.

Step 3: Install SUMO

Please visit the official SUMO website and dowload SUMO 1.8.0 binaries. If you need to modify SUMO (e.g., to implement new control models) you can download the sources for SUMO 1.8.0 and build it following the official instructions

Step 4: Set up R

Note: This instructions refer to R version 3.3.0, but the procedure for version 4 should be equivalent.

Install R for Windows from the official website and then install R tools. When the installation is complete, edit your Windows PATH to include R and Rtools binaries folder (e.g., c:\Rtools\bin;c:\Rtools\mingw_64\bin;C:\Program Files\R\R-3.3.0\bin\x64\;). Download the OMNeT++ R package from here and save it in C:\Users\<user>\src. Open the R console and install the required packages by typing

1 2 3
setwd('C:\Users\<user>\src') install.packages(c('ggplot2', 'reshape2', 'data.table')) install.packages("omnetpp_0.7-1.tar.gz", repos=NULL)

The installation will ask you to install the packages to a local folder. Reply with YES and take note of that folder. Then add an additional environmental variable called R_LIBS which points to the location of the installed R libraries, for example

1
C:\Users\<user>\Documents\R\win-library\3.3

Now you should be able to start R by typing R in the Mingw console provided by OMNeT++.