MobilityHelper

From Nsnam
Revision as of 21:06, 25 March 2008 by Tjkopena (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here's the basic usage for the mobility helper:

  • Create a MobilityHelper object
  • Set the options on it, i.e. what positioning scheme to use and what mobility models to assign
  • Apply the helper to a NodeContainer to position the nodes and assign them mobility models

A simple example is in samples/main-grid-topology.cc in the repositories & packages.

Position Allocators

Grid

  MobilityHelper mobility;
  // setup the grid itself: objects are layed out
  // started from (-100,-100) with 20 objects per row, 
  // the x interval between each object is 5 meters
  // and the y interval between each object is 20 meters
  mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
                                 "MinX", Double (-100.0),
                                 "MinY", Double (-100.0),
                                 "DeltaX", Double (5.0),
                                 "DeltaY", Double (20.0),
                                 "GridWidth", Uinteger (20),
                                 "LayoutType", String ("RowFirst"));

Mobility Model

Static Mobility

  // each object will be attached a static position.
  // i.e., once set by the "position allocator", the
  // position will never change.
  mobility.SetMobilityModel ("ns3::StaticMobilityModel");
</code>