Download ns-3-model-library
Transcript
CHAPTER TWENTY MOBILITY The mobility support in ns-3 includes: • a set of mobility models which are used to track and maintain the current cartesian position and speed of an object. • a “course change notifier” trace source which can be used to register listeners to the course changes of a mobility model • a number of helper classes which are used to place nodes and setup mobility models (including parsers for some mobility definition formats). 20.1 Model Description The source code for mobility lives in the directory src/mobility. 20.1.1 Design The design includes mobility models, position allocators, and helper functions. In ns-3, special MobilityModel objects track the evolution of position with respect to a (cartesian) coordinate system. The mobility model is typically aggregated to an ns3::Node object and queried using GetObject<MobilityModel> (). The base class ns3::MobilityModel is subclassed for different motion behaviors. The initial position of objects is typically set with a PositionAllocator. These types of objects will lay out the position on a notional canvas. Once the simulation starts, the position allocator may no longer be used, or it may be used to pick future mobility “waypoints” for such mobility models. Most users interact with the mobility system using mobility helper classes. The MobilityHelper combines a mobility model and position allocator, and can be used with a node container to install mobility capability on a set of nodes. We first describe the coordinate system and issues surrounding multiple coordinate systems. Coordinate system There are many possible coordinate systems and possible translations between them. ns-3 uses the Cartesian coordinate system only, at present. The question has arisen as to how to use the mobility models (supporting Cartesian coordinates) with different coordinate systems. This is possible if the user performs conversion between the ns-3 Cartesian and the other coordinate 177