Monday, April 29, 2013

NS-2 NAM Error

If following is the error when you run

$nam sample.nam
node 0 is not defined… node 0 is not defined… node 1 is not defined… node 1 is not defined… node 1 is not defined… node 0 is not defined… node 0 is not defined… node 0 is not defined… node 1 is not defined… node 1 is not defined… node 1 is not defined… node 0 is not defined… node 0 is not defined… node 0 is not defined… node 1 is not defined… node 1 is not defined… node 1 is not defined… node 0 is not defined… node 0 is not defined… node 0 is not defined… node 1 is not defined
 
Solution:
 $node_(0) set X_ 1236.434683198672
$node_(0) set Y_ 179.979610823970
$node_(0) set Z_ 0.000000000000
$node_(1) set X_ 1790.717030099859
$node_(1) set Y_ 83.776877593619
$node_(1) set Z_ 0.000000000000
 $ns_ at 0.000000000000 "$node_(0) setdest 8.478589906252 340.108921691462 0.138306462152"
$ns_ at 0.000000000000 "$node_(1) setdest 758.184447675563 73.841187162084 0.696734621404"
Add following two line at the after the mobility declaration.
$ns_ initial_node_pos $node_(1) 20
$ns_ initial_node_pos $node_(0) 20

Tuesday, April 16, 2013

Error while adding new protocol in NS2 - 3

One more common error is as follows:

invalid command name "Agent/MyAgentOtcl"
    while executing
"Agent/MyAgentOtcl set seqNo_ $opt(seqNo)"



This is due to one of the below listed reason:

1. The spelling mistake in "Agent/MyAgentOtcl" of TCL script and .cc file. In .cc file code will be as follows:

MyAgentClass() : TclClass("Agent/MyAgentOtcl") {}
TclObject* create(int, const char*const*) {
return(new MyAgent());
}


2. Once protocol is added, then updating makefile is also important. In makefile give the path for creating object file. If path is not give, then TCL scripts cannot access the C++ codes.

3. After modifying the makefile and ./configure, sometimes makefile will not be having the path information. You may get ./configure as successfully completed but TCL scripts fails to access. So updating is also important.

Error while adding new protocol in NS2 - 2

Error:

    make: *** No rule to make target `tcp/linux/tcp_naivereno.cc', needed by `depend'.  Stop.

Solution:

edit file “ns-allinone-2.33/ns-2.33/Makefile.in”

...


OBJ_CC = \

...

    tcp/scoreboard.o tcp/scoreboard-rq.o tcp/tcp-sack1.o tcp/tcp-fack.o \
-    tcp/linux/tcp_naivereno.o\
-    tcp/linux/src/tcp_cong.o\
-    tcp/linux/src/tcp_highspeed.o tcp/linux/src/tcp_bic.o tcp/linux /src/tcp_htcp.o tcp/linux/src/tcp_scalable.o src/tcp_cubic.o\
-    tcp/linux/src/tcp_westwood.o tcp/linux/src/tcp_vegas.o tcp/linux/src/tcp_hybla.o\
-    tcp/linux/src/tcp_illinois.o tcp/linux/src/tcp_yeah.o \
-    tcp/linux/src/tcp_veno.o tcp/linux/src/tcp_compound.o tcp/linux/src/tcp_lp.o\
-    tcp/scoreboard1.o tcp/tcp-linux.o tcp/linux/ns-linux-util.o tcp/linux/ns-linux-c.o tcp/linux/ns-linux-param.o\
+    tcp/scoreboard1.o tcp/tcp-linux.o tcp/linux/ns-linux-util.o \
    tcp/tcp-asym.o tcp/tcp-asym-sink.o tcp/tcp-fs.o \

...
-OBJ_C =
+OBJ_C = \
+    tcp/linux/tcp_naivereno.o\
+    tcp/linux/src/tcp_cong.o\
+    tcp/linux/src/tcp_highspeed.o tcp/linux/src/tcp_bic.o tcp/linux/src/tcp_htcp.o tcp/linux/src/tcp_scalable.o tcp/linux/src/tcp_cubic.o\
+    tcp/linux/src/tcp_westwood.o tcp/linux/src/tcp_vegas.o tcp/linux/src/tcp_hybla.o\
+    tcp/linux/src/tcp_illinois.o tcp/linux/src/tcp_yeah.o \
+    tcp/linux/src/tcp_veno.o tcp/linux/src/tcp_compound.o tcp/linux/src/tcp_lp.o\
+    tcp/linux/ns-linux-c.o tcp/linux/ns-linux-param.o

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