I use this tcl script file, for creating a transmission between 10 nodes and 
the AP. I want that the transmission be in the full duplex 

-----tcl--------

set ns [new Simulator]
# choix des couleurs:
$ns color 0 blue
$ns color 1 red
$ns color 2 green
$ns color 3 red
$ns color 4 orange
$ns color 5 blue
$ns color 6 green
$ns color 7 black
$ns color 8 orange
$ns color 9 blue


# les dix noeuds: 
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]
set n9 [$ns node]
set n10 [$ns node]


# création des outputs trace et nam:
set f [open emna1.tr w]
$ns trace-all $f
set nf [open emna1.nam w]
$ns namtrace-all $nf
# ======================================================================
# Define options
# ======================================================================
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(rp)             DumbAgent                      ;# routing protocol
set val(start)          0.0
set val(ifqlen)         50                         ;# max packet in ifq
set val(nn)             11
set val(tr)             "trace"
set val(X)              500
set val(Y)              500
set val(CWmin)          16
set val(CWmax)          1024
set val(SlotTime)       0.000009
set val(SIFS)           0.000016
set val(basicRate)      2Mb
set val(dataRate)       54Mb
set val(PreambleLength)   104 
set val(PLCPHeaderLength)   48
#------------------------------------------------------------------------
# Codec:  G.711
#------------------------------------------------------------------------
#set val(ON)             1500ms
#set val(OFF)            1500ms
#set val(AppRate)        96Kb
#set val(pktsize)         160 #160 octets
#set val(pktinterval)     0.020
#set pktsize $val(pktsize)         #160 octets
#set pktinterval $val(pktinterval)   
#set val(run)             50.0
#------------------------------------------------------------------------
# MAC MIB
#------------------------------------------------------------------------
Mac/802_11         set basicRate         $val(basicRate)Mb
Mac/802_11         set dataRate          $val(dataRate)Mb
Mac/802_11         set CWMin             $val(CWmin)
Mac/802_11         set CWMax             $val(CWmax)
Mac/802_11         set SlotTime          $val(SlotTime)
Mac/802_11         set SIFS              $val(SIFS)
Mac/802_11              set PreambleLength    $val(PreambleLength);# no preamble
Mac/802_11              set PLCPHeaderLength  
$val(PLCPHeaderLength)             ;# 128 bits
Mac/802_11              set PLCPDataRate      1.0e6           ;# 1Mbps

# set up topography object
set topo       [new Topography]
#$topo load_flatgrid $val(X) $val(Y)

# Create God
create-god $val(nn)

# 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 OFF \
             -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
    }
# connection des noeuds entre eux: 
# $ns simple-link (duplex-link) $n0 $n1 <bandwidth> <delay> <queue_type>
$ns duplex-link $n0 $n1 1Mb 20ms DropTail
$ns duplex-link $n0 $n2 1Mb 20ms DropTail
$ns duplex-link $n0 $n3 1Mb 20ms DropTail
$ns duplex-link $n0 $n4 1Mb 20ms DropTail
$ns duplex-link $n0 $n5 1Mb 20ms DropTail
$ns duplex-link $n0 $n6 1Mb 20ms DropTail
$ns duplex-link $n0 $n7 1Mb 20ms DropTail
$ns duplex-link $n0 $n8 1Mb 20ms DropTail
$ns duplex-link $n0 $n9 1Mb 20ms DropTail
$ns duplex-link $n0 $n10 1Mb 20ms DropTail
# la création de l'"agent" / set ... [new Agent/type]
set rtp0 [new Agent/RTP]
# communication agent-network ($ns attach-agent $node $agent)
$ns attach-agent $n0 $rtp0
# la création de l'application / set ... [new Application/type]
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $rtp0
set null0 [new Agent/Null]
$ns attach-agent $n0 $null0
# c'est la relation (sending-receiving) ($ns connect $s_agent $r_agent)
$ns connect $rtp0 $null0

set rtp1 [new Agent/RTP]
$ns attach-agent $n1 $rtp1
$rtp1 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $rtp1
set null1 [new Agent/Null]
$ns attach-agent $n1 $null1
$ns connect $rtp0 $null1
$ns connect $rtp1 $null0

set rtp2 [new Agent/RTP]
$ns attach-agent $n2 $rtp2
$rtp1 set class_ 2
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $rtp2
set null2 [new Agent/Null]
$ns attach-agent $n2 $null2
$ns connect $rtp0 $null2
$ns connect $rtp2 $null0

set rtp3 [new Agent/RTP]
$ns attach-agent $n3 $rtp3
$rtp3 set class_ 3
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $rtp3
set null3 [new Agent/Null]
$ns attach-agent $n3 $null3
$ns connect $rtp0 $null3
$ns connect $rtp3 $null0


