Introduction to Wireless simulations - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to Wireless simulations

Description:

Introduction to Wireless simulations Shao-Cheng Wang Wireless Simulations Before simulation Generate traffic files: cbrgen.tcl Generate mobility files: setdest ... – PowerPoint PPT presentation

Number of Views:140
Avg rating:3.0/5.0
Slides: 23
Provided by: bey64
Learn more at: https://www.cise.ufl.edu
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Wireless simulations


1
Introduction to Wireless simulations
  • Shao-Cheng Wang

2
Wireless Simulations
  • Before simulation
  • Generate traffic files cbrgen.tcl
  • Generate mobility files setdest calcdest
  • Simulation
  • simple-wireless.tcl
  • After simulation
  • Trace formats
  • Nam
  • Marc Greis's tutorial http//www.isi.edu/nsnam/ns/
    tutorial/index.html

3
Traffic file
  • cbrgen.tcl (/ns/indep-util/cmu-trace)
  • ns cbrgen.tcl -type cbrtcp -nn nodes -seed
    seed -mc connections -rate rate

4
Traffic file (contd)
  • gt ns cbrgen.tcl -type cbr -nn 10 -seed 1.0 -mc 8
    -rate 4.0
  • 2 connecting to 3 at time 82.557023746220864
  • set udp_(0) new Agent/UDP
  • ns_ attach-agent node_(2) udp_(0)
  • set null_(0) new Agent/Null
  • ns_ attach-agent node_(3) null_(0)
  • set cbr_(0) new Application/Traffic/CBR
  • cbr_(0) set packetSize_ 512
  • cbr_(0) set interval_ 0.25
  • cbr_(0) set random_ 1
  • cbr_(0) set maxpkts_ 10000
  • cbr_(0) attach-agent udp_(0)
  • ns_ connect udp_(0) null_(0)
  • ns_ at 82.557023746220864 "cbr_(0) start"

5
Mobility file
  • ./setdest -n num_of_nodes -p pausetime -s
    maxspeed -t simtime \ -x maxx -y maxy gt
    outdir/movement-file
  • node_(0) x,y,z
  • ns_ at 2.000000000000 "node_(0) setdest
    90.441179033457 44.896095544010 1.373556960010"
  • ns_ at 899.642 "god_ set-dist 23 46 2"

calcdest
6
Wireless Simulations
  • Before simulation
  • Generate traffic files cbrgen.tcl
  • Generate mobility files setdest calcdest
  • Simulation
  • simple-wireless.tcl
  • After simulation
  • Trace formats
  • Nam
  • Marc Greis's tutorial http//www.isi.edu/nsnam/ns/
    tutorial/index.html

7
Wireless simulation
  • set val(chan) Channel/WirelessChannel
    channel type
  • set val(prop) Propagation/TwoRayGround
    radio-propagation model
  • set val(ant) Antenna/OmniAntenna
    Antenna type
  • set val(ll) LL
    Link layer type
  • set val(ifq) Queue/DropTail/PriQueue
    Interface queue type
  • set val(ifqlen) 50
    max packet in ifq
  • set val(netif) Phy/WirelessPhy
    network interface type
  • set val(mac) Mac/802_11
    MAC type
  • set val(rp) DSDV
    ad-hoc routing protocol
  • (optional)
  • Phy/WirelessPhy set bandwidth_ 11000000
  • Phy/WirelessPhy set Rb_ 11000000
  • Mac/802_11 set dataRate_ 11000000
  • Mac/802_11 set basicRate_ 2000000
  • Agent/DSDV set min_update_periods_ 3
  • (ref tcl/lan/ns-mac.tcl, tcl/mobility/dsdv.tcl)

8
Wireless simulation contd
  • set val(nn) 2
    number of mobilenodes
  • set opt(x) 1300 X dimension of
    the topography
  • set opt(y) 1300 Y dimension of
    the topography
  • set val(cp) "example.scen"
  • set val(trfile) "example.traffic"
  • set ns_ new Simulator
  • ns_ trace-all tracefd
  • set topo new Topography
  • wtopo load_flatgrid opt(x) opt(y)
  • create-god val(nn)

9
  • 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 \
  • -channelType val(chan)
    \
  • -agentTrace ON \
  • -routerTrace OFF \
  • -macTrace OFF \
  • -movementTrace OFF

