Uplink and Downlink Unfairness Problem

 

[Description]

The IEEE 802.11 MAC protocol is designed to achieve per node fairness, so that all STAs accessing the wireless link share the bandwidth fairly. Therefore APs access the wireless link with the same authority as wireless terminals in the IEEE 802.11-based WLANs, even though APs aggregate several downlink flows. It is clear that this feature leads to serious unfairness between uplink and downlink flows. For example, we assume that an AP aggregates m downlink flows and it shares the wireless link with n uplink flows. In the saturated situation, the available bandwidth is shared equally among STAs. Therefore the throughput of an uplink flow is m times as large as the throughput of a downlink flow. (Please see reference 1 for more information)

 

[Have to be done before simulation]

1.      Install NOAH routing protocol

 

[TCL Script]

if {$argc!=2} {

        puts "Usage: ns test.tcl  uplink_flows  downlink_flows"

        exit

}

 

set par1 [lindex $argv 0]

set par2 [lindex $argv 1]

set sum_wired_wireless_nodes [expr $par1+$par2]

 

set ns [new Simulator]

set num_wired_nodes  $sum_wired_wireless_nodes

set num_mobile_nodes $sum_wired_wireless_nodes

set num_bs_nodes     1 ;# number of base stations

set num_nodes [expr $num_wired_nodes + $num_mobile_nodes + $num_bs_nodes + 1]

set bs_id $num_wired_nodes

 

# Parameter for wireless nodes

set opt(chan)           Channel/WirelessChannel    ;# channel type

set opt(prop)           Propagation/TwoRayGround   ;# radio-propagation model

set opt(netif)          Phy/WirelessPhy            ;# network interface type

set opt(mac)            Mac/802_11                 ;# MAC type

set opt(ifq)            Queue/DropTail/PriQueue

set opt(ifqlen)         50

set opt(ll)             LL                         ;# link layer type

set opt(ant)            Antenna/OmniAntenna        ;# antenna model

set opt(adhocRouting)   NOAH                       ;# routing protocol

set opt(x)              500          ;# X dimension of the topography

set opt(y)              500          ;# Y dimension of the topography

 

Mac/802_11 set SlotTime_          0.000020        ;# 20us

Mac/802_11 set SIFS_              0.000010        ;# 10us

Mac/802_11 set PreambleLength_    144             ;# 144 bit

Mac/802_11 set PLCPHeaderLength_  48              ;# 48 bits

Mac/802_11 set PLCPDataRate_      1.0e6           ;# 1Mbps

Mac/802_11 set dataRate_          2.0e6           ;# 2Mbps

Mac/802_11 set basicRate_         1.0e6           ;# 1Mbps

#disable RTS/CTS

Mac/802_11 set RTSThreshold_       3000

Mac/802_11 set ShortRetryLimit_       7               ;# retransmittions

Mac/802_11 set LongRetryLimit_        4               ;# retransmissions

 

#set up for hierarchical routing

#(needed for routing over a basestation)

$ns node-config -addressType hierarchical

AddrParams set domain_num_ 2          ;# domain number

lappend cluster_num 2 1               ;# cluster number for each domain

AddrParams set cluster_num_ $cluster_num

lappend eilastlevel $num_wired_nodes 1 [expr $num_mobile_nodes + $num_bs_nodes] ;# number of nodes for each cluster            

AddrParams set nodes_num_ $eilastlevel

 

set ntr [open out.tr w]

$ns trace-all $ntr

 

set chan    [new $opt(chan)]

set topo    [new Topography]

$topo load_flatgrid $opt(x) $opt(y)

 

# Create God

create-god [expr $num_mobile_nodes + $num_bs_nodes]

 

# creating wired nodes

for {set i 0} {$i < $sum_wired_wireless_nodes} {incr i} {

  set wired_node_($i) [$ns node 0.1.0]

  puts "wired node $i created ..."

}

 

#connect the wired nodes to ss

set ss [$ns node 0.0.[expr $sum_wired_wireless_nodes + 1]]

for {set i 0} {$i < $sum_wired_wireless_nodes} {incr i} {

  $ns duplex-link $wired_node_($i) $ss 100Mb 1ms DropTail

}

 

# creating base station

$ns node-config -adhocRouting $opt(adhocRouting) \

                 -llType $opt(ll) \

                 -macType $opt(mac) \

                 -ifqType $opt(ifq) \

                 -ifqLen $opt(ifqlen) \

                 -antType $opt(ant) \

                 -propType $opt(prop)    \

                 -phyType $opt(netif) \

                 -channel $chan      \

                 -topoInstance $topo \

                 -wiredRouting ON \

                 -agentTrace OFF \

                 -routerTrace OFF \

                 -macTrace OFF    \

                 -movementTrace OFF

 

