ns2 DSR.tcl 代码没有 运行 给出一些错误

ns2 DSR.tcl code is not running giving some error

when i want to implemented file .tcl in ns2 appear an error, i couldn't solve this . i use ns2 version 2.34 in ubuntu 15.
Please if anyone can help me to solve the error and run the .tcl code.
my code is


[code]
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(ifq)            CMUPriQueue    ;    #This is the change for DSR       
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                          ;# number of mobilenodes 
set val(rp)             DSR                     ;# routing protocol 
set val(x)              500                ;# X dimension of topography 
set val(y)              500                ;# Y dimension of topography   
set val(stop)       200            ;# time of simulation end 

#this is the change for DSR
if { $val(rp) == "DSR" } {
set val(ifq) CMUPriQueue
} else {
set val(ifq) Queue/DropTail/PriQueue
}
#================================================================================
Queue set limit_  50


LL set mindelay_        50us
LL set delay_           25us
LL set bandwidth_       0   ;# not used
LL set off_prune_       0   ;# not used
LL set off_CtrMcast_        0   ;# not used

Agent/Null set sport_       0
Agent/Null set dport_       0

Agent/CBR set sport_        0
Agent/CBR set dport_        0

Agent/TCPSink set sport_    0
Agent/TCPSink set dport_    0

Agent/TCP set sport_        0
Agent/TCP set dport_        0
Agent/TCP set packetSize_   512

Queue/DropTail/PriQueue set Prefer_Routing_Protocols    1

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6 
Phy/WirelessPhy set L_ 1.0
#==================================================================================

set ns [new Simulator] 
$ns use-newtrace
set tracefd [open dsr.tr w] 


$ns trace-all $tracefd 
#$ns namtrace-all-wireless $namtrace $val(x) $val(y) 

 set nf [open out6.nam w]
$ns namtrace-all-wireless $nf $val(x) $val(y) 

#$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out6.nam 
exit 0
}

# set up topography object 
set topo [new Topography] 

$topo load_flatgrid $val(x) $val(y) 

set god_ [create-god $val(nn)] 



$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 ON \
             -macTrace OFF \
             -movementTrace ON


    for {set i 0} {$i < $val(nn) } { incr i } { 
        set node_($i) [$ns node]     
    } 

