[ns] Using mac 802.11e tkn with mac 802.11
Angelo Alifano
alifangelo at gmail.com
Tue Mar 24 04:51:37 PDT 2009
Hi all,
I have installed the TKN package on ns-2.31 and it is working perfectly.
I'm asking if it possible to use both mac, 802.11e and 802.11, in the same scenario to have a pair of node in EDCA mode and a pair of node in EDCF mode.
A scenario like this will works fine ?
# ======================================================================# Define options# ======================================================================set val(chan) Channel/WirelessChannel ;# channel typeset val(prop) Propagation/TwoRayGround ;# radio-propagation modelset val(netif) Phy/WirelessPhy ;# network interface typeset val(mac) Mac/802_11 ;# MAC typeset val(ifq) Queue/DropTail/PriQueue ;# interface queue typeset val(ll) LL ;# link layer typeset val(ant) Antenna/OmniAntenna ;# antenna modelset val(ifqlen) 50 ;# max packet in ifqset val(nn) 2 ;# number of mobilenodesset val(rp) NOAH ;# routing protocol# ======================================================================# Main Program# ======================================================================## Initialize Global Variables#set ns_ [new Simulator]set tracefd [open scenario_802_11_2edca_2edcf.tr w]$ns_ trace-all $tracefd$ns_ use-newtrace# set up topography objectset topo [new Topography]$topo load_flatgrid 500 500Mac/802_11 set SlotTime_ 0.000020 ;# 20usMac/802_11 set SIFS_ 0.000010 ;# 10usMac/802_11 set PreambleLength_ 144 ;# 144 bitMac/802_11 set PLCPHeaderLength_ 48 ;# 48 bitsMac/802_11 set PLCPDataRate_ 1.0e6 ;# 1MbpsMac/802_11 set dataRate_ 11.0e6 ;# 11MbpsMac/802_11 set basicRate_ 1.0e6 ;# 1MbpsMac/802_11 set CWMin_ 31Mac/802_11 set CWMax_ 1023 Mac/802_11 set RTSThreshold_ 4096Mac/802_11 set ShortRetryLimit_ 7Mac/802_11 set LongRetryLimit_ 4Mac/802_11 set MaxSDUSize_ 2132## Create God#create-god 4## Create the specified number of mobilenodes [$val(nn)] and "attach" them# to the channel. # Here two nodes are created : node(0) and node(1)# configure node$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}## Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes#$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# Setup traffic flow between nodes# CBR connections between node_(0) and node_(1)set agent [new Agent/UDP]$agent set class_ 2$agent set fid_ 3set sink [new Agent/Null]$ns_ attach-agent $node_(0) $agent$ns_ attach-agent $node_(1) $sink$ns_ connect $agent $sinkset cbr [new Application/Traffic/CBR] $cbr set packetSize_ 160 $cbr set random_ 0 $cbr set rate_ 64000$cbr attach-agent $agent$ns_ at 20.1 "$cbr start"$ns_ at 100 "$cbr stop"set agent1 [new Agent/UDP]$agent1 set class_ 2$agent1 set fid_ 4set sink1 [new Agent/Null]$ns_ attach-agent $node_(1) $agent1$ns_ attach-agent $node_(0) $sink1$ns_ connect $agent1 $sink1set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 160 $cbr1 set random_ 0 $cbr1 set rate_ 64000$cbr1 attach-agent $agent1$ns_ at 20.0 "$cbr1 start"$ns_ at 100 "$cbr1 stop"## Tell nodes when the simulation ends#for {set i 0} {$i < $val(nn) } {incr i} { $ns_ at 100.1 "$node_($i) reset";}set val(chan) Channel/WirelessChannel ;# channel typeset val(prop) Propagation/TwoRayGround ;# radio-propagation modelset val(netif) Phy/WirelessPhy ;# network interface typeset val(mac) Mac/802_11e ;# MAC typeset val(ifq) Queue/DTail/PriQ ;# interface queue typeset val(ll) LL ;# link layer typeset val(ant) Antenna/OmniAntenna ;# antenna modelset val(ifqlen) 50 ;# max packet in ifqset val(nn) 2 ;# number of mobilenodesset val(rp) NOAH ;# routing protocolMac/802_11e set SlotTime_ 0.000020 ;# 20usMac/802_11e set SIFS_ 0.000010 ;# 10usMac/802_11e set PreambleLength_ 144 ;# 144 bitMac/802_11e set PLCPHeaderLength_ 48 ;# 48 bitsMac/802_11e set PLCPDataRate_ 1.0e6 ;# 1MbpsMac/802_11e set dataRate_ 11.0e6 ;# 11MbpsMac/802_11e set basicRate_ 1.0e6 ;# 1Mbps Mac/802_11e set RTSThreshold_ 4096Mac/802_11e set ShortRetryLimit_ 7Mac/802_11e set LongRetryLimit_ 4Mac/802_11e set MaxSDUSize_ 2132$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_a($i) [$ns_ node] $node_a($i) random-motion 0 ;# disable random motion}$node_a(0) set X_ 15.0$node_a(0) set Y_ 24.0$node_a(0) set Z_ 0.0$node_a(1) set X_ 10.0$node_a(1) set Y_ 25.0$node_a(1) set Z_ 0.0set agent2 [new Agent/UDP]$agent2 set class_ 2$agent2 set prio_ 3$agent2 set fid_ 40set sink2 [new Agent/Null]$ns_ attach-agent $node_a(0) $agent2$ns_ attach-agent $node_a(1) $sink2$ns_ connect $agent2 $sink2set cbr2 [new Application/Traffic/CBR] $cbr2 set packetSize_ 160 $cbr2 set random_ 0 $cbr2 set rate_ 64000$cbr2 attach-agent $agent2$ns_ at 20.1 "$cbr2 start"$ns_ at 100 "$cbr2 stop"set agent3 [new Agent/UDP]$agent3 set class_ 2$agent3 set prio_ 3$agent3 set fid_ 41set sink3 [new Agent/Null]$ns_ attach-agent $node_a(1) $agent3$ns_ attach-agent $node_a(0) $sink3$ns_ connect $agent3 $sink3set cbr3 [new Application/Traffic/CBR] $cbr3 set packetSize_ 160 $cbr3 set random_ 0 $cbr3 set rate_ 64000$cbr3 attach-agent $agent3$ns_ at 20.0 "$cbr3 start"$ns_ at 100 "$cbr3 stop"for {set i 0} {$i < $val(nn) } {incr i} { $ns_ at 100.1 "$node_a($i) reset";}$ns_ at 101.0 "stop"$ns_ at 101.01 "puts \"NS EXITING...\" ; $ns_ halt"proc stop {} { global ns_ tracefd $ns_ flush-trace close $tracefd}puts "Starting Simulation..."$ns_ runIn my opinion it work, but i'm new user of ns and can't say nothing about that. Someone can confirm my opinion ?Thanks in advanceAngelo Alifano
More information about the Ns-users
mailing list