Every repository with this icon (
Every repository with this icon (
Porting
How to port existing modules developed in MF2 and Omnetpp3 to MF2 for Omnetpp4
The conversion from omnetpp3 to omnetpp4 is largely automated.
Migration tools can be found in the “migrate” directory of omnetpp:
- migratemsg migrates msg files
- migratened migrates ned files
- migrateini migrates ini files (but this does not really work)
- migratecpp migrates .cc and .h files
The migratecpp tool typically generates some warnings, especially
regarding the type used to represent time values. In omnetpp3, the
simtime_t type was a typedef for double and thus it was possible to use
double for time values.
With omnet4, time is represented with a fixed precision class. Old code
using simtime_t can be automatically migrated, lower quality code that
uses double values needs some adjustment (replace “double t” by
“simtime_t t” and “t.dbl()” for simtime_t to dbl conversion).
Another typical problem is due to the refactoring of the message
classes. There is now a cPacket class in addition to cMessage, and some
of the methods that previously belonged to cMessage are now part of
cPacket (which derives from cMessage). Some casting may be necessary
(have a look at csma v4 for instance).
These two issues are the most frequent.
To migrate a module to the omnet4 mobility framework (m2o4):
(1) copy the necessary .msg, .ned, .cc and .h files to the adequate
locations
(2) run migratemsg, migratened, migratecpp at the top-level directory.
These tools will find the v3 files, backup these files with a .bak
extension and migrate them.
(3) consider the warnings generated by migratecpp and edit the files
accordingly.
(4) adapt the ini files.
The process is relatively straightforward as much of the framework has
already been migrated, and the ini files v4 already written.






