Tuesday, April 16, 2013

Error while adding new protocol in NS2 - 1

The most commonly found errors while adding new protocol are as follows:

invoked from within
"_o433 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 "_o433" line 2)
(SplitObject unknown line 2)
invoked from within
"_o433 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"
("for" body line 2)
invoked from within
"for {set i $val(nnaodv)} {$i < $val(nn)} {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;#disable random motion
#..."



The error is due to the TCL script you are trying to execute is not compilng to the library TCL scripts. This error can be solved using following commands:

  1. ./configure
  2. make clean
  3. make
  4. sudo make install

3 comments:

  1. it still did not resolve. please help

    ReplyDelete
  2. hello sir,

    I am getting the below mentioned error when running the simulation script for implementing the black hole in ns2. Can you help me resolve this issue?

    num_nodes is set 20
    Creating nodes...
    INITIALIZE THE LIST xListHead

    (_o433 cmd line 1)
    invoked from within
    "_o433 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 "_o433" line 2)
    (SplitObject unknown line 2)
    invoked from within
    "_o433 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"
    ("for" body line 2)
    invoked from within
    "for {set i $val(nnaodv)} {$i < $val(nn)} {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0 ;#disable random motion
    $ns_ at 0.01 "$node_(..."
    (file "bhsim.tcl" line 58)

    Kindly guide me through this problem.

    Regards,

    ReplyDelete
  3. Sir, I tried to implement blackhole aodv in ns2 and i want to ask where should i put this "blackholeaodv.tcl" file whose contents are as follows:


    # ======================================================================
    # Default Script Options
    # ======================================================================

    set opt(ragent) Agent/rtProto/blackholeAODV
    set opt(pos) NONE

    if { $opt(pos) != "NONE" } {
    puts "*** WARNING: blackholeAODV using $opt(pos) position configuration..."
    }

    # ======================================================================
    Agent instproc init args {
    $self next $args
    }
    Agent/rtProto instproc init args {
    $self next $args
    }
    Agent/rtProto/blackholeAODV instproc init args {
    $self next $args
    }

    Agent/rtProto/blackholeAODV set sport_ 0
    Agent/rtProto/" set dport_ 0

    # ======================================================================

    proc create-routing-agent { node id } {
    global ns_ ragent_ tracefd opt

    #
    # Create the Routing Agent and attach it to port 255.
    #
    set ragent_($id) [new $opt(ragent) $id]
    set ragent $ragent_($id)
    $node attach $ragent 255

    $ragent if-queue [$node set ifq_(0)] ;# ifq between LL and MAC
    $ns_ at 0.$id "$ragent_($id) start" ;# start BEACON/HELLO Messages

    #
    # Drop Target (always on regardless of other tracing)
    #
    set drpT [cmu-trace Drop "RTR" $node]
    $ragent drop-target $drpT

    #
    # Log Target
    #
    set T [new Trace/Generic]
    $T target [$ns_ set nullAgent_]
    $T attach $tracefd
    $T set src_ $id
    $ragent log-target $T
    }


    proc create-mobile-node { id } {
    global ns_ chan prop topo tracefd opt node_
    global chan prop tracefd topo opt

    set node_($id) [new MobileNode]

    set node $node_($id)
    $node random-motion 0 ;# disable random motion
    $node topography $topo

    #
    # This Trace Target is used to log changes in direction
    # and velocity for the mobile node.
    #
    set T [new Trace/Generic]
    $T target [$ns_ set nullAgent_]
    $T attach $tracefd
    $T set src_ $id
    $node log-target $T

    $node add-interface $chan $prop $opt(ll) $opt(mac) \
    $opt(ifq) $opt(ifqlen) $opt(netif) $opt(ant)

    #
    # Create a Routing Agent for the Node
    #
    create-routing-agent $node $id

    # ============================================================

    if { $opt(pos) == "Box" } {

    set spacing 200
    set maxrow 3
    set col [expr ($id - 1) % $maxrow]
    set row [expr ($id - 1) / $maxrow]
    $node set X_ [expr $col * $spacing]
    $node set Y_ [expr $row * $spacing]
    $node set Z_ 0.0
    $node set speed_ 0.0

    $ns_ at 0.0 "$node_($id) start"

    } elseif { $opt(pos) == "Random" } {

    $node random-motion 1

    $ns_ at 0.0 "$node_($id) start"
    }

    }


    And should i run this file to simulate black hole or the file available at following link

    http://www.btechnos.com/2012/05/tcl-program-for-simulating-blackhole.html

    Please help me sir.

    ReplyDelete