[ns] why does the code below doesn't work as expected
Sandeep
sandeep.k at redpinesignals.com
Thu Nov 2 20:40:55 PST 2006
kamil at ucsd.edu wrote:
>Hello,
>
>Did you get the answer to your reply? I'm asking because I am also experiencing the same problem with the throughput.
>Please help me if you have a solution.
>
>Also please tell me the version you are using. Mine is ns 2.28.
>
>Thanks a lot,
>Kamil
>
>Sandeep-9 wrote:
>
>
>>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"
>>
>>
>>
>>
>>
>Quoted from:
>http://www.nabble.com/why-does-the-code-below-doesn%27t-work-as-expected-tf2188094.html#a6053421
>
>
>
Hi Kamil,
My problem is solved, there was an error in through calculation,
instead of calculating recieve events at destination node, I was
calculating recieve at RTR agent in source node itself. Hence I was
calculating sending rate not throughput, there was no actual
transmission because I didn't set phy parameters in script. I sending
those parameters. As I have already simulated it, u ask me if u have any
other doubt. The parameters below are for 11g.
Antenna/OmniAntenna set Gt_ 1
Antenna/OmniAntenna set Gr_ 1
Phy/WirelessPhy set L_ 1.0
Phy/WirelessPhy set freq_ 2.472e9
Phy/WirelessPhy set Pt_ 0.031622777
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 5.011872e-12
Phy/WirelessPhy set RxThresh_ 5.82587e-09 ;#Receive power
threshold calculated under TwoRay ground model
Phy/WirelessPhy set Rb_ 2*1e6
Mac/802_11 set RTSThreshold_ 3000 ;#To suppress RTS/CTS Packets
increase the rts threshold
More information about the Ns-users
mailing list