I have tried with this example, for creationg my own topologie,

when running the tcl code, I have this problem:

class
Animator: constructor failed: class NetworkModel/Auto: constructor
failed: error when calling class NetworkModel/Auto: link 0 11 1.0 20.0
0 1.0
node 0 or 11 is not defined... 
    (_o34 cmd line 1)
    invoked from within
"_o34 cmd link 0 11 1.0 20.0 0 1.0"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o34" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$self
 link $dst $src $rate $delay $length $rev"
    (procedure "_o34" line 59)
    (NetworkModel layout_link line 59)
    invoked from within
"$self layout_link [lrange $line 1 end]"
    ("l" arm line 2)
    invoked from within
"switch $cmd {
"n" {
$self node $line
}
"g" {
$self layout_agent [lrange $line 1 end]
}
"l" {
$self layout_link [lrange $line 1 end]
}
"L" {
$self layo..."
    (procedure "_o34" line 17)
    (NetworkModel nam_layout line 17)
    invoked from within
"$self nam_layout $tracefile"
    (procedure "_o34" line 7)
    (Object next line 7)
    invoked from within
"_o34 next _o31 /home/emna/ns-allinone-2.34/ns-2.34/glad.nam"
    ("eval" body line 1)
    invoked from
 within
"eval $self next $animator $tracefile"
    (procedure "_o34" line 2)
    (NetworkModel/Auto init line 2)
    invoked from within
"_o34 init _o31 /home/emna/ns-allinone-2.34/ns-2.34/glad.nam"
    (Class create line 1)
    invoked from within
"NetworkModel/Auto create _o34 _o31 
/home/emna/ns-allinone-2.34/ns-2.34/glad.nam"
    invoked from within
"catch "$className create $o $args" msg"
    invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
    (procedure "new" line 3)
    invoked from within
"new $NETWORK_MODEL $self $tracefile"
    (procedure "_o31" line 87)
    (Animator init line
 87)
    invoked from within
"_o31 init /home/emna/ns-allinone-2.34/ns-2.34/glad.nam {}"
    (Class create line 1)
    invoked from within
"Animator create _o31 /home/emna/ns-allinone-2.34/ns-2.34/glad.nam {}"
    invoked from within
"catch "$className create $o $args" msg"
    invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
    (procedure "new" line 3)
    invoked from within
"new $ANIMATOR_CLASS_ $tracefile  [join $args]"

------
i denote that my own tcl script is:


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(n)              10
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(n)

# 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(n) } {incr i} {

        set node_($i) [$ns node]     
        $node_($i) random-motion 0        ;# disable random motion

    }



set rtp_0 [new Agent/RTP]
# communication agent-network ($ns attach-agent $node $agent)
$ns attach-agent $node_0 $rtp_0
$rtp_0 set class_ 0
$ns color 0 Red
# la création de l'application / set ... [new Application/type]
set cbr_0 [new Application/Traffic/CBR]
$cbr_0
 attach-agent $rtp_0
$ns at 0.5 "$cbr_0 start"
set null_0 [new Agent/Null]
$ns attach-agent $node_0 $null_0


# multi flows
for {set i 1} {$i < $val(n) } {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)
        set color {Blue Red Yellow Orange Green Blue Red Blue Orange}
        $rtp_($i) set class_ lindex $argv $i
    $ns connect $rtp_($i) $null_0
        $ns connect $rtp_0 $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 0.1 "$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

------please some help
thanks


      

Reply via email to