Steps for conducting the experiment
Follow are the steps to be followed in general to perform the experiments in Advanced Network Technologies Virtual Lab.
- Read the theory about the experiment
- View the simulation provided for a chosen, related problem
- Take the self evaluation to judge your understanding (optional, but recommended)
- Go to the exercises section, choose a problem, and carefully read the problem description
- Write a script (or make necessary changes) to simulate the desired scenario in the code editor just below the problem statement
- Click on the 'Run' button to execute the simulation script
- Simulation with ns2: If the simulation was successful, and was instructed to create a trace file, contents of the trace file would be displayed in the area below the 'Run' button
- Simulation with ns3: If the simulation was successful, output of the program would be displayed in the area below the 'Run' button
- A trace file generated as a result of simulation with ns2 could be used for certain kind of analysis, which would be discussed in a later section
Experiment Specific Instructions
- The problem statement is presented on the 'Exercises' page, which you have to simulate with ns2.
- Set the global configuration parameter.
- Set application time for different traffic movement as shown below:
- Create an instance of simulator for required simulation and generate a trace file for the analysis of simulation.
- Run simulation in verbose mode as shown below:
- Set carrier sensing threshold and reception threshold as shown below:
- Set the topography object by defining the grid on x and y axix.
- Create God and channel.
- Configure the node by including routing protocol , link layer, ifq , MAC layer,energy model, initial energy etc. as shown below:
- The node position are defined by x,y and z coordinates as follows:
- Start a new PAN coordinator and activate it as a PAN coordinator as shown below:
- Similarly set up and start device as shown below for different nodes:
- Assign traffic pattern for the network.
- Define a finish procedure.
- Set the start and stop time for the simulator
- Check the trace file and find the average energy consumption of nodes excluding coordinator.(See the exercise for calculating the average energy consumption of each node.) for beacon order(BO)= 6,7,8,9,10 and superframe order(SO)=0,1,2.
- Plot the data for average energy consumption by taking beacon order in x-axis and average energy in y-axis for SO=0,1,2 .
set appTime1 7.0 ;# in seconds
Mac/802_15_4 wpanCmd verbose on
set dist(15m) 8.54570e-07 Phy/WirelessPhy set CSThresh_ $dist(15m) Phy/WirelessPhy set RXThresh_ $dist(15m)
If the received signal strength is greater than RXThresh_ threshold, the packet can be successfully received.If received signal strength is greater than CSThresh_ threshold, the packet transmission can be sensed.
$ns_ node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -topoInstance $topo \ -agentTrace OFF \ -routerTrace OFF \ -macTrace ON \ -movementTrace OFF \ -energyModel "EnergyModel" \ -initialEnergy 1 \ -rxPower 0.3 \ -txPower 0.3 \ -channel $chan_1_
$node_(0) set X_ 25 $node_(0) set Y_ 25 $node_(0) set Z_ 0
$ns_ at 0.0 "$node_(0) NodeLabel PAN Coor" $ns_ at 0.0 "$node_(0) sscs startPANCoord 1 6 0" ;# startPANCoord <txBeacon> <BO> <SO>
$ns_ at 0.5 "$node_(1) sscs startDevice 1 0 0 6 0" ;# startDevice <FFD> <assoPermit> <txBeacon> <BO> <SO> $ns_ at 1.5 "$node_(2) sscs startDevice 1 0 0 6 0" $ns_ at 2.5 "$node_(3) sscs startDevice 1 0 0 6 0" $ns_ at 3.5 "$node_(4) sscs startDevice 1 0 0 6 0" $ns_ at 4.5 "$node_(5) sscs startDevice 1 0 0 6 0" $ns_ at 5.5 "$node_(6) sscs startDevice 1 0 0 6 0"
Trace File Analysis
A simple tool has been provided as part of this lab to analyze the trace files generated after simulation with ns2. A summary of the available options, and usage guide is given below.
Following is a list of functionalities provided by the Trace Analysis tool:
Trace file formats: Following trace file formats are
- Wireless (new format)
- Satellite -- currently redirects to wired mode
- Mixed -- when both wired and wireless connections are present in the simulation
General Statistics: To provide some common statistics
about the simulation being run. Currently displays only the simulation duration.
- Inputs: None
- Output: Text
Average Throughput: Computes total # of bytes received
by a node over the entire simulation duration
- Inputs: Node #
- Output: Number
Bytes Received: Plots cumulative count of bytes received by
a node over the entire simulation duration
- Inputs: Node #; for wireless scenario, trace levels (AGT, MAC, RTR)
- Output: Graph
End-to-end Delay: Plots the end-to-end delay delay encountered
by packets while moving from a source node to the destination node
- Inputs: Source node #, destination node #, scaling factor [optional] -- scaling factor helps to amplify the y-axis values
- Output: Graph
Packet Retransmissions: Plots # of retransmission(s) of
a given packet occurs between the source and destination nodes
- Inputs: Source node #, destination node #
- Output: Graph
Hop Count: Plots the # of hops traveled by a packet to reach
the destination node from the source node. It counts the destination node as well.
- Inputs: Source node #, source port #, destination node #, destination port #
- Output: Graph
- For analyzing the problems in the "Satellite Networks" experiment, please use the Wired mode of analysis
- Analysis of trace files for mixed mode of simulations (wired & wireless) is not supported currently
- Outputs produced do not necessarily have accuracy for scientific publications. In particular, the plot of hop counts may vary a bit from the original count (in wireless mode) in cases when a packet has been forwarded to more than one node.
- The tool currently allows only a single instance of a given type of plot. For example, this doesn't let you plot end-to-end delays between multiple (source, destination) node pairs