# Provide initial location of mobilenodes 
#
# nodes: 10, pause: 2.00, max speed: 10.00, max x: 500.00, max y: 500.00
#
$node_(0) set X_ 230.458099147138
$node_(0) set Y_ 199.978104581927
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 249.761442525866
$node_(1) set Y_ 329.181336325062
$node_(1) set Z_ 0.000000000000
$node_(2) set X_ 354.684092284714
$node_(2) set Y_ 314.083348454287
$node_(2) set Z_ 0.000000000000
$node_(3) set X_ 31.274134527198
$node_(3) set Y_ 416.891035673519
$node_(3) set Z_ 0.000000000000
$node_(4) set X_ 201.659846921742
$node_(4) set Y_ 335.060794067719
$node_(4) set Z_ 0.000000000000
$node_(5) set X_ 441.872011266970
$node_(5) set Y_ 153.838035184497
$node_(5) set Z_ 0.000000000000
$node_(6) set X_ 125.845499610497
$node_(6) set Y_ 9.518591216734
$node_(6) set Z_ 0.000000000000
$node_(7) set X_ 455.849914885308
$node_(7) set Y_ 425.143852580786
$node_(7) set Z_ 0.000000000000
$node_(8) set X_ 107.906715349433
$node_(8) set Y_ 366.497006554012
$node_(8) set Z_ 0.000000000000
$node_(9) set X_ 372.772820651705
$node_(9) set Y_ 291.999735807987
$node_(9) set Z_ 0.000000000000
$god_ set-dist 0 1 1
$god_ set-dist 0 2 1
$god_ set-dist 0 3 2
$god_ set-dist 0 4 1
$god_ set-dist 0 5 1
$god_ set-dist 0 6 1
$god_ set-dist 0 7 2
$god_ set-dist 0 8 1
$god_ set-dist 0 9 1
$god_ set-dist 1 2 1
$god_ set-dist 1 3 1
$god_ set-dist 1 4 1
$god_ set-dist 1 5 2
$god_ set-dist 1 6 2
$god_ set-dist 1 7 1
$god_ set-dist 1 8 1
$god_ set-dist 1 9 1
$god_ set-dist 2 3 2
$god_ set-dist 2 4 1
$god_ set-dist 2 5 1
$god_ set-dist 2 6 2
$god_ set-dist 2 7 1
$god_ set-dist 2 8 2
$god_ set-dist 2 9 1
$god_ set-dist 3 4 1
$god_ set-dist 3 5 3
$god_ set-dist 3 6 3
$god_ set-dist 3 7 2
$god_ set-dist 3 8 1
$god_ set-dist 3 9 2
$god_ set-dist 4 5 2
$god_ set-dist 4 6 2
$god_ set-dist 4 7 2
$god_ set-dist 4 8 1
$god_ set-dist 4 9 1
$god_ set-dist 5 6 2
$god_ set-dist 5 7 2
$god_ set-dist 5 8 2
$god_ set-dist 5 9 1
$god_ set-dist 6 7 3
$god_ set-dist 6 8 2
$god_ set-dist 6 9 2
$god_ set-dist 7 8 2
$god_ set-dist 7 9 1
$god_ set-dist 8 9 2
$ns_ at 2.000000000000 "$node_(0) setdest 113.561924924348 380.474029490398 5.012234894686"
$ns_ at 2.000000000000 "$node_(1) setdest 226.942668600025 416.193239523143 8.239808486281"
$ns_ at 2.000000000000 "$node_(2) setdest 45.863534915171 398.899570100734 8.246285918920"
$ns_ at 2.000000000000 "$node_(3) setdest 296.143683976933 438.900817835557 8.967255229407"
$ns_ at 2.000000000000 "$node_(4) setdest 66.994012551092 278.791597459617 0.761636918974"
$ns_ at 2.000000000000 "$node_(5) setdest 430.400494724350 75.410724078638 9.732857268405"
$ns_ at 2.000000000000 "$node_(6) setdest 347.964190965647 316.394400971484 4.362064233820"
$ns_ at 2.000000000000 "$node_(7) setdest 245.368757177308 425.216835910711 3.176385346029"
$ns_ at 2.000000000000 "$node_(8) setdest 259.416390899245 263.317134759846 1.440425191449"
$ns_ at 2.000000000000 "$node_(9) setdest 77.252354488822 49.861937382092 1.346166296863"
$ns_ at 2.238600454126 "$god_ set-dist 2 8 1"
$ns_ at 6.407773518113 "$god_ set-dist 0 3 1"
$ns_ at 6.407773518113 "$god_ set-dist 3 5 2"
$ns_ at 6.407773518113 "$god_ set-dist 3 6 2"
$ns_ at 7.003427216796 "$god_ set-dist 2 5 2"
$ns_ at 7.435975009945 "$god_ set-dist 0 5 2"
$ns_ at 7.435975009945 "$god_ set-dist 3 5 3"
$ns_ at 7.435975009945 "$god_ set-dist 5 6 3"
$ns_ at 7.435975009945 "$god_ set-dist 5 8 3"
$ns_ at 7.455869251739 "$god_ set-dist 2 3 1"
$ns_ at 10.143737743753 "$node_(5) setdest 430.400494724350 75.410724078638 0.000000000000"
$ns_ at 10.899610693580 "$god_ set-dist 4 7 1"
$ns_ at 12.143737743753 "$node_(5) setdest 365.267898416082 162.012025760138 3.758699484591"
$ns_ at 12.917032083302 "$node_(1) setdest 226.942668600025 416.193239523143 0.000000000000"
$ns_ at 13.820198054819 "$god_ set-dist 5 8 2"
$ns_ at 13.820198054819 "$god_ set-dist 8 9 1"
$ns_ at 14.917032083302 "$node_(1) setdest 154.140740647277 174.968923766524 8.677142366032"
$ns_ at 15.973245097143 "$god_ set-dist 3 5 2"
$ns_ at 15.973245097143 "$god_ set-dist 3 9 1"
$ns_ at 16.413435143119 "$god_ set-dist 3 7 1"
$ns_ at 18.381350487206 "$god_ set-dist 5 6 1"
$ns_ at 21.804264291933 "$god_ set-dist 4 6 1"
$ns_ at 21.804264291933 "$god_ set-dist 6 7 2"
$ns_ at 24.079807344719 "$god_ set-dist 6 9 1"
$ns_ at 24.363326273085 "$god_ set-dist 1 6 1"
$ns_ at 25.172852210015 "$god_ set-dist 0 7 1"
$ns_ at 27.381095890208 "$god_ set-dist 7 8 1"
$ns_ at 27.953683799626 "$god_ set-dist 6 8 1"
$ns_ at 31.193283148042 "$god_ set-dist 1 5 1"
$ns_ at 31.639219521928 "$node_(3) setdest 296.143683976933 438.900817835557 0.000000000000"
$ns_ at 31.703855308475 "$god_ set-dist 2 9 2"
$ns_ at 32.315825316726 "$god_ set-dist 2 7 2"
$ns_ at 33.639219521928 "$node_(3) setdest 488.496969013328 245.729238635786 5.692964169229"
$ns_ at 35.426922185176 "$god_ set-dist 1 7 2"
$ns_ at 38.276329613589 "$god_ set-dist 2 3 2"
$ns_ at 38.784437342397 "$god_ set-dist 1 3 2"
$ns_ at 40.836397184144 "$node_(2) setdest 45.863534915171 398.899570100734 0.000000000000"
$ns_ at 40.973043461046 "$node_(5) setdest 365.267898416082 162.012025760138 0.000000000000"
$ns_ at 41.073600214663 "$god_ set-dist 3 5 1"
$ns_ at 42.836397184144 "$node_(2) setdest 240.698943162658 94.742856735018 9.960592922709"
$ns_ at 42.973043461046 "$node_(5) setdest 191.825072257690 417.829360209523 1.964677858318"
$ns_ at 43.551282473529 "$god_ set-dist 4 5 1"
$ns_ at 43.955487787410 "$node_(1) setdest 154.140740647277 174.968923766524 0.000000000000"
$ns_ at 44.584299641389 "$god_ set-dist 0 6 2"
$ns_ at 44.903616965502 "$node_(0) setdest 113.561924924348 380.474029490398 0.000000000000"
$ns_ at 45.453041721346 "$god_ set-dist 0 6 1"
$ns_ at 45.751740111792 "$god_ set-dist 3 6 1"
$ns_ at 45.955487787410 "$node_(1) setdest 20.418763218239 434.846110746262 8.651826840262"
$ns_ at 46.903616965502 "$node_(0) setdest 276.104678150679 270.942272817714 5.977054404381"
$ns_ at 47.359162927842 "$god_ set-dist 2 7 1"
$ns_ at 48.008451365368 "$god_ set-dist 2 6 1"
$ns_ at 48.968456467505 "$god_ set-dist 5 8 1"
$ns_ at 50.446950143240 "$god_ set-dist 6 7 1"
$ns_ at 50.474551767468 "$god_ set-dist 2 9 1"
$ns_ at 54.509369876780 "$god_ set-dist 1 7 1"
$ns_ at 56.586128792946 "$god_ set-dist 0 5 1"
$ns_ at 56.692178592167 "$god_ set-dist 2 5 1"
$ns_ at 56.803541764673 "$god_ set-dist 1 5 2"
$ns_ at 56.994062712831 "$god_ set-dist 5 7 1"
$ns_ at 61.853959710748 "$god_ set-dist 3 4 2"
$ns_ at 66.190770307152 "$god_ set-dist 1 9 2"
$ns_ at 68.065809892613 "$god_ set-dist 1 6 2"
$ns_ at 68.264368907395 "$node_(7) setdest 245.368757177308 425.216835910711 0.000000000000"
$ns_ at 68.602475930167 "$god_ set-dist 2 7 2"
$ns_ at 68.662775662111 "$god_ set-dist 3 8 2"
$ns_ at 70.264368907395 "$node_(7) setdest 200.410813718440 11.636943188609 6.923182273754"
$ns_ at 71.030042351737 "$god_ set-dist 1 2 2"
$ns_ at 74.541172195941 "$god_ set-dist 3 7 2"
$ns_ at 75.678908552504 "$god_ set-dist 0 1 2"
$ns_ at 75.678908552504 "$god_ set-dist 1 3 3"
$ns_ at 79.100230162000 "$node_(2) setdest 240.698943162658 94.742856735018 0.000000000000"
$ns_ at 79.696266416500 "$node_(0) setdest 276.104678150679 270.942272817714 0.000000000000"
$ns_ at 79.735995105771 "$node_(1) setdest 20.418763218239 434.846110746262 0.000000000000"
$ns_ at 81.100230162000 "$node_(2) setdest 384.921049364744 52.810063349198 5.283278585161"
$ns_ at 81.524267062779 "$node_(3) setdest 488.496969013328 245.729238635786 0.000000000000"
$ns_ at 81.696266416500 "$node_(0) setdest 258.497594335931 227.391816861345 9.456737166504"
$ns_ at 81.735995105771 "$node_(1) setdest 371.382772514507 20.446494862640 8.880333657635"
$ns_ at 82.227291269643 "$god_ set-dist 2 7 1"
$ns_ at 83.524267062779 "$node_(3) setdest 106.746579800567 7.390865017031 9.072763695646"
$ns_ at 84.799691924606 "$god_ set-dist 2 4 2"
$ns_ at 86.007347749395 "$god_ set-dist 1 3 2"
$ns_ at 86.007347749395 "$god_ set-dist 3 7 1"
$ns_ at 86.077668463964 "$god_ set-dist 2 3 1"
$ns_ at 86.663625634036 "$node_(0) setdest 258.497594335931 227.391816861345 0.000000000000"
$ns_ at 88.589683708940 "$god_ set-dist 3 8 1"
$ns_ at 88.663625634036 "$node_(0) setdest 228.164706485872 325.408836287688 7.524668370637"
$ns_ at 88.845682456311 "$node_(6) setdest 347.964190965647 316.394400971484 0.000000000000"
$ns_ at 89.007036426795 "$god_ set-dist 0 1 1"
$ns_ at 90.845682456311 "$node_(6) setdest 349.301343354089 158.466272861926 6.059078937464"
$ns_ at 91.981342722274 "$god_ set-dist 1 9 1"
$ns_ at 93.282189453789 "$god_ set-dist 1 5 1"
$ns_ at 96.279396756836 "$god_ set-dist 1 6 1"
$ns_ at 98.783925047944 "$god_ set-dist 0 2 2"
$ns_ at 101.251929662959 "$god_ set-dist 2 8 2"
$ns_ at 102.193088967194 "$god_ set-dist 1 3 1"
$ns_ at 102.299205590466 "$node_(0) setdest 228.164706485872 325.408836287688 0.000000000000"
$ns_ at 104.299205590466 "$node_(0) setdest 53.352551906679 183.071466763240 7.639719429207"
$ns_ at 106.245005462422 "$god_ set-dist 3 4 1"
$ns_ at 109.528497785644 "$node_(2) setdest 384.921049364744 52.810063349198 0.000000000000"
$ns_ at 111.324553936857 "$god_ set-dist 4 6 2"
$ns_ at 111.528497785644 "$node_(2) setdest 226.544921896733 403.524189007709 1.040146757465"
$ns_ at 113.001012877590 "$god_ set-dist 1 2 1"
$ns_ at 116.911325496558 "$node_(6) setdest 349.301343354089 158.466272861926 0.000000000000"
$ns_ at 118.911325496558 "$node_(6) setdest 416.505866132961 426.982145363532 5.732529627244"
$ns_ at 119.365114344371 "$god_ set-dist 2 8 1"
$ns_ at 121.781999508119 "$god_ set-dist 3 4 2"
$ns_ at 122.331871539839 "$god_ set-dist 2 5 2"
$ns_ at 122.427605729452 "$god_ set-dist 4 7 2"
$ns_ at 122.580929732787 "$god_ set-dist 3 5 2"
$ns_ at 124.163472273148 "$god_ set-dist 5 7 2"
$ns_ at 124.223348806923 "$god_ set-dist 0 6 2"
$ns_ at 125.861178527021 "$god_ set-dist 3 6 2"
$ns_ at 126.945433605630 "$god_ set-dist 3 8 2"
$ns_ at 128.307932367730 "$god_ set-dist 1 4 2"
$ns_ at 128.780529893172 "$god_ set-dist 6 7 2"
$ns_ at 129.105331893930 "$god_ set-dist 7 8 2"
$ns_ at 129.258594800506 "$node_(8) setdest 259.416390899245 263.317134759846 0.000000000000"
$ns_ at 129.901499377481 "$god_ set-dist 2 3 2"
$ns_ at 130.354694785179 "$node_(7) setdest 200.410813718440 11.636943188609 0.000000000000"
$ns_ at 130.825441879314 "$god_ set-dist 0 1 2"
$ns_ at 131.258594800506 "$node_(8) setdest 258.191758930657 232.405501264228 8.769708891422"
$ns_ at 132.246883069141 "$god_ set-dist 7 8 1"
$ns_ at 132.354694785179 "$node_(7) setdest 12.398316659697 493.011444585021 4.810270173600"
$ns_ at 133.127985983024 "$node_(3) setdest 106.746579800567 7.390865017031 0.000000000000"
$ns_ at 133.806987963031 "$node_(0) setdest 53.352551906680 183.071466763240 0.000000000000"
$ns_ at 134.786178509905 "$node_(8) setdest 258.191758930657 232.405501264228 0.000000000000"
$ns_ at 135.127985983024 "$node_(3) setdest 331.086138348541 217.131377468660 7.784960858820"
$ns_ at 135.425991083044 "$god_ set-dist 1 5 2"
$ns_ at 135.806987963031 "$node_(0) setdest 490.958411623572 362.808600409000 4.256760735392"
$ns_ at 136.786178509905 "$node_(8) setdest 215.614653855527 193.185174880204 4.459505055001"
$ns_ at 137.516017444030 "$god_ set-dist 3 8 1"
$ns_ at 138.946838571606 "$god_ set-dist 2 3 1"
$ns_ at 141.098092877777 "$god_ set-dist 1 6 2"
$ns_ at 142.454273210092 "$god_ set-dist 4 7 1"
$ns_ at 142.827796380296 "$god_ set-dist 3 4 1"
$ns_ at 142.887922220640 "$node_(1) setdest 371.382772514507 20.446494862640 0.000000000000"
$ns_ at 144.887922220640 "$node_(1) setdest 381.059656096718 454.046276267996 6.678949601301"
$ns_ at 149.767036437453 "$node_(8) setdest 215.614653855527 193.185174880204 0.000000000000"
$ns_ at 151.155848699284 "$god_ set-dist 3 5 1"
$ns_ at 151.409332184412 "$god_ set-dist 2 6 2"
$ns_ at 151.584676013452 "$god_ set-dist 6 9 2"
$ns_ at 151.767036437453 "$node_(8) setdest 229.063588926854 204.514778577507 0.662407362317"
$ns_ at 152.935420312189 "$god_ set-dist 5 7 1"
$ns_ at 156.070021061078 "$god_ set-dist 1 6 3"
$ns_ at 156.070021061078 "$god_ set-dist 2 6 3"
$ns_ at 156.070021061078 "$god_ set-dist 6 8 2"
$ns_ at 159.383231001941 "$god_ set-dist 0 1 1"
$ns_ at 159.537531635641 "$god_ set-dist 0 2 1"
$ns_ at 165.263265529924 "$god_ set-dist 1 5 1"
$ns_ at 165.263265529924 "$god_ set-dist 1 6 2"
$ns_ at 167.196843150832 "$node_(6) setdest 416.505866132961 426.982145363532 0.000000000000"
$ns_ at 168.851692650539 "$god_ set-dist 1 6 1"
$ns_ at 168.851692650539 "$god_ set-dist 2 6 2"
$ns_ at 169.196843150832 "$node_(6) setdest 390.723844121806 229.212053044724 3.654852407102"
$ns_ at 170.612446016674 "$god_ set-dist 3 6 1"
$ns_ at 172.453310574311 "$god_ set-dist 3 4 2"
$ns_ at 174.577703464411 "$node_(3) setdest 331.086138348541 217.131377468660 0.000000000000"
$ns_ at 174.613150573494 "$god_ set-dist 1 7 2"
$ns_ at 175.508348841760 "$god_ set-dist 2 7 2"
$ns_ at 176.577703464411 "$node_(3) setdest 446.812037713105 316.221474035193 4.722531836547"
$ns_ at 176.583942776355 "$god_ set-dist 0 6 1"
$ns_ at 178.314211268978 "$node_(8) setdest 229.063588926854 204.514778577507 0.000000000000"
$ns_ at 180.314211268978 "$node_(8) setdest 492.646238992554 412.146709912111 7.819444208044"
$ns_ at 181.031477100407 "$god_ set-dist 6 8 1"
$ns_ at 181.559969010225 "$god_ set-dist 5 9 2"
$ns_ at 184.429318277099 "$god_ set-dist 3 7 2"
$ns_ at 185.426889354599 "$god_ set-dist 1 9 2"
$ns_ at 185.764710729980 "$god_ set-dist 2 6 1"
$ns_ at 191.886491445872 "$god_ set-dist 3 9 2"
$ns_ at 193.625421989055 "$node_(4) setdest 66.994012551092 278.791597459617 0.000000000000"
$ns_ at 194.620865596447 "$god_ set-dist 4 8 2"
$ns_ at 195.625421989055 "$node_(4) setdest 152.643541281544 230.996835522200 0.369531248431"
$ns_ at 197.661807402845 "$god_ set-dist 7 8 2"
$ns_ at 197.798048786103 "$god_ set-dist 3 5 2"
$ns_ at 199.328978694236 "$god_ set-dist 1 2 2"
$ns_ at 199.489145410220 "$god_ set-dist 8 9 2"
#
# Destination Unreachables: 0
#
# Route Changes: 120
#
# Link Changes: 106
#
# Node | Route Changes | Link Changes
#    0 |            14 |           14
#    1 |            30 |           26
#    2 |            29 |           27
#    3 |            36 |           30
#    4 |            14 |           14
#    5 |            27 |           21
#    6 |            32 |           25
#    7 |            26 |           25
#    8 |            20 |           18
#    9 |            12 |           12
#



