[ns] why does the code below doesn't work as expected
Pedro Vale Estrela
pedro.estrela at gmail.com
Wed Aug 30 03:50:26 PDT 2006
use
$udapp set rate_ 1Mb
pedro Estrela
> -----Original Message-----
> From: ns-users-bounces at ISI.EDU [mailto:ns-users-bounces at ISI.EDU] On Behalf
> Of Sandeep
> Sent: quarta-feira, 30 de Agosto de 2006 7:47
> To: ns-users at ISI.EDU
> Subject: [ns] why does the code below doesn't work as expected
>
>
> Hi
> In the below code whatever Mac/802_11 parameters I set are not taking
> effect. For instance eventhough I set _dataRate 11mbps, throughput is
> coming around 400kbps, which is the default rate for udp. If I change
> _dataRate, basicRate_ or PLCPDataRate_ , there is absolutely no effect.
> Please if anyone can help, because I require them in my work.
> Thanks in advance,
> regards,
> Sandeep.
> 1 set val(chan) Channel/WirelessChannel ;# channel type
> 2 set val(prop) Propagation/TwoRayGround ;#
> radio-propagation model
> 3 set val(netif) Phy/WirelessPhy ;# network
> interface type
> 4 set val(mac) Mac/802_11 ;# MAC type
> 5 set val(ifq) Queue/DropTail/PriQueue ;# interface queue
> type
> 6 set val(ll) LL ;# link layer type
> 7 set val(ant) Antenna/OmniAntenna ;# antenna model
> 8 set val(ifqlen) 50 ;# max packet in ifq
> 9 set val(nn) 2 ;# number of
> mobilenodes
> 10 set val(rp) DSDV ;# routing protocol
> 11 set val(x) 800
> 12 set val(y) 800
> 13
> 14 Phy/WirelessPhy set bandwidth_ 11Mb
> 15
> 16 Mac/802_11 set SlotTime_ 0.000020 ;# 20us
> 17 Mac/802_11 set SIFS_ 0.000010 ;# 10us
> 18 Mac/802_11 set PreambleLength_ 144 ;# 144 bit
> 19 Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
> 20 Mac/802_11 set PLCPDataRate_ 1.0 ;# 1Mbps
> 21 Mac/802_11 set dataRate_ 11.0 ;# 11Mbps
> 22 Mac/802_11 set basicRate_ 1.0 ;# 1Mbps
> 23
> 24 set ns [new Simulator]
> 25 set tr [open trace.tr w]
> 26 $ns trace-all $tr
> 27 set na [open trace.nam w]
> 28 $ns namtrace-all-wireless $na $val(x) $val(y)
> 29 set chan1 [new $val(chan)]
> 30 set topo [new Topography]
> 31 $topo load_flatgrid 500 500
> 32 create-god 2
> 33
> 34 proc finish {} {
> 35 global ns tr na
> 36 $ns flush-trace
> 37 $ns nam-end-wireless [$ns now]
> 38 close $tr
> 39 close $na
> 40 exec nam trace.nam &
> 41 exit 0;
> 42 }
> 43
> 44 $ns node-config -adhocRouting $val(rp)\
> 45 -llType $val(ll) \
> 46 -macType $val(mac) \
> 47 -antType $val(ant) \
> 48 -propType $val(prop) \
> 49 -phyType $val(netif) \
> 50 -channel $chan1 \
> 51 -topoInstance $topo \
> 52 -agentTrace ON \
> 53 -routerTrace ON \
> 54 -macTrace ON \
> 55 -movementTrace OFF\
> 56 -ifqType $val(ifq) \
> 57 -ifqLen $val(ifqlen)
> 58
> 59 for {set i 0} {$i < 2} {incr i} {
> 60 set node_($i) [$ns node]
> 61 $node_($i) random-motion 0
> 62 }
> 63
> 64 $node_(0) set X_ 0
> 65 $node_(0) set Y_ 0
> 66 $node_(0) set Z_ 0
> 67 $node_(1) set X_ 10
> 68 $node_(1) set Y_ 0
> 69 $node_(1) set Z_ 0
> 70
> 71 $node_(0) color green
> 72 $node_(1) color green
> 73
> 74 set udp [new Agent/UDP]
> 75 set des [new Agent/Null]
> 76 $ns attach-agent $node_(0) $udp
> 77 $ns attach-agent $node_(1) $des
> 78 $ns connect $udp $des
> 79
> 80 set udapp [new Application/Traffic/CBR]
> 81 $udapp attach-agent $udp
> 82 $udapp set fid_ 1
> 83 $udapp set packetSize_ 400
> 84
> 85 $ns at 1.0 "$udapp start"
> 86 $ns at 30.0 "$udapp stop"
> 87 $ns at 30.0 "$ns halt"
> 88 ns at 30.0 "finish
> 89 $ns run"
More information about the Ns-users
mailing list