TOP
|
Test File for TKN 802.11e Model |
[ 录入者:admin | 时间:2007-10-28 00:31:54
| 作者: | 来源:
| 浏览:449次 ] |
The script given in the model is so complexed. So I wrote a simple tcl file to verify the functionality of it.
## Test file for TKN model writen by Weiwei
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_11e ;# MAC type
set val(ifq) Queue/DTail/PriQ ;# 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) DSDV ;# routing protocol
set ns_ [new Simulator]
set tracefd [open simple.tr w]
$ns_ trace-all $tracefd
set topo [new Topography]
$topo load_flatgrid 500 500
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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 0.0
$node_(1) set Y_ 35.0
$node_(1) set Z_ 0.0
set tcp [new Agent/TCP]
$tcp set class_ 2 $tcp set prio_ 3
set sink [new Agent/TCPSink]
$ns_ attach-agent $node_(0) $tcp
$ns_ attach-agent $node_(1) $sink
$ns_ connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns_ at 10.0 "$ftp start" $ns_ at 14.5 "$ftp stop"
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 15.0 "$node_($i) reset";
}
$ns_ at 15.0 "stop"
$ns_ at 15.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run
|
|
|
|