Plexe

The Platooning Extension for Veins.

Pre-requirements for all OSes

Plexe currently works on Linux, Mac OS X, 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 Mac OS X, 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.

For Linux and Mac OS X be sure to have git installed on the system to obtain Plexe source code. For Windows, this is not required as git is included in the Mingw terminal which ships with OMNeT++ source code. Download OMNeT++ source code and extract it either in ~/src/ (Linux or Mac OS X) or in C:\Users\<user>\src (Windows). In your terminal (either system terminal in Linux/Mac OS X or Mingw inside the OMNeT++ source folder in Windows), cd into ~/src or /c/Users/<user>/src and obtain Plexe source code by typing

1 2
git clone https://github.com/michele-segata/plexe-veins.git git clone https://github.com/michele-segata/plexe-sumo.git

Building for Linux (tested on Ubuntu 16.04)

Install required libraries and tools

Install build tools and required libraries:

1
sudo apt-get install build-essential bison flex zlib1g-dev tk8.5-dev openjdk-6-jre autoconf libtool libproj-dev libgdal-dev libfox-1.6-dev libxerces-c-dev r-base cmake

Building OMNeT++

Add OMNeT++ folder to your PATH in your .bashrc, .zshrc, .profile, or equivalent.

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

Build OMNeT++ as explained in the official documentation:

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

Building Plexe-Veins

1 2 3 4
cd ~/src/plexe-veins git checkout plexe-2.1 ./configure make -j <number of cores of your PC> MODE=release

Building Plexe-SUMO

1 2 3 4 5 6
cd ~/src/plexe-sumo git checkout plexe-2.1 mkdir build-release cd build-release cmake -DCMAKE_BUILD_TYPE=Release .. make -j <number of cores of your PC>

Finally, add the Plexe-SUMO bin folder to your PATH

1
echo 'export PATH=$PATH:~/src/plexe-sumo/bin' >> ~/.bashrc

Setting up R

First, download the package for processing OMNeT++ result files

1 2
cd /tmp wget http://plexe.car2x.org/download/omnetpp_0.7-1.tar.gz

Start R 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

Building OMNeT++, Plexe-Veins, Plexe-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.

Building 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>

Building Plexe-Veins

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

Building Plexe-SUMO

Open the Mingw terminal in the OMNeT++ source folder and cd into /c/Users/<user>/src/plexe-sumo. Checkout the correct code version by typing

1
git checkout plexe-2.1

Building SUMO for Windows should now have become easier as SUMO moved to CMake, which can automatically generate Visual Studio solution files. Please visit the official SUMO website to find the instructions for building SUMO on Windows using CMake and Visual Studio.

Once built, add C:\Users\<user>\src\plexe-sumo\bin to your Windows PATH.

Setting up R

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++.