In this post, we are going to learn how to get started using OMNET++, INET, and Veins. We will learn how to set up our OMNET++ environment, create our own workspace, and learn how to run INET and VEINs.

As always you can watch my video here, that goes over everything this post has.

In this post, the installation will be focused on a Windows environment. OMNET++ works with macOS and Linux as well, and I suggest you read the documentation provided to install for those operating systems.

Getting started with OMNET++

Download OMNET++

Go to https://omnetpp.org/ and download OMNET++ at the time of this video the latest stable version is 5.6.2. Chose your OS in my case Windows and download.

After downloading, you will need to unzip the file. Now my preference is to have a folder on the root of my drive, named OMNET that holds different versions of the IDE. As I determine I don’t need it anymore I delete the old IDE.

Once your file has been unzipped it’s time to build the program. There is a README in here, that tells you to read the installation guide (which is located under docs) but you’re reading this post so let’s continue.

Installing OMNET++

Before we start MinGW/Clang 3.8 generates incorrect code when you use multiple inheritances in your code. So you need to update the file configure.user so thatPREFER_CLANG=yes is changed to PREFER_CLANG=no and save. Double click mingwenv.cmd and press any key to continue, this will unpack the MinGW toolchain. This will take away so feel free to walk away and come back when it’s done.

After MinGW is unpacked you will type the following commands in the command line.

$ ./configue
$ make

If you ever need to make configuration changes in the future you can reconfigure OMNET++ by doing the following commands:

$ ./configure
$ make cleanall
$ make

This is going to take a while, so again, feel free to walk away and come back when it’s done.

After this complete, let’s verify the installation. Type the following to launch a sample program:

 $ cd samples/aloha
 $ ./aloha

What should launch is the following, which is the QTenv for the aloha sample. You will be prompted to choose a config name, keep the config on the default value, and click OK.

Validate OMNET++ but launching the aloha sample
Launching the Aloha sample

The aloha example should then open, click the RUN button at the top, to see if the networking calls are working.

Validate OMNET++ by running the aloha sample
The Aloha sample running

If you do not get any errors your installation is fine, so lets launch OMNET++.

Go back to your root with the command cd ../.. and then launch OMNET++ with the command omnetpp. OMNET++ will then launch.

I prefer to start the IDE from the command line, but you can create a shortcut to start the IDE. In order to do that you need to find the exe under the IDE directory right click it and choose Send To > Desktop (create shortcut).

Setting up your OMNET++ workspace

When you launch OMNET++ you will be prompted to select a directory as a workspace. If you have worked with the Eclipse IDE before this should look familiar. That’s right OMNET++ is a skin of Eclipse.

Select a directory as a workspace (default)
Initial Launch

Do not use the samples workspace provide instead you should make a new workspace, preferably I keep my workspaces unique to each version of OMNET++ so I define my Workspaces in my OMNET++ root, but you can have your workspace wherever you like.

Select a directory as a workspace (new workspace)
Rename Workspace

Rename your workspace and click Launch (if the folder doesn’t exist it will be created for you).

Congratulations you have set up your OMNET++ IDE and created a new workspace, now let’s learn how to add INET to the workspace.

INET

OMNET++ will prompt you to install INET whenever you have an empty workspace, but we do not need to do this.

Prompt from OMNET++ to install INET and examples
Prompt from OMNET++ to install INET and examples

Instead, we should clone a copy of INET from the git repo. This way you can work with the latest version of INET. The INET Framework can be found here: https://github.com/inet-framework/inet

Uncheck both options above and click ok. You will then be brought to your empty workspace, but it won’t be empty for long. Click Import Project and under General select Existing Projects into Workspace.

Navigate to where you cloned INET and chose to add the project to the workspace.

Add INET to the workspace
Add INET to the workspace

INET has now been added to your workspace. So now let build INET and test our import. Right-click the inet project folder and choose Build Project. The build will take a long time (for me on my non-research computer it takes about 22 mins). You can enable parallel builds right-clicking the project and going to Properties -> C/C++ Build –> Behavior (tab) and click enable parallel build.

Enable parallel build in OMNET++ project
Enable parallel build

After your build completes, run any of the example files by right-clicking the omnetpp.ini file and choosing Run As -> OMNET++ Simulation.

Veins

The Veins repo can be found here: https://github.com/sommer/veins

Clone Veins and import the veins project as you did for the INET framework earlier, and build Veins (the build will not take as long as INET ~4 mins). There is one more step we need to do before we can run Veins example and that is to install SUMO and launch the SUMO python script provided by Veins.

Set Up SUMO

Download and install SUMO. Sumo can be found here: http://sumo.sourceforge.net/

After installing SUMO you can now run the sumo-launch.py file provide by Veins. In your MinGW command prompt run the following command.

/path/to/veins/sumo-launchd.py -vv -c /path/to/Sumo/bin/sumo.exe

Be sure to update /path/to/ to the path to those locations. If you want the SUMO gui to launch when you run a program using SUMO then change the sumo.exe to sumo-gui.exe, like below:

/path/to/veins/sumo-launchd.py -vv -c /path/to/Sumo/bin/sumo-gui.exe

When you launch this code you will see that there is a message the SUMO is now listening on port 9999.

Sample out print after launching SUMO
Sample out print after launching SUMO

We are now ready to run the Veins example.

Run Veins Example

Under examples in veins expand veins and right-click the omnetpp.ini file and choose Run As -> OMNET++ Simulation. Your veins project should launch successfully if you receive a connection error, make sure that SUMO is running.

Congratulations you now have set up your OMNET++ environment so that you can work with INET and Veins. In the next of my VANET tutorials, I will show you how to make your own OMNET++ project and have INET and Veins work together.