WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: error "error when calling class $cls: $args" $..."

Re: error "error when calling class $cls: $args" $..."

by Neelambari :: Rate this Message:

| View in Thread

finally i got the mistake which i made....In my TCL code I specified the name of the routing protocol wrongly as LMP instead of LMPMeshRouter which is specified in the create-wireless-node args procedure in ns-lib.tcl .When I changed that it is working
Neelambari wrote:
Hi all,
As part of my major project I am developing
a multicast routing protocol in Multichannel Wireless Mesh
Network..Now I am simulating the protocol using NS 2.
(ns-allinone-2.33).For multi channel support in NS2 I modified it
using "Adding Multiple Interface Support in NS-2" by Prof.Ramon
Aguero.Now i developed the code for a mesh router which can have
multiple wireless interfaces.The Agent  code is now implemented only
to send hello message which informs its neighbors about its presence.
For this part I went through AODV implementation in NS2. Now I am able
to compile the code but while executing a TCL program I am getting
error as below. The TCL code is also listed. I was trying to solve it
by searching in google but i couldn't find anything helpful in this
regard.Please  help me to overcome this problem.
With Regards
Ajish



TCL CODE
=====================================================================================
#==========================================================================
#--------------------------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(ifqlen)         50                         ;# max packet in ifq

set val(nn)             2                          ;# number of mobilenodes
set val(ni)             2                          ;# number of interfaces

#set val(rp)             DSDV                       ;# routing protocol
set val(rp)             LMP                       ;# routing protocol
#set val(ni)             2                         ;# number of interfaces

#==============================================================================
#---------------------------Main Program---------------------------------------
#==============================================================================
set ns_         [new Simulator]

set tracefd     [open LMP.tr w]

$ns_ trace-all $tracefd

#==============================================================================
#----------------------------Set The Topology----------------------------------
#==============================================================================


set topo [new Topography]


$topo load_flatgrid 500 500

#==============================================================================
#----------------------------Create GOD----------------------------------------
#==============================================================================
for {set i 0} {$i < $val(ni) } {incr i} {
       set chan_($i) [new $val(chan)]
}
#set chan_(0) [new $val(chan)]


#set chan_(1) [new $val(chan)]
create-god [expr $val(nn)*$val(ni)]

#==============================================================================
#--------------------------------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) \

                        -channel $chan_(0) \

                        -topoInstance $topo \

                        -agentTrace ON \

                        -routerTrace ON \

                        -macTrace OFF \

                        -movementTrace OFF \
                        -ifNum $val(ni)
                        #-channel $chan_1_


for {set i 0} {$i < $val(ni) } {incr i} {
       $ns_ add-channel $i $chan_($i)
}
for {set i 0} {$i < $val(nn) } {incr i} {
#       puts "Its not working......"
       set node_($i) [$ns_ node]
#       puts "Its not working......hihi"
       $node_($i) random-motion 0
#       puts "Its not working......"
}

#for {set i 0} {$i < $val(nn) } {incr i} {
#               puts "hello"

#               set node_($i) [$ns_ node]

#               $node_($i) random-motion 0              ;# disable random motion

#       }

#==================================================================================
#----------------------------Placing Nodes in the
Grid-----------------------------
#==================================================================================
$node_(0) set X_ 5.0

$node_(0) set Y_ 2.0

$node_(0) set Z_ 0.0



$node_(1) set X_ 390.0

$node_(1) set Y_ 385.0

$node_(1) set Z_ 0.0

#=================================================================================
#--------------------------------Create and attach
Agent--------------------------
#=================================================================================
set lmpsrc [new Agent/LMPMeshRouter]

set lmpsink [new Agent/LMPMeshRouter]

$ns_ attach-agent $node_(0) $lmpsrc

$ns_ attach-agent $node_(1) $lmpsink

$ns_ connect $lmpsrc $lmpsink

set ftp [new Application/FTP]

$ftp attach-agent $lmpsrc

$ns_ at 10.0 "$lmpsrc start"
$ns_ at 100.0 "stop"

$ns_ at 100.01 "puts \"NS EXITING...\" ; $ns_ halt"

proc stop {} {

   global ns_ tracefd

   $ns_ flush-trace

   close $tracefd

}



puts "Starting Simulation..."

$ns_ run


===================================================================================
===================================================================================
Error
===================================================================================
num_nodes is set 4
AJISH.................
helloooooooooooo
add-channel working fine.....
helloooooooooooo
add-channel working fine.....

   (_o15 cmd line 1)
   invoked from within
"_o15 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 "_o15" line 2)
   (SplitObject unknown line 2)
   invoked from within
"_o15 addr"
   ("eval" body line 1)
   invoked from within
"eval $node addr $args"
   ("default" arm line 2)
   invoked from within