# Generation of movements 
#$ns at 10.0 "$node_(0) setdest 250.0 250.0 10.0" 
#$ns at 15.0 "$node_(1) setdest 45.0 285.0 10.0" 
#$ns at 110.0 "$node_(0) setdest 480.0 300.0 10.0"  
#$ns at 70.0 "$node_(3) setdest 180.0 30.0 10.0"  

# Set a TCP connection between node_(0) and node_(1) 
#
# nodes: 10, max conn: 10, send rate: 0.0, seed: 0
#
#
# 0 connecting to 1 at time 150.95099582846788
#
set tcp_(0) [$ns_ create-connection  TCP $node_(0) TCPSink $node_(1) 0]
$tcp_(0) set window_ 32
$tcp_(0) set packetSize_ 512
set ftp_(0) [$tcp_(0) attach-source FTP]
$ns_ at 150.95099582846788 "$ftp_(0) start"
#
# 1 connecting to 2 at time 55.757610404751084
#
set tcp_(1) [$ns_ create-connection  TCP $node_(1) TCPSink $node_(2) 0]
$tcp_(1) set window_ 32
$tcp_(1) set packetSize_ 512
set ftp_(1) [$tcp_(1) attach-source FTP]
$ns_ at 55.757610404751084 "$ftp_(1) start"
#
# 2 connecting to 3 at time 137.75441297225393
#
set tcp_(2) [$ns_ create-connection  TCP $node_(2) TCPSink $node_(3) 0]
$tcp_(2) set window_ 32
$tcp_(2) set packetSize_ 512
set ftp_(2) [$tcp_(2) attach-source FTP]
$ns_ at 137.75441297225393 "$ftp_(2) start"
#
# 4 connecting to 5 at time 11.758482294044683
#
set tcp_(3) [$ns_ create-connection  TCP $node_(4) TCPSink $node_(5) 0]
$tcp_(3) set window_ 32
$tcp_(3) set packetSize_ 512
set ftp_(3) [$tcp_(3) attach-source FTP]
$ns_ at 11.758482294044683 "$ftp_(3) start"
#
# 4 connecting to 6 at time 155.6568584570926
#
set tcp_(4) [$ns_ create-connection  TCP $node_(4) TCPSink $node_(6) 0]
$tcp_(4) set window_ 32
$tcp_(4) set packetSize_ 512
set ftp_(4) [$tcp_(4) attach-source FTP]
$ns_ at 155.6568584570926 "$ftp_(4) start"
#
# 7 connecting to 8 at time 57.100370422518054
#
set tcp_(5) [$ns_ create-connection  TCP $node_(7) TCPSink $node_(8) 0]
$tcp_(5) set window_ 32
$tcp_(5) set packetSize_ 512
set ftp_(5) [$tcp_(5) attach-source FTP]
$ns_ at 57.100370422518054 "$ftp_(5) start"
#
#Total sources/connections: 5/6
#

