求助:NS2无线仿真中TCP吞吐量过低问题
12-16
问题是这样的:在NS2里设置 $err set rate_ 0.05 的时候,这个0.05指的是每个比特的错误率还是每个包的丢包率?如果加了
$err unit packet 这句是不是意味着每发100个包,会丢5个呢?
我还在tcl文件里写了设置带宽的语句如下:
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set dataRate_ 11Mb
$mac_($i) set basicRate_ 1Mb
传输层用了一个TCP Vegas协议。 但是最后统计吞吐量的时候吞吐量大小只有2Mbps,与11Mbps差很多,这对于无线TCP是正常的吗?
谢谢!
代码如下:
----------------------------------------------------------------------------------------------------------------------------------------------
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 100 ;# X dimension of the topography
set val(y) 100
set val(err) UniformErrorProc
set loss_rate 0.05
set chan_1_ [new $val(chan)]
# *** Throughput Trace ***
set f0 [open test-single-tcp-out-tcp.tr w]
# *** Throughput Trace ***
set ns [new Simulator]
set tracefd [open test-single-tcp.tr w]
$ns trace-all $tracefd
proc UniformErrorProc {} {
global loss_rate
puts "dfdfad-----------------------------"
set err [new ErrorModel]
$err unit packet
$err set rate_ $loss_rate
return $err
}
proc finish {} {
global ns tracefd f0
# Close Trace Files
close $f0
# Plot Recorded Statistics
exec xgraph test-single-tcp-out-tcp.tr -geometry 800x400 &
$ns flush-trace
close $tracefd
exit 0
}
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
$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) \
-channel $chan_1_ \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF \
-OutgoingErrProc $val(err)
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;# disable random motion
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set dataRate_ 11Mb
$mac_($i) set basicRate_ 1Mb
}
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 50.0
$node_(1) set Y_ 20.0
$node_(1) set Z_ 0.0
$ns at 1.0 "$node_(0) setdest 5.0 2.0 1.0"
$ns at 1.0 "$node_(1) setdest 50.0 20.0 15.0"
#$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
set tcp1 [new Agent/TCP/Vegas]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp1
$ns attach-agent $node_(1) $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
# Initialize Flags
set holdtime1 0
set holdseq1 0
set holdtime2 0
set holdseq2 0
set holdrate1 0
set holdrate2 0
proc record {} {
global sink1 f0 holdtime1 holdseq1 holdtime2 holdseq2 holdrate1 holdrate2
set ns_ [Simulator instance]
set time 10.0 ;#Set Sampling Time to 0.9 Sec
set bw0 [$sink1 set bytes_]
set now [$ns_ now]
puts $f0 "$now [expr (($bw0+$holdrate1)*8)/(2*$time*1000000)]"
$sink1 set bytes_ 0
set holdrate1 $bw0
$ns_ at [expr $now+$time] "record" ;# Schedule Record after $time interval sec
}
# Start Recording at Time 0
$ns at 0.0 "record"
$ns at 1.0 "$ftp1 start"
for {set i 0} {$i < $val(nn) } {incr i} {
$ns at 1000.0 "$node_($i) reset";
}
$ns at 1000.0 "finish"
$ns run
$err unit packet 这句是不是意味着每发100个包,会丢5个呢?
我还在tcl文件里写了设置带宽的语句如下:
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set dataRate_ 11Mb
$mac_($i) set basicRate_ 1Mb
传输层用了一个TCP Vegas协议。 但是最后统计吞吐量的时候吞吐量大小只有2Mbps,与11Mbps差很多,这对于无线TCP是正常的吗?
谢谢!
代码如下:
----------------------------------------------------------------------------------------------------------------------------------------------
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 100 ;# X dimension of the topography
set val(y) 100
set val(err) UniformErrorProc
set loss_rate 0.05
set chan_1_ [new $val(chan)]
# *** Throughput Trace ***
set f0 [open test-single-tcp-out-tcp.tr w]
# *** Throughput Trace ***
set ns [new Simulator]
set tracefd [open test-single-tcp.tr w]
$ns trace-all $tracefd
proc UniformErrorProc {} {
global loss_rate
puts "dfdfad-----------------------------"
set err [new ErrorModel]
$err unit packet
$err set rate_ $loss_rate
return $err
}
proc finish {} {
global ns tracefd f0
# Close Trace Files
close $f0
# Plot Recorded Statistics
exec xgraph test-single-tcp-out-tcp.tr -geometry 800x400 &
$ns flush-trace
close $tracefd
exit 0
}
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
$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) \
-channel $chan_1_ \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF \
-OutgoingErrProc $val(err)
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns node]
$node_($i) random-motion 0 ;# disable random motion
set mac_($i) [$node_($i) getMac 0]
$mac_($i) set dataRate_ 11Mb
$mac_($i) set basicRate_ 1Mb
}
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 50.0
$node_(1) set Y_ 20.0
$node_(1) set Z_ 0.0
$ns at 1.0 "$node_(0) setdest 5.0 2.0 1.0"
$ns at 1.0 "$node_(1) setdest 50.0 20.0 15.0"
#$ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
set tcp1 [new Agent/TCP/Vegas]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp1
$ns attach-agent $node_(1) $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
# Initialize Flags
set holdtime1 0
set holdseq1 0
set holdtime2 0
set holdseq2 0
set holdrate1 0
set holdrate2 0
proc record {} {
global sink1 f0 holdtime1 holdseq1 holdtime2 holdseq2 holdrate1 holdrate2
set ns_ [Simulator instance]
set time 10.0 ;#Set Sampling Time to 0.9 Sec
set bw0 [$sink1 set bytes_]
set now [$ns_ now]
puts $f0 "$now [expr (($bw0+$holdrate1)*8)/(2*$time*1000000)]"
$sink1 set bytes_ 0
set holdrate1 $bw0
$ns_ at [expr $now+$time] "record" ;# Schedule Record after $time interval sec
}
# Start Recording at Time 0
$ns at 0.0 "record"
$ns at 1.0 "$ftp1 start"
for {set i 0} {$i < $val(nn) } {incr i} {
$ns at 1000.0 "$node_($i) reset";
}
$ns at 1000.0 "finish"
$ns run
出两兆的带宽正常
考虑三个节点的chain,你会发现至少有3个节点需要总是竞争带宽
11 / 3 差不多是4;考虑丢包,balance的问题,最后出个2兆可以接受
相关文章:
- 有人做无线局域网研究的吗?(05-08)
- 问个笔记本之间无线通信的问题(05-08)
- 无线接入网的5大功能是哪五大啊?(05-08)
- 关于 无线网络中自相似的研究(05-08)
- 求助:那位有关于无线传感器网络的opnet的仿真程序(05-08)
- 寻找做无线网络安全方向的同学讨论(05-08)
射频专业培训教程推荐