omnet++veinsrinside

Is it possible to use RInside in omnet++/Veins project to benefit from rich R features


I was learning R and came through this package called RInside which provides c++ classes to call an embedded R interpreter. I am able to run some examples given after configuring as per this blogpost and using provided makefile in Omnet++ eclipse IDE. How can we integrate this with say veins (veins already have auto generated makefiles in top directory and src directory)? Rinside needs GCC toolchain which i think is default in OMNeT++.

From what I've learned so far, these are the options:

  1. Omnet++ user manual says we can use custom makefile for some source directory. So keeping RInside code in one source folder and a separate makefile and calling this makefile from veins top level makefile. I tried both of these approaches:
    1. copying some source files from RInside examples and makefile and changed the Build properties in IDE to exclude this folder from build
    2. also used the option custom make file for this directory. But was not successful so far. May be i am not doing correctly.
  2. Implement all functionality using Rinside and make it a library (static/Shared). Use this library in veins.

Has anyone tried to use it with omnet++/veins based project so far? does anyone know if it is worth trying? Any other suggestions are welcome.

I'm using Ubuntu 16.04 LTS 64 bit.


Solution

  • Do you really want to use R inside of OMNeT++, or are you looking to do result/data analysis?


    Result analysis

    Could you provide a bit of information about what you're trying to do/why you're trying to use R inside OMNeT++ instead of doing a post-processing step after your simulations are completed? Generally speaking, I'd recommend doing your post-processing separate from your simulations, generating relevant data in the results using the statistics collection libs in OMNeT++, and process these with R. You can find some examples that are used with Plexe, a VEINS-based simulator for CACC applications, in this repository. I personally prefer to use python for the post-processing, but if you're already familiar with R, then I'd recommend having a look at that.


    Integrating with VEINS

    If you really want to do this, I'd recommend the second approach in your question, i.e., simply dynamically linking to the RInside libraries as system libraries and specify them as a dependency. This is basically the easiest way to get things to work.

    However, if for some reason you want to link against the library explicitly, you should be aware that VEINS' build process relies on the configure script included in the distribution. The way it works differently from normal C++ programs is that OMNeT++ simulations should be built using the OMNeT++-provided opp_makemake tool: this is exactly what VEINS' configure script does. If you want to include additional library paths into the build process, the easiest way is to create a makefile using ./configure --include PATH/TO/RINSIDE/HEADERS. Refer to the script source code for more details