Node configuration essentially consists of defining the different node characteristics before creating them. They may consist of the type of addressing structure used in the simulation, defining the network components for mobilenodes, turning on or off the trace options at Agent/Router/MAC levels, selecting the type of adhoc routing protocol for wirelessnodes or defining their energy model. The node configuration API in its entirety looks as the following:
OPTION_TYPE AVAILABLE OPTION_VALUES ------------- -------------------------- $ns_ node-config -addressingType flat or hierarchical or expanded -adhocRouting DSDV or DSR or TORA or AODV -llType LL -macType Mac/802_11 -propType Propagation/TwoRayGround -ifqType Queue/DropTail/PriQueue -ifqLen 50 -phyType Phy/WirelessPhy -antType Antenna/OmniAntenna -channelType Channel/WirelessChannel -topoInstance $topo_instance -wiredRouting ON or OFF -mobileIP ON or OFF -energyModel EnergyModel -initialEnergy (in Joules) -rxPower (in W) -txPower (in W) -agentTrace ON or OFF -routerTrace ON or OFF -macTrace ON or OFF -movementTrace ON or OFF -reset
The default values for all the above options are NULL except -addressingType whose default value is flat. The option -reset can be used to reset all node-config parameters to their default value.
Thus node-configuration for a wireless, mobile node that runs AODV as its adhoc routing protocol in a hierarchical topology would be as shown below. We decide to turn tracing on at the agent and router level only. Also we assume a topology has been instantiated with "set topo [new Topography]". The node-config command would look like the following:
$ns_ node-config -addressingType hierarchical -adhocRouting AODV -llType LL -macType Mac/802_11 -ifqType Queue/DropTail/PriQueue -ifqLen 50 -antType Antenna/OmniAntenna -propType Propagation/TwoRayGround -phyType Phy/WirelessPhy -topoInstance $topo -channelType Channel/WirelessChannel -agentTrace ON -routerTrace ON -macTrace OFF -movementTrace OFF
Note that the config command can be broken down into separate lines like
$ns_ node-config -addressingType hier $ns_ node-config -macTrace ON
The options that need to be changed may only be called. For example after configuring for AODV mobilenodes as shown above (and after creating AODV mobilenodes), we may configure for AODV base-station nodes in the following way:
$ns_ node-config -wiredRouting ON
While all other features for base-station nodes and mobilenodes are same, the base-station nodes are capable of wired routing, while mobilenodes are not. In this way we can change node-configuration only when it is required.
All node instances created after a given node-configuration command will have the same property unless a part or all of the node-config command is executed with different parameter values. And all parameter values remain unchanged unless they are expicitly changed. So after creation of the AODV base-station and mobilenodes, if we want to create simple nodes, we will use the following node-configuration command:
$ns_ node-config -reset
This will set all parameter values to their default setting which basically defines configuration of a simple node.