16.5 Commands at a glance
Following is a list of commands used in wireless simulations:
$ns_ node-config -addressingType \<usually flat or hierarchical used for
-adhocRouting \<adhoc rotuing protocol like PUMA, DSR,
TORA, AODV, DSDV etc\>
-macType \<MAC type like Mac/802_11\>
-propType \<Propagation model like
-ifqType \<interface queue type like
-ifqLen \<interface queue length like 50\>
-phyType \<network inteface type like
-antType \<antenna type like Antenna/OmniAntenna\>
-channelType \<Channel type like Channel/WirelessChannel\>
-topoInstance \<the topography instance\>
-wiredRouting \<turning wired routing ON or OFF\>
-mobileIP \<setting the flag for mobileIP ON or OFF\>
-energyModel \<EnergyModel type\>
-initialEnergy \<specified in Joules\>
-rxPower \<specified in W\>
-txPower \<specified in W\>
-agentTrace \<tracing at agent level turned ON or OFF\>
-routerTrace \<tracing at router level turned ON or OFF\>
-macTrace \<tracing at mac level turned ON or OFF\>
-movementTrace \<mobilenode movement logging turned
ON or OFF\>
This command is used typically to configure for a mobilenode. For more info
about this command (part of new node APIs) see chapter titled "Restructuring
ns node and new Node APIs" in ns Notes and Documentation.
$ns_ node optional:hier address
This command is used to create a mobilenode after node configuration is done
as shown in the node-config command. Incase hierarchical addressing is being
used, the hier address of the node needs to be passed as well.
This command previously used to enable logging of mobilenode's movement has now
been replaced by $ns_ node-config -movementTrace ON or OFF.
This command is used to create a God instance. The number of mobilenodes
is passed as argument which is used by God to create a matrix to store
connectivity information of the topology.
$topo load_flatgrid X Y optional:res
This initializes the grid for the topography object. <X> and <Y> are the x-y
co-ordinates for the topology and are used for sizing the grid. The grid
resolution may be passed as <res>. A default value of 1 is normally used.
$topo load_demfile file-descrptor
For loading DEMFile objects into topography. See ns/dem.cc,.h for details on
$ns_ namtrace-all-wireless namtrace X Y
This command is used to initialize a namtrace file for logging node movements
to be viewed in nam. The namtrace file descriptor, the X and Y
co-ordinates of the wireless topology is passed as parameters with
$ns_ nam-end-wireless stop-time
This command is used to tell nam the simulation stop time given by <stop-time>.
$ns_ initial_node_pos node size
This command defines the node initial position in nam. <size> denotes the size
of node in nam. This function must be called after mobility model has been
$mobilenode random-motion 0 or 1
Random-motion is used to turn on random movements for the mobilenode, in which
case random destinations are assigned to the node. 0 disables and 1 enables
$mobilenode setdest X Y s
This command is used to setup a destination for the mobilenode. The mobile
node starts moving towards destination given by <X> and <Y> at a speed of
This command is used to reset all the objects in the nodes (network
components like LL, MAC, phy etc).
Following is a list of internal procedures used in wireless networking:
$mobilenode base-station BSnode-hier-addr
This is used for wired-cum-wireless scenarios. Here the mobilenode is provided
with the base-stationnode info for its domain. The address is hierarchical
since wired-cum-wireless scenarios typically use hierarchical addressing.
$mobilenode log-target target-object
The <target-object>, which is normally a trace object, is used to log
mobilenode movements and their energy usage, if energy model is provided.
$mobilenode topography topoinstance
This command is used to provide the node with a handle to the topography
A mobilenode may have more than one network interface. This command is used
to pass handle for a network interface to the node.
$mobilenode namattach namtracefd
This command is used to attach the namtrace file descriptor <namtracefd>
to the mobilenode. All nam traces for the node are then written into this
$mobilenode radius r
The radius <r> denotes the node's range. All mobilenodes that fall within
the circle of radius <r> with the node at its center are considered as
neighbours. This info is typically used by the gridkeeper.
This command is used to start off the movement of the mobilenode.