I wanted to create a connection between 8 nodes and one AP, the transmission is 
in full duplex mode, for that i used this script:


set ns [new Simulator]

# les dix noeuds: 
set node_0 [$ns node]

# création des outputs trace et nam:
set f [open glad.tr w]
$ns trace-all $f
set nf [open glad.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)             9
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
    }


  
set rtp0 [new Agent/RTP]
$ns attach-agent $node_0 $rtp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $rtp0
$ns at 0.5 "$cbr0 start"
set null0 [new Agent/Null]
$ns attach-agent $node_0 $null0

# multi flows
for {set i 1} {$i < $val(nn) } {incr i 1} {
        set node_($i) [$ns node]
    $ns duplex-link $node_($i) $node_0 1Mb 20ms DropTail
    set rtp_($i) [new Agent/RTP]
    set null_($i) [new Agent/Null]
    $ns attach-agent $node_($i) $rtp_($i)
    $ns attach-agent $node_($i) $null_($i)
        #$rtp($node_($i) set class_($node_($i))
    $ns connect $rtp_($i) $null0
        $ns connect $rtp0 $null_($i)
    set cbr_($i) [new Application/Traffic/CBR]
    $cbr_($i) attach-agent $rtp_($i)
        puts [$cbr_($i) set packetSize_ 160]
        puts [$cbr_($i) set interval_ 20ms]
        $ns at 1.0 "cbr_($i) start"
}



$ns at 10.0 "finish"

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

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

$ns run



when this runnig this script, i have this error in setting "cbr_(1)"
num_nodes is set 9
160

160

160

160

160

160

160

160

ns: cbr_(1) start: invalid command name "cbr_(1)"
    while executing
"cbr_(1) start"



please some help



      

Reply via email to