Download presentation
Presentation is loading. Please wait.
Published byJase Stopper Modified over 10 years ago
1
How (not) to Simulate Wireless Networks with ns Brad Karp bkarp@cs.ucl.ac.uk University College London ns Workshop MSR Cambridge 9 th December, 2005
2
2 Outline Overview of ns wireless functionality –History –Simple example –MobileNode configuration –Controlling mobility –Defining traffic workloads –MobileNode architecture –Trace file format Role of simulation in wireless research Case study of simulation’s pitfalls: GPSR ns overview material largely borrowed: ns Manual (Chapter 16) Padma Haldar’s tutorial (11/2002)
3
3 History of ns Wireless Support David Johnson’s Monarch group at CMU: –Free-space, two-ray ground reflection channel model –802.11 MAC layer –Random waypoint mobility model –ARP –Ad hoc routing: Dynamic Source Routing (DSR), TORA, … –&c. Other major supported protocols and links (outside scope of today’s talk): Mobile IP, Directed Diffusion, satellite links, &c.
4
4 ns Wireless Architecture MobileNode at core of mobility support MobileNodes can move in a given topology, receive/transmit signals to/from wireless channels Wireless network stack consists of LL, ARP, MAC, IFQ, &c. Allows simulations of multi-hop ad hoc networks, wireless LANs, sensor networks etc
5
5 Wireless Example: Ad hoc Routing Scenario –2 mobile nodes –moving within 500m x 500m flat topology –using DSDV ad hoc routing protocol –Random Waypoint mobility model –TCP traffic Examples: –ns-2/ns-tutorial/examples/simple-wireless.tcl –ns-2/tcl/ex/wireless-demo-csci694.tcl
6
6 An Example – Step 1 # Define Global Variables # create simulator set ns [new Simulator] # create flat topology in 670m x 670m area set topo [new Topography] $topo load_flatgrid 500 500
7
7 An Example – Step 2 # Define wireless ns trace # ns trace set tracefd [open simple.tr w] $ns trace-all $tracefd
8
8 GOD ( General Operations Director ) Stores all-pairs Dijkstra shortest path lengths Allows comparison of path length with optimal Automatically generated, contained in scenario file set god [create-god ] $god set-dist
9
9 Example –Step 3 Create god set god [create-god 2] $ns at 900.00 “$god setdist 1 2 1” Create wireless channel set thechan [new Channel/WirelessChannel]
10
10 An Example – Step 4 # Define how a mobile node is configured $ns node-config \ -adhocRouting DSDV \ -llType LL \ -macType Mac/802_11 \ -ifqLen 50 \ -ifqType Queue/DropTail/PriQueue \ -antType Antenna/OmniAntenna \ -propType Propagation/TwoRayGround \ -phyType Phy/WirelessPhy \ -channel $thechan \ -topoInstance $topo -agentTrace ON \ -routerTrace OFF \ -macTrace OFF \ -movementTrace OFF
11
11 An Example – Step 5 # Use “for” loop to create 3 nodes: for {set i 0} {$i < 2} {incr i} { set node($i) [$ns node] # disable random motion $node($i) random-motion 0 }
12
12 MobileNode Movement Node position defined in 3D Today, z axis not used $node set X_ $node set Y_ $node set Z_ $node at setdest Lots of these events over a simulation; manual generation tedious…
13
13 Random Waypoint Model Place nodes uniformly at random Node moves to uniformly randomly chosen destination, at velocity chosen uniformly at random Between move events, node stays put for “pause time” Meant to mimic user behavior: move, work, move…
14
14 Scenario Generator: Movement setdest: MobileNode movement generator setdest -n -p pausetime -M -t -x -y setdest -n -p pausetime -M -t -x -y ns-2/indep-utils/cmu-scen- gen/setdest/ Source: ns-2/indep-utils/cmu-scen- gen/setdest/
15
15 Example setdest Output $node_(2) set Z_ 0.000000000000 $node_(2) set Y_ 199.373306816804 $node_(2) set X_ 591.256560093833 $node_(1) set Z_ 0.000000000000 $node_(1) set Y_ 345.357731779204 $node_(1) set X_ 257.046298323157 $node_(0) set Z_ 0.000000000000 $node_(0) set Y_ 239.438009831261 $node_(0) set X_ 83.364418416244 $god_ set-dist 0 1 1 $ns_ at 50.000000000000 "$node_(2) setdest 369.463244915743 170.519203111152 3.371785899154" $ns_ at 51.000000000000 "$node_(1) setdest 221.826585497093 80.855495003839 14.909259208114" $ns_ at 33.000000000000 "$node_(0) setdest 89.663708107313 283.494644426442 19.153832288917"
16
16 Scenario Generator: Traffic Generating traffic pattern files –CBR/TCP traffic ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate (pkt/s)] –CBR traffic ns cbrgen.tcl –type cbr –nn 20 –seed 1 –mc 8 -rate 4 -rate 4 –TCP traffic ns cbrgen.tcl –type tcp -nn 15 -seed 0 –mc 6 Default packet size: 512 bytes, hardwired in script! Start time uniform in [0, 180] s, hardwired in script! To evaluate routing, which traffic type would you use? ns-2/indep-utils/cmu-scen-gen/Source: ns-2/indep-utils/cmu-scen-gen/
17
17 A Traffic Scenario set udp_(0) [new Agent/UDP] $ns_ attach-agent $node_(0) $udp_(0) set null_(0) [new Agent/Null] $ns_ attach-agent $node_(2) $null_(0) set cbr_(0) [new Application/Traffic/CBR] $cbr_(0) set packetSize_ 512 $cbr_(0) set interval_ 4.0 $cbr_(0) set random_ 1 $cbr_(0) set maxpkts_ 10000 $cbr_(0) attach-agent $udp_(0) $ns_ connect $udp_(0) $null_(0) $ns_ at 127.93667922166023 "$cbr_(0) start" …….
18
18 An Example – Step 6 # Define node movement model source # Define traffic model source
19
19 An Example – Step 7 # Tell ns the simulation stop time $ns at 200.0 “$ns halt” # Start your simulation $ns run
20
20 Energy Extension Makes MobileNode energy-aware Enable by adding options: $ns_ node-config \ – energyModel EnergyModel - initialEnergy100.0 -txPower0.6 -rxPower0.2
21
21 Outline Overview of ns wireless functionality –History –Simple example –MobileNode configuration –Controlling mobility –Defining traffic workloads –MobileNode architecture –Trace file format Role of simulation in wireless research Case study of simulation’s pitfalls: GPSR
22
22 Wireless Internals MobileNode –Basic entity with address and port de-muxes, routing agent, &c. –Stack of network components, including IFQ, LL, MAC, NetIF, radio propagation model, &c. Wireless channel
23
23 Portrait of A Mobile Node Node ARP Propagation and antenna models MobileNode LL MAC PHY LL CHANNEL LL MAC PHY Classifier: Forwarding Agent: Protocol Entity Node Entry LL: Link layer object IFQ: Interface queue MAC: Mac object PHY: Net interface protocol agent routing agent addr classifier port classifier 255 IFQ defaulttarget_ Radio propagation/ antenna models Prop/ant
24
24 Mobile Node : Components Classifiers defaulttarget_ points to routing agent object 255 is the port id assigned for rtagent_ Routing agent Ad hoc routing protocol, e.g., AODV, DSDV, DSR; or directed diffusion
25
25 Mobile Node: Components Link Layer –Same as LAN, but with a separate ARP module –Looks up IP-to-MAC mappings using ARP ARP –Resolves IP address to hardware (MAC) address –Broadcasts ARP query Interface queue (IFQ) –Gives priority to routing protocol packets –Has packet filtering (search and remove) capacity
26
26 Mobile Node: Components MAC –802.11 IEEE RTS/CTS/DATA/ACK for unicast Sends DATA directly for broadcast Network interface (PHY) –Used by MobileNode to access channel –Stamps outgoing packets with meta-data –Interface with radio/antenna models
27
27 Mobile Node: Components Radio Propagation Model –Friss-space model: attenuation at near distance –Two-ray ground reflection model: attenuation at far distance –Shadowing model: probabilistic Antenna –Omni-directional, unity-gain
28
28 Wireless Channel Duplicate packets to all mobile nodes attached to the channel except the sender It is the receiver’s responsibility to decide if it will accept the packet –Collision is handled at individual receiver –O(N 2 ) computation!
29
29 Wireless Trace Support CMU trace format differs from standard ns trace format! Configurable tracing: –MAC (very voluminous!) –Router forwarding –Agent events –Movement events Format described in detail in ns manual When in doubt, no substitute for reading the code! Shortest path lengths logged per pkt rx (cost in-core?) “New” wireless trace format –appears not to be in wide use yet –same information, formatted differently
30
30 Outline Overview of ns wireless functionality –History –Simple example –MobileNode configuration –Controlling mobility –Defining traffic workloads –MobileNode architecture –Trace file format Role of simulation in wireless research Case study of simulation’s pitfalls: GPSR
31
31 Simulation as Way to Enable Area Ad hoc routing: huge system deployment/debugging cost 1998 Broch et al. paper a watershed for ad hoc routing: first even comparison of wide field of protocols CMU ns wireless “extensions” the basis of most ad hoc networking research for next 5+ years
32
32 Simulation as Way to Kill Area Simulators don’t evaluate motivation! –Why are 500 laptops in a gymnasium not simply connecting to base stations? The founding of MobiHoc –cf. the founding of SIGMETRICS… The founding of MobiSys Secret tip: building a real system dramatically increases chances of acceptance! (because it’s HARD)
33
33 Things to Investigate Using ns Coarse notion of capacity Coarse notion of effect of mobility Fine-grained behavior of your routing (or other hop-by-hop) protocol –Only place you can easily have “centralized’ view!
34
34 Things Not to Investigate Using ns Realistic loss behavior (interference, multi- path fading, …) Broadcast Packet Delivery Probability Node Pair Roofnet measurements [SIGCOMM 2004]
35
35 Not in ns (cont’d) Realistic topology information –Roofnet finding: RTS/CTS useless in outdoor network! –Hidden terminal problem still mainstay of undergraduate networking courses everywhere… –GPSR free space ns simulation debacle (more later) Fine-grained mobility behavior –Random Waypoint corresponds little to reality –GPSR density anomaly (more later)
36
36 When to Roll Your Own Simulator GPSR greedy-only simulator –properties of node density, not of fine-grained radio propagation –~250 lines of C, a morning’s work –far faster than ns will ever be Simple visualization –GPSR topology visualizer find connected components show planar subgraphs animate forwarding
37
37 Outline Overview of ns wireless functionality –History –Simple example –MobileNode configuration –Controlling mobility –Defining traffic workloads –MobileNode architecture –Trace file format Role of simulation in wireless research Case study of simulation’s pitfalls: GPSR
38
38 Central idea:Machines can know their geographic locations. Route using geography. [MobiCom 2000] Packet destination field: location of destination Nodes all know own positions, e.g., –by GPS (outdoors) –by surveyed position (for non-mobile nodes) –by short-range localization (indoors, [AT&T Camb, 1997], [Priyantha et al., 2000]) –&c. Two forwarding algorithms: –Greedy mode simply chooses closest neighbor to destination –Perimeter mode recovers when no closer next hop available, by routing on planar subgraph of full network graph Scalability: tiny state per router; low routing protocol overhead; approximates shortest paths; high delivery success rate Greedy Perimeter Stateless Routing (GPSR)
39
39 Greedy Forwarding Nodes learn immediate neighbors’ positions from beaconing/piggybacking on data packets Locally optimal, greedy next hop choice: –Neighbor geographically nearest destination D x y
40
40 Greedy Forwarding Failure Greedy forwarding not always possible! Consider: D x z v void w y How can we circumnavigate voids? …based only on one-hop neighborhood?
41
41 Well-known graph traversal: right-hand rule Requires only neighbors’ positions Void Traversal: The Right-hand Rule x y z Doesn’t work when edges in graph cross one another!
42
42 Planarized Graphs: Example 200 nodes, placed uniformly at random on 2000-by-2000-meter region; 250-meter radio range Full Graph GG Subgraph RNG Subgraph
43
43 Packet Delivery Success Rate (50, 200; Dense)
44
44 GPSR: Making it Real We implemented full GPSR for Berkeley mote sensors [NSDI 2005] –3750 lines of nesC code –also includes: simple link thresholding, ARQ Deployed on Mica 2 “dot” mote testbeds –23-node, 50-node subsets of 100-node network in office building (Soda Hall; office walls; 433 MHz) –40-node network in office building (Intel Research Berkeley; cubicles; 900 MHz) Delivery success workload: 50 packets between all node pairs, serially
45
45 50-Node Testbed, Soda Hall GAME OVER Only 68.2% of node pairs connected!! What’s going on here?!
46
46 Planar, but Partitioned Output of GPSR’s Distributed GG (arrows denote unidirectional links) Absorption, reflection (multi-path), interference, antenna orientation differences, &c., lead to non-uniform radio ranges. RNG and GG partition graphs when radio ranges not uniform! Solution: entirely new protocol, CLDP, for removing crossing edges [NSDI 2005]. Provably correct on all connected graphs.
47
47 Key Lessons and Conclusion Understand your algorithm’s correctness assumptions Does the simulator model these properties accurately, or at least pessimistically? Fading, interference, loss rate particular pitfalls No substitute for building—even moreso than for Internet congestion control, as propagation too complex to model accurately
48
48 UCL: A Tradition of Great Networking Research in London Hiring junior and senior networking faculty Application deadline: 5 th January, 2006 Details at http://www.cs.ucl.ac.uk/ http://www.cs.ucl.ac.uk/ Why UCL? –Research: sdr, rat, Landmark Routing, NAT, XORP, TFRC, XCP, GPSR, CLDP, GHT, Autograph, Polygraph, … –Students (Paul Francis, Mark Handley, Jon Crowcroft, …) –LONDON
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.