Hi,
 
I am new to Ns and am trying to simulate the results for the paper:
 
G. Bianchi, "Performance Analysis of the IEEE 802.11 Distributed
Coordination Function,"IEEE JSAC, vol. 18, no. 3, March 2000 
 
My script is given below when I am running it with DumbAgent as the
routing protocol I don't see any activity in the trace file and the
throughput is zero but with a routing protocol I can get some throughput
and I understand why this is happening but I don't get why my script
with dumbagent is not working. I am using the parameters from Bainchi's
paper
 
I have a few questions:
 
1.      I am not sure about how to generate a scenario where all the
nodes are contending as in my case of 10 nodes only 0 2 4 6 8 are
contending and the other 1 3 5 7 9 are the sink or them so how can I
come with a scenario where all nodes are coteding as in Bianchi's paper
2.      whether cbr interval 0.005 can meet the saturation requirement
3.      I cannot see any RTS and CTS in the trace file why?
 
 
# Script to reproduce the results of Bianchi's paper
# ======================================================================
# Define options
# ======================================================================
set val(chan)           Channel/WirelessChannel    ;# channel type
set val(prop)            Propagation/FreeSpace      ;# 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)              10                          ;# default number
of mobilenodes
set val(rp)               DumbAgent                 ;# routing protocol
DumbAgent
set val(x)                       100.0                               ;
set val(y)                       100.0                               ;
set val(simtime)      30.0                            ; #sim time 600
 
# ======================================================================
# Main Program
# ======================================================================
set ns_             [new Simulator]
set tracefd     [open bianchi.tr w]
$ns_ trace-all $tracefd
 
set namtrace [open bianchi.nam w]           ;# for nam tracing
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
#$ns_ use-newtrace
 
#
# set up topography object
#
 
set topo       [new Topography]
$topo load_flatgrid $val(x) $val(y)
 
#
# Create God
#
 
set god_ [ create-god $val(nn) ]
 
# Parameters for 802.11
$val(mac) set SlotTime_ 0.000050
$val(mac) set SIFS_ 0.000028
$val(mac) set PreambleLength_ 0
$val(mac) set PLCPHeaderLength_ 128
$val(mac) set PLCPDataRate_ 1.0e6
$val(mac) set DIFS_ 0.000128
$val(mac) set dataRate_ 1.0e6
$val(mac) set basicRate_ 1.0e6
$val(mac) set CWMin_ 31
$val(mac) set CWMax_ 255
#$val(mac) set RTShreshold_ 3000
 
set chan_1_ [new $val(chan)]
 
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
 
#
#  Create the specified number of nodes 
#  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) \
                                     -channel $chan_1_ \
                                     -topoInstance $topo \
                                     -agentTrace ON \
                                     -routerTrace ON \
                                     -macTrace ON \
                                     -movementTrace OFF
 
 
            for {set i 0} {$i < $val(nn) } {incr i} {
                        set node_($i) [$ns_ node]
                        $node_($i) random-motion 0                    ;#
disable random motion
                        set x [expr 50+[$rand1 value]]
                        set y [expr 50+[$rand1 value]]
                        $node_($i) set X_ $x
                        $node_($i) set Y_ $y
                        $node_($i) set Z_ 0.0
                        $ns_ initial_node_pos $node_($i) 20
            }
 
#=================================================
#                     Agents
#=================================================
 
for {set i 0} {$i < $val(nn)} {incr i 2} {
   set udp($i) [new Agent/UDP]
   Agent/UDP set packetSize_ 2000
   $ns_ attach-agent $node_($i) $udp($i)
 
   set sink($i) [new Agent/Null]
   $ns_ attach-agent $node_([expr $i +1]) $sink($i)
   #$ns_ attach-agent $node_($i) $sink($i)
   $ns_ connect $udp($i) $sink($i)
 
   set cbr($i) [new Application/Traffic/CBR]
   $cbr($i) set packetSize_ 1024
   $cbr($i) set interval_ 0.005  
   $cbr($i) attach-agent $udp($i)
 
   $ns_ at 0.0 "$cbr($i) start"
   $ns_ at $val(simtime) "$cbr($i) stop"
}
 
$ns_ at $val(simtime).1 "stop"
$ns_ at $val(simtime).2 "puts \"NS EXITING...\" ; $ns_ halt"
 
proc stop {} {
    global ns_ tracefd
    $ns_ flush-trace
    close $tracefd
    puts "Finishing ns.."
  }
 
puts "Starting Simulation..."
$ns_ run
 
 
The awk script I am using is :
 
#------------------------------------------------------------------
 
#the awk script is simply: for throughput
#-------------------------------------------------------------------
BEGIN {num_cbr_recv=0; num_cbr_sent=0; sim_time=30; data_rate=1e6;
num_rts_sent=0; num_cts_sent=0; num_col=0}  {
 
action=$1;
hashar=$5
type=$7;
type2=$4
 
if (action == "r" && type == "cbr" && type2 == "MAC")  {
                        num_cbr_recv++;
                        };
    }
 
END{
throughput= ((num_cbr_recv*1024*8)/data_rate)/sim_time;
print("throughput=", throughput);
 
}
 
 
Thanking you in advance.
 
Riz

Reply via email to