for {set i 0} {$i < 9 } { incr i } { 
    $ns at $val(stop) "$ftp_($i) stop"; 
}
#$ns at $val(stop) "$ftp stop" 

$ns at 201.0 "finish"

# Telling nodes when the simulation ends 


# ending nam and the simulation  
#$ns at $val(stop) "$ns nam-end-wireless $val(stop)" 
#$ns at $val(stop) "stop" 
#$ns at 150.01 "puts \"end simulation\" ; $ns halt" 


#Call the finish procedure after 5 seconds of simulation time 
$ns run
[/code]

错误是:

sabin@sabin-桌面:~/D$ ns DSR10.tcl num_nodes 设为 10 警告:请使用 tcl/ex/wireless-mitf.tcl 中所示的 -channel 初始化列表 xListHead 无法读取 "ns_": 没有这样的变量 在执行时 "$ns_ 在 2.000000000000"$node_(0) setdest 113.561924924348 380.474029490398 5.012234894686"" (文件"DSR10.tcl"第195行)

在第 66 行中,您将 ns 定义为 nsset ns [new Simulator]

在第 195 - 380 行中,ns 有另一个名称 = ns_ ,这当然不起作用。因此,您可以在出现 ns 的几行中将 ns 编辑为 ns_,或者将 ns_ 中的所有 195 - 380 行编辑为 ns