10
  • for set i 0 i lt val(nn) incr i
  • set node_(i) ns_ node
  • node_(i) random-motion 0
    disable random motion
  • source val(cp)
  • source val(trfile)
  • for set i 0 i lt val(nn) incr i
  • ns_ at 150.0 "node_(i) reset"
  • ns_ at 150.0001 "stop"
  • ns_ at 150.0002 "puts \"NS EXITING...\" ns_
    halt"
  • proc stop
  • global ns_ tracefd
  • close tracefd
  • puts "Starting Simulation..."
  • ns_ run

11
Wireless Simulations
  • Before simulation
  • Generate traffic files cbrgen.tcl
  • Generate mobility files setdest calcdest
  • Simulation
  • simple-wireless.tcl
  • After simulation
  • Trace formats
  • Nam
  • Marc Greis's tutorial http//www.isi.edu/nsnam/ns/
    tutorial/index.html

12
After simulation trace format
  • Special parameter
  • Enables trace for congestion window.
  • tcp trace cwnd_
  • Attaches trace file handle to agent.
  • set tchan_ open cwnd.tr w
  • tcp attach tchan_
  • set awkCode
  • if (6 "cwnd_")
  • print 1, 7 gtgt "temp.c"
  • exec awk awkCode cwnd.tr
  • Detailed trace format /ns/cmu-trace.cc

13
Trace
  • s 0.000011740 _0_ RTR --- 0 ZRP 84 0 0 0 0
    ------- 0255 -1255 1 0 0x1 0 0 0
    2.000000 (HELLO) -1
  • sprintf(wrk_ offset, "0xx d d d f
    (s) d",
  • rp-gtrp_type,
  • rp-gtrp_hop_count,
  • rp-gtrp_dst,
  • rp-gtrp_dst_seqno,
  • rp-gtrp_lifetime,
  • rp-gtrp_type
    ZRPTYPE_RREP ? "REPLY IERP"
  • (rp-gtrp_type
    ZRPTYPE_UREP ? "UNSOLICITED REPLY IERP"
  • "HELLO"),ih-gtdaddr())

14
Nam
  • node color color sets color of node
  • node shape shape sets shape of node
  • node label label sets label on node
  • node label-color lcolor sets color of
    label
  • node label-at ldirection sets position of
    label
  • node add-mark name color shape adds a
    mark to node
  • node delete-mark name deletes mark from
    node

15
More resources
  • Doc
  • ns by Example
  • http//nile.wpi.edu/NS/
  • NS Manual
  • http//www.isi.edu/nsnam/ns/doc/index.html
  • Workshop and presentations
  • http//www.isi.edu/nsnam/ns/ns-tutorial/index.htm
    l
  • Contributed Modules
  • http//nsnam.isi.edu/nsnam/index.php/Contributed_C
    ode

16
  • Backup Slides

17
Mobile Node Abstraction
  • Location
  • Coordinates (x,y,z)
  • Movement
  • Speed, direction, starting/ending location, time
    ...

18
Portrait of A Mobile Node
port classifier
Node
protocol agent
255
routing agent
addr classifier
defaulttarget_
ARP
LL
LL
LL
IFQ
IFQ
MAC
MAC
Propagation and antenna models
PHY
PHY
MobileNode
CHANNEL
19
Mobile Node Components
  • Link Layer
  • Same as LAN, but with a separate ARP module
  • Interface queue
  • Give priority to routing protocol packets
  • Mac Layer
  • IEEE 802.11
  • RTS/CTS/DATA/ACK for all unicast packets
  • DATA for all broadcast packets

20
Mobile Node Components
  • Network interface (PHY)
  • Parameters based on Direct Sequence Spread
    Spectrum (WaveLan)
  • Interface with antenna and propagation models
  • Update energy transmission and reception
  • Radio Propagation Model
  • Friss-space attenuation(1/r2) at near distance
  • Two-ray Ground (1/r4) at far distance
  • Antenna
  • Omni-directional, unity-gain

21
Wireless Channel
  • Duplicate packets to all mobile nodes attached to
    the channel except the sender
  • It is the receivers responsibility to decide if
    it will accept the packet
  • Collision is handled at individual receiver
  • O(N2) messages ? grid keeper

22
Grid-keeper An Optimization
Write a Comment
User Comments (0)
About PowerShow.com