Lab 2 : Using Wireless module in NS
This part of the lab will consist of creating wireless simulations in ns.
- Create a simple 3 node wireless topology. The nodes use DSDV (an ad-hoc routing protocol) to route packets among themselves. They also use
- 802.11 mac
- two-ray ground radio propagation model
- priority queue with queue length of 50
- omni-directional antenna
- topology of 670 X 670.
- the simulation stops at 200s
- A sample script having other default values for the network components are provided at lab2-wl.tcl.
- Node movement: Simple node movement scenario (created by hand) can be found in lab2-wl.tcl.
- Traffic generation: Setup a UDP connection between node 0; add CBR traffic. You can use the following values for the cbr flow. Let the cbr source start at time 50s.
$cbr_(0) set packetSize_ 512 (in bytes)
$cbr_(0) set interval_ 0.5 (interarrval time)
$cbr_(0) set random_ 1
$cbr_(0) set maxpkts_ 10000
$cbr_(0) set fid_ 0
- Turn on agent and router tracing. Turn mac tracing to off.
- Set a nam animation rate of 100ms.
- Open trace file to view ns trace output.(You may name it wirelesslab.tr)
- Open namtrace file to view nam animation of yr simulation. (Similarly wirelesslab.nam)
- Create and run the script in ns. View the nam output in nam.
Can you see the periodic DSDV routing messages? ...
Can you see the CBR packets flowing?
Can you see the nodes moving in and out of their radio ranges?
- Now turn on mac tracing. Run yr simulation and then look at the trace output. Can you see RTS/CTS transmissions at the MAC layer?
- Next add incoming packet loss model to the nodes. Run sim and look at trace outputs again.
Can you see MAC re-transmissions for lost packets?
Use "-IncomingErrProc UniformErrorProc" to add the error model.
- Remove the error model and now add energy model to the mobilenodes. Use the following values:
* attach an energy model -energyModel EnergyModel
* Initial energy of 0.455 joules. -initialEnergy $opt(IE)
* Rx power of 0.3 -rxPower $opt(rp)
* Tx power of 0.6 -txPower $opt(tp)
And run simulations. What do you see? Why? [hint:energy-efficiency of MAC]
- Replace the 802.11 mac with Mac/SMAC (sensor MAC). Run simulation and view in nam.
What happens now?
Optional: Use nam editor to create the wireless scenario in (1) above.