Wednesday, May 4, 2011

NS3: Constant Speed Mobility

NS3 does not support constant speed mobility but it has a very good class RandomWalk2dMobilityModel which supports random speed and direction based on defined time or distance. If you need to simulation constant speed mobility, use the following steps:

  1. Open file '..../ns-3-dev/src/mobility/random-direction-2d-mobility-model.cc'
  2. In function DoStartPrivate()
    • comment the line 'double speed = m_speed.GetValue ();'
    • add a line 'double speed = your_constant_speed_value'
  3. Recompile ns-3 and you are done.

2 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This can also be done without modifying the source code

    mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", "Speed", RandomVariableValue (ConstantVariable (Speed))

    ReplyDelete