set rtp4 [new Agent/RTP]
$ns attach-agent $n4 $rtp4
$rtp4 set class_ 4
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $rtp4
set null4 [new Agent/Null]
$ns attach-agent $n4 $null4
$ns connect $rtp0 $null4
$ns connect $rtp4 $null0

set rtp5 [new Agent/RTP]
$ns attach-agent $n5 $rtp5
$rtp4 set class_ 5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $rtp5
set null5 [new Agent/Null]
$ns attach-agent $n5 $null5
$ns connect $rtp0 $null5
$ns connect $rtp5 $null0

set rtp6 [new Agent/RTP]
$ns attach-agent $n6 $rtp6
$rtp6 set class_ 6
set cbr6 [new Application/Traffic/CBR]
$cbr6 attach-agent $rtp6
set null6 [new Agent/Null]
$ns attach-agent $n6 $null6
$ns connect $rtp0 $null6
$ns connect $rtp6 $null0

set rtp7 [new Agent/RTP]
$ns attach-agent $n7 $rtp7
$rtp6 set class_ 7
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $rtp7
set null7 [new Agent/Null]
$ns attach-agent $n7 $null7
$ns connect $rtp0 $null7
$ns connect $rtp7 $null0

set rtp8 [new Agent/RTP]
$ns attach-agent $n8 $rtp8
$rtp6 set class_ 8
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $rtp8
set null8 [new Agent/Null]
$ns attach-agent $n8 $null8
$ns connect $rtp0 $null8
$ns connect $rtp8 $null0

set rtp9 [new Agent/RTP]
$ns attach-agent $n9 $rtp9
$rtp9 set class_ 9
set cbr9 [new Application/Traffic/CBR]
$cbr9 attach-agent $rtp9
set null9 [new Agent/Null]
$ns attach-agent $n9 $null9
$ns connect $rtp0 $null9
$ns connect $rtp9 $null0

set rtp10 [new Agent/RTP]
$ns attach-agent $n10 $rtp10
$rtp10 set class_ 10
set cbr10 [new Application/Traffic/CBR]
$cbr10 attach-agent $rtp10
set null10 [new Agent/Null]
$ns attach-agent $n10 $null10
$ns connect $rtp0 $null10
$ns connect $rtp10 $null0

# c'est la relation (sending-receiving) ($ns connect $s_agent $r_agent)

$ns at 0.1 "$cbr0 start"
$ns at 0.1 "$cbr1 start"
$ns at 0.1 "$cbr2 start"
$ns at 0.1 "$cbr3 start"
$ns at 0.1 "$cbr4 start"
$ns at 0.1 "$cbr5 start"
$ns at 0.1 "$cbr6 start"
$ns at 0.1 "$cbr7 start"
$ns at 0.1 "$cbr8 start"
$ns at 0.1 "$cbr9 start"
$ns at 0.1 "$cbr10 start"
# pour notre cas sans tcp :) 
# set tcp [new Agent/TCP]
# $tcp set class_ 2
# set sink [new Agent/TCPSink]
# $ns attach-agent $n0 $tcp
# $ns attach-agent $n3 $sink
# $ns connect $tcp $sink
# set ftp [new Application/FTP]
# $ftp attach-agent $tcp
# $ns at 1.2 "$ftp start"


puts [$cbr0 set packetSize_ 160]
puts [$cbr0 set interval_ 20ms]

puts [$cbr1 set packetSize_ 160]
puts [$cbr1 set interval_ 20ms]

puts [$cbr2 set packetSize_ 160]
puts [$cbr2 set interval_ 20ms]

puts [$cbr3 set packetSize_ 160]
puts [$cbr3 set interval_ 20ms]

puts [$cbr4 set packetSize_ 160]
puts [$cbr4 set interval_ 20ms]

puts [$cbr5 set packetSize_ 160]
puts [$cbr5 set interval_ 20ms]

puts [$cbr6 set packetSize_ 160]
puts [$cbr6 set interval_ 20ms]

puts [$cbr7 set packetSize_ 160]
puts [$cbr7 set interval_ 20ms]

puts [$cbr8 set packetSize_ 160]
puts [$cbr8 set interval_ 20ms]

puts [$cbr9 set packetSize_ 160]
puts [$cbr9 set interval_ 20ms]

puts [$cbr10 set packetSize_ 160]
puts [$cbr10 set interval_ 20ms]

$ns at 10.0 "finish"

proc finish {} {
    global ns f nf
    $ns flush-trace
    close $f
    close $nf

    puts "running nam..."
    exec nam emna1.nam &
    exit 0
}

$ns run
---------end tcl-----------

But the problem that the transmission isn't in full duplex mode,
the nam trace and the trace file show this :((((
what's wrong???




      

Reply via email to