set BS(0) [$ns node 1.0.0]

$BS(0) random-motion 0

puts "Base-Station node $bs_id created"

#provide some co-ord (fixed) to base station node

$BS(0) set X_ 250.0

$BS(0) set Y_ 250.0

$BS(0) set Z_ 0.0

 

set  rng  [new RNG]

$rng seed 1

set  rand1  [new RandomVariable/Uniform]

$rand1  use-rng $rng

$rand1  set  min_ -50.0

$rand1  set  max_ 50.0

 

# creating mobile nodes

$ns node-config -wiredRouting OFF

for {set i 0} {$i < $sum_wired_wireless_nodes} {incr i} {

    set wl_node_($i) [$ns node 1.0.[expr $i + 1]]  

    $wl_node_($i) random-motion 0               ;# disable random motion

    puts "wireless node $i created ..."

    $wl_node_($i) base-station [AddrParams addr2id [$BS(0) node-addr]]

    set x [expr 250+[$rand1 value]]

    set y [expr 250+[$rand1 value]]

    $wl_node_($i) set X_ $x

    $wl_node_($i) set Y_ $y

    $wl_node_($i) set Z_ 0.0

    puts "X_:$x Y_:$y"

}

 

# linking of wired node to base-station node

$ns duplex-link $ss $BS(0) 100Mb 1ms DropTail

 

#create the uplink flows

for {set i 0} {$i < $par1} {incr i} {

  set udp_($i) [new Agent/UDP]

  $ns attach-agent $wl_node_($i) $udp_($i)

  set null_($i) [new Agent/LossMonitor]

  $ns attach-agent $wired_node_($i) $null_($i)

  $ns connect $udp_($i) $null_($i)

  $udp_($i) set packetSize_ 2000

 

  set cbr_($i) [new Application/Traffic/CBR]

  $cbr_($i) attach-agent $udp_($i)

  $cbr_($i) set packetSize_ 1000

  $cbr_($i) set rate_ 1.0Mb

  $cbr_($i) set random_ null

  $ns at 10.0  "$cbr_($i) start"

  $ns at 40.0  "$cbr_($i) stop"

}

 

#create the downlink flows

for {set i $par1} {$i < $sum_wired_wireless_nodes} {incr i} {

  set udp_($i) [new Agent/UDP]

  $ns attach-agent $wired_node_($i) $udp_($i)

  set null_($i) [new Agent/LossMonitor]

  $ns attach-agent $wl_node_($i) $null_($i)

  $ns connect $udp_($i) $null_($i)

  $udp_($i) set packetSize_ 2000

 

  set cbr_($i) [new Application/Traffic/CBR]

  $cbr_($i) attach-agent $udp_($i)

  $cbr_($i) set packetSize_ 1000

  $cbr_($i) set rate_ 1.0Mb

  $cbr_($i) set random_ null

  $ns at 10.0  "$cbr_($i) start"

  $ns at 40.0  "$cbr_($i) stop"

}

 

proc stop {} {

    global ns ntr par1 sum_wired_wireless_nodes null_

    $ns flush-trace

    close $ntr

    set sum1 0

    set sum2 0

    for {set i 0} {$i < $par1} {incr i} {

      set getbytes [$null_($i) set bytes_]

      set sum1 [expr $sum1 + $getbytes]

    }

    set up [expr $sum1*8/30]

    puts "The uplink throughput is $up bps"

 

    for {set i $par1} {$i < $sum_wired_wireless_nodes} {incr i} {

      set getbytes [$null_($i) set bytes_]

      set sum2 [expr $sum2 + $getbytes]

    }

    set down [expr $sum2*8/30]

    puts "The downlink throughput is $down bps"

}

 

$ns at 50.1 "stop"

$ns at 50.2  "puts \"NS EXITING...\" ; $ns halt"

 

$ns run

 

[Result]

When the network is light-loaded,

snap.jpg

The throughput for uplink and downlink is almost the same.

 

When the network is heavy-loaded,

2.jpg

The uplink flows get more bandwidth than the downlink flows.

 

[Reference]

1.       Dynamic Contention Window Control to Achieve Fairness between Uplink and Downlink Flows in IEEE 802.11 WLANs

 

[Contact information]

Chih-Heng Ke

smallko@gmail.com

http://csie.nqu.edu.tw/smallko

 

Last modified date:2009/07/09