"switch -exact $routingAgent_ {
Protoname {
set ragent [$self create-protoname-agent $node]
}
LMPMeshRouter {
set ragent [$self create-lmpmrrouter-agen..."
   (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"
   ("for" body line 3)
   invoked from within
"for {set i 0} {$i < $val(nn) } {incr i} {
#       puts "Its not working......"
       set node_($i) [$ns_ node]
#       puts "Its not working......hihi"
       $node_($i) ran..."
   (file "LMP.tcl" line 76)
===================================================================================
The create-wireless-node args procedure in ns-lib.tcl
===================================================================================
Simulator instproc create-wireless-node args {
       $self instvar routingAgent_ wiredRouting_ propInstance_ llType_ \
           macType_ ifqType_ ifqlen_ phyType_ chan antType_ \
           energyModel_ initialEnergy_ txPower_ rxPower_ \
           idlePower_ sleepPower_ sleepTime_ transitionPower_ transitionTime_ \
           topoInstance_ level1_ level2_ inerrProc_ outerrProc_ FECProc_
rtAgentFunction_ numifs_

       Simulator set IMEPFlag_ OFF

       # create node instance
       set node [eval $self create-node-instance $args]

       # basestation address setting
       if { [info exist wiredRouting_] && $wiredRouting_ == "ON" } {
               $node base-station [AddrParams addr2id [$node node-addr]]
       }
       if {$rtAgentFunction_ != ""} {
               set ragent [$self $rtAgentFunction_ $node]
       } else {
               switch -exact $routingAgent_ {
                   Protoname {
                          set ragent [$self create-protoname-agent $node]
                   }
                   LMPMeshRouter {
                         set ragent [$self create-lmpmrrouter-agent $node]
                   }
                   DSDV {
                           set ragent [$self create-dsdv-agent $node]
                   }
                   DSR {
                           $self at 0.0 "$node start-dsr"
                   }
                   AODV {
                           set ragent [$self create-aodv-agent $node]
                   }
                   TORA {
                           Simulator set IMEPFlag_ ON
                           set ragent [$self create-tora-agent $node]
                   }
                   DIFFUSION/RATE {
                           eval $node addr $args
                           set ragent [$self create-diffusion-rate-agent $node]
                   }
                   DIFFUSION/PROB {
                           eval $node addr $args
                           set ragent [$self create-diffusion-probability-agent $node]
                   }
                   Directed_Diffusion {
                           eval $node addr $args
                           set ragent [$self create-core-diffusion-rtg-agent $node]
                   }
                   FLOODING {
                           eval $node addr $args
                           set ragent [$self create-flooding-agent $node]
                   }
                   OMNIMCAST {
                           eval $node addr $args
                           set ragent [$self create-omnimcast-agent $node]
                   }
                   DumbAgent {
                           set ragent [$self create-dumb-agent $node]
                   }
                   ManualRtg {
                           set ragent [$self create-manual-rtg-agent $node]
                   }
                   default {
                           eval $node addr $args
                           puts "Wrong node routing agent!"
                           exit
                   }
               }
       }

       # errProc_ and FECProc_ are an option unlike other
       # parameters for node interface
       if ![info exist inerrProc_] {
               set inerrProc_ ""
       }
       if ![info exist outerrProc_] {
               set outerrProc_ ""
       }
       if ![info exist FECProc_] {
               set FECProc_ ""
       }



       # Add node interface
       if { [info exist numifs_] } {
               for { set i 0 } { $i < $numifs_ } { incr i } {
                       #puts "Add-Interface....One....."
                       # Add one interface per channel
                       $node add-interface $chan($i) $propInstance_ $llType_ $macType_ \
                       $ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ \
                       $inerrProc_ $outerrProc_ $FECProc_
                       #puts "Add-Interface....One One....."
               }
       } else {
               #puts "Add-Interface....One.....Two"
               $node add-interface $chan $propInstance_ $llType_ $macType_ \
               $ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ \
               $inerrProc_ $outerrProc_ $FECProc_
               #puts "Add-Interface....One.....Three"
       }


       # Attach agent
       if {$routingAgent_ != "DSR"} {
               $node attach $ragent [Node set rtagent_port_]
       }
       if {$routingAgent_ == "DIFFUSION/RATE" ||
           $routingAgent_ == "DIFFUSION/PROB" ||
           $routingAgent_ == "FLOODING" ||
           $routingAgent_ == "OMNIMCAST" ||
           $routingAgent_ == "Directed_Diffusion" } {
               $ragent port-dmux [$node demux]
               $node instvar ll_
               $ragent add-ll $ll_(0)
       }
       if { $routingAgent_ == "DumbAgent" } {
               $ragent port-dmux [$node demux]
       }


       # Bind routing agent and mip agent if existing basestation
       # address setting
       if { [info exist wiredRouting_] && $wiredRouting_ == "ON" } {
               if { $routingAgent_ != "DSR" } {
                       $node mip-call $ragent
               }
       }
       #
       # This Trace Target is used to log changes in direction
       # and velocity for the mobile node.
       #
       set tracefd [$self get-ns-traceall]
       if {$tracefd != "" } {
               $node nodetrace $tracefd
               $node agenttrace $tracefd
       }
       set namtracefd [$self get-nam-traceall]
       if {$namtracefd != "" } {
               $node namattach $namtracefd
       }
       if [info exists energyModel_] {
               if  [info exists level1_] {
                       set l1 $level1_
               } else {
                       set l1 0.5
               }
               if  [info exists level2_] {
                       set l2 $level2_
               } else {
                       set l2 0.2
               }
               $node addenergymodel [new $energyModel_ $node \
                               $initialEnergy_ $l1 $l2]
       }
       if [info exists txPower_] {
               $node setPt $txPower_
       }
       if [info exists rxPower_] {
               $node setPr $rxPower_
       }
       if [info exists idlePower_] {
               $node setPidle $idlePower_
       }
#
       if [info exists sleepPower_] {
               $node setPsleep $sleepPower_
       }
       if [info exists sleepTime_] {
               $node setTSleep $sleepTime_
       }
       if [info exists transitionPower_] {
               $node setPtransition $transitionPower_
       }
       if [info exists transitionTime_] {
               $node setTtransition $transitionTime_
       }
#
       $node topography $topoInstance_

       return $node
}
===================================================================================

 « Return to Thread: error "error when calling class $cls: $args" $..."