Dear all, I laid my hand on a TCL script on the above subject matter and i tried to run it but was given some errors which is shown below:
ism...@ismail-desktop:~$ sudo su [sudo] password for ismail: r...@ismail-desktop:/home/ismail# ns clustering.tcl num_nodes is set 31 (_o14 cmd line 1) invoked from within "_o14 cmd addr" 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 "_o14" line 2) (SplitObject unknown line 2) invoked from within "_o14 addr" ("eval" body line 1) invoked from within "eval $node addr $args" ("default" arm line 2) invoked from within "switch -exact $routingAgent_ { DSDV { set ragent [$self create-dsdv-agent $node] } DSR { $self at 0.0 "$node start-dsr" } AODV { set ragent [$self cre..." (procedure "_o3" line 14) (Simulator create-wireless-node line 14) invoked from within "_o3 create-wireless-node" ("eval" body line 1) invoked from within "eval $self create-wireless-node $args" (procedure "_o3" line 23) (Simulator node line 23) invoked from within "$ns_ node" invoked from within "set node_(0) [$ns_ node]" (file "clustering.tcl" line 118) r...@ismail-desktop:/home/ismail# The TCL script is also shown below : #The TCL script file #=================================== # ?????? #=================================== 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 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) 31 ;# number of mobilenodes set val(initialenergy) 500 ;# initial energy of 50 Joules set val(energymodel) "EnergyModel" ;# energy model set val(rp) DCA ;# routing protocol set val(x) 1000 ;# X dimension of topography set val(y) 1000 ;# Y dimension of topography set val(stop) 20.0 ;# time of simulation end #set val(cp) /home/ismail/ns-allinone-2.34/ns-2.34/tcl/mobility/scene/cbr-3-test #set val(sc) /home/ismail/ns-allinone-2.34/ns-2.34/tcl/mobility/scene/scen-3-test set val(DCA) DCA ;# Define DCA constant set val(seed) 0.0 #=================================== # transmission range #=================================== #$val(netif) set RXThresh_ 2.81838e-13 #================================================ # Create new simulator & trace file #================================================ set ns_ [new Simulator] ;#??ns simulator $ns_ use-newtrace set tracefd [open test.tr w] ;#??trace file $ns_ trace-all $tracefd #================================================ # Create nam file & write all traces to file #================================================ set namtrace [open test.nam w] ;#????nam trace file $ns_ namtrace-all-wireless $namtrace $val(x) $val(y) #-------------------------------------------------------------------------- #Antenna/OmniAntenna set X_ 0 #Antenna/OmniAntenna set Y_ 0 #Antenna/OmniAntenna set Z_ 0.1 #Antenna/OmniAntenna set Gt_ 1.0 #Antenna/OmniAntenna set Gr_ 1.0 #Phy/WirelessPhy set CPThresh_ 10.0 #Phy/WirelessPhy set CSThresh_ 2.81838e-05 Phy/WirelessPhy set RXThresh_ 0.81838e-05 #Phy/WirelessPhy set bandwidth_ 2e6 #Phy/WirelessPhy set Pt_ 0.0064 #Phy/WirelessPhy set Pr_ 2.81838e-05 #Phy/WirelessPhy set freq_ 9.14e+08 #Phy/WirelessPhy set L_ 1.0 $ns_ namtrace-all-wireless $namtrace $val(x) $val(y) set topo [new Topography] ;#??topography object $topo load_flatgrid $val(x) $val(y) #create-god $val(nn) set god_ [create-god $val(nn)] $god_ on #??channel set chan_0_ [new $val(chan)] #===================================# # Settings for power/ # transmisssion range of a node #===================================# #set range(x) 100 #set range(y) 100 #set OVERLAP 50 #set coverage [CellCoverage 1 1 $range(x) $range(y) $OVERLAP] #set power [SetPt $coverage] #Phy/WirelessPhy set Pt_ $power #$ns node-config -rxPower $power -txPower $power set rxPower 1.00 set txPower 2.00 set inEnergy 50 #=================================== # ??Configuration of node??? #=================================== #??MobileNode??? $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) \ -topoInstance $topo \ -energyModel "EnergyModel" \ -initialEnergy $val(initialenergy) \ -idlePower 1.0 \ -rxPower 1.0 \ -txPower 2.0 \ -agentTrace ON \ -routerTrace ON \ -macTrace ON \ -movementTrace OFF\ -channel $chan_0_ \ #=================================== # DATA SINK #=================================== #???0?Node set node_(0) [$ns_ node] $node_(0) set X_ 0 $node_(0) set Y_ 0 $node_(0) set Z_ 0.0 $ns_ initial_node_pos $node_(0) 100 #=================================== # NORMAL NODES #=================================== #???1?Node set node_(1) [$ns_ node] $node_(1) set X_ 677 $node_(1) set Y_ 166 $node_(1) set Z_ 0.0 $ns_ initial_node_pos $node_(1) 40 #???30?Node set node_(30) [$ns_ node] $node_(30) set X_ 620 $node_(30) set Y_ 240 $node_(30) set Z_ 0.0 $ns_ initial_node_pos $node_(30) 40 for {set i 0} {$i < $val(nn) } { incr i } { $god_ new_node $node_($i) ; # !!! } # recv function Agent/Ping instproc recv {from rtt} { $self instvar node_ puts "node [$node_ id] received ping answer from $from with round-trip-time $rtt ms." } if {$val(rp) == $val(DCA)} { puts "Clustering Started" set dca [new Agent/DCA] #$node_(0) attach $dca #$ns_ attach-agent $node_(1) $udp $ns_ at 0.0 "$dca set-ll $val(ll)" $ns_ attach-agent $node_(0) $dca $dca start_clustering $dca start_CHs puts "Clustering Finished" } for {set i 0} {$i < $val(nn) } { incr i } { $ns_ at $val(stop) "$node_($i) reset"; } # creating nam display files $ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)" $ns_ at $val(stop) "stop" $ns_ at $val(stop).2 "puts \"end simulation\" ; $ns_ halt" #$ns_ at 10.0 "$dca print_out_cluster_info" # function for stopping the simulation proc stop {} { global ns_ tracefd #namtrace $ns_ flush-trace close $tracefd #close $namtrace exec nam test.nam & exit 0 } $ns_ run I will highly appreciate anyone who can assist me on this problem. Thank you. Ismail