Sunday, August 11, 2013

TCL Error

TCL compilation error:

/home/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/library:/usr/lib /home/ramakrishna/ns2/ns-allinone-2.32/lib/tcl8.4 /home/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/library:/usr/lib /home/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/library:/usr/tcl8.4 /usr/local/lib/tcl8.4 /usr/lib/tcl8.4 /usr/local/library /usr/library /usr/tcl8.4.15/library /tcl8.4.15/library /home/ramakrishna/ns2/ns-allinone-2.32/lib/tcl8.4



This probably means that Tcl wasn't installed properly.


1) cd ns-allinone-2.34/tcl8.4.18/ && ln -s lib/ library
2) Reinstall ns-allinone-2.34

OR

1. Go to location root-usr-local-bin by giving following command in terminal
cd /usr/local/bin
2. There you would find the ns file. We just need to remove it by giving following command
rm ns
3. Thats it, you are done. Now your ns starts running successfully.

Friday, May 31, 2013

'make depend' Error


/bin/sh: Syntax error: Bad fd number
make: *** [depend] Error 2

This is because the default ubuntu 10.04 setting uses dash instead of bash for sh command. Thus, rename the old link of /bin/sh to dash and create new link of /bin/sh to bash.

cd /bin
sudo mv sh sh_orig
sudo ln -s /bin/bash sh

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

Friday, January 4, 2013

Using added new routing protocol in NS2

The steps to be followed in Fedora system are as follows:

  1. ./configure
  2. make clean
  3. make
  4. make install
After these only new protocol will be active and use.