Errors during installation of NS-2.29 in Fedora 15

When I was installing ns-2.29 in fedora for the purpose of working on sensor networks I faced many errors. This post explains how to overcome these errors. Mannasim simulator is used for simulating sensor networks. It is available for ns-2.29 at http://www.mannasim.dcc.ufmg.br/

Error 1

Tcl.cc: In member function ‘void Tcl::eval(char*)’:

Tcl.cc:182:8: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc: In member function ‘int TclObject::traceVar(const char*, TclObject*)’:

Tcl.cc:421:50: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc: In static member function ‘static int TclClass::create_shadow(ClientData, Tcl_Interp*, int, const char**)’:

Tcl.cc:509:57: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc:511:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc: In static member function ‘static int TclClass::dispatch_instvar(ClientData, Tcl_Interp*, int, const char**)’:

Tcl.cc:566:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

Tcl.cc:571:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc: In member function ‘virtual void TclClass::bind()’:

Tcl.cc:603:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

Tcl.cc:605:60: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [Tcl.o] Error 1

tclcl-1.17 make failed! Exiting …

sol:

go to /ns-allinone-2.29/tclcl-1.17

open file tcl.cc

Replace the following

if (need_parse) {

char *p = strchr(localName, ‘(‘);

if (p)

*p = 0;

};

with

if (need_parse) {

const char *p = strchr (localName, ‘(‘);

if (p)

((char*) localName)[p-localName] = ‘\0’;

};

Error 2

./sctp/sctp.h:577:1: warning: ‘typedef’ was ignored in this declaration [enabled by default]

./sctp/sctp.h:705:8: error: extra qualification ‘SctpAgent::’ on member ‘DumpSendBuffer’ [-fpermissive]

trace/trace.cc:185:1: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [trace/trace.o] Error 1

Ns make failed!

Sol:

/ns-allinone-2.29/ns-2.29/sctp

open sctp.h

/* debugging functions

*/

Replace line 705

void SctpAgent::DumpSendBuffer();

with

void DumpSendBuffer();

Error 3

In file included from ./trace/cmu-trace.h:43:0,

from src_rtg/sragent.cc:53:

./mobile/god.h: At global scope:

./mobile/god.h:88:14: error: extra qualification ‘vector::’ on member ‘operator=’ [-fpermissive]

./mobile/god.h:93:14: error: extra qualification ‘vector::’ on member ‘operator+=’ [-fpermissive]

./mobile/god.h:98:13: error: extra qualification ‘vector::’ on member ‘operator==’ [-fpermissive]

./mobile/god.h:101:13: error: extra qualification ‘vector::’ on member ‘operator!=’ [-fpermissive]

make: *** [src_rtg/sragent.o] Error 1

Ns make failed!

Sol:

/ns-allinone-2.29/ns-2.29/mobile

open god.h

Replace the commented lines with the line following them

//inline void vector::operator=(const vector a) {

inline void operator=(const vector a) {

X = a.X;

Y = a.Y;

Z = a.Z;

}

//inline void vector::operator+=(const vector a) {

inline void operator+=(const vector a) {

X += a.X;

Y += a.Y;

Z += a.Z;

}

//inline int vector::operator==(const vector a) {

inline int operator==(const vector a) {

return (X == a.X && Y == a.Y && Z == a.Z);

}

//inline int vector::operator!=(const vector a) {

inline int operator!=(const vector a) {

return (X != a.X || Y != a.Y || Z != a.Z);

}

Error 4

queue/red.cc: In member function ‘virtual void REDQueue::trace(TracedVar*)’:

queue/red.cc:874:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/red.cc:875:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/red.cc:876:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/red.cc:877:41: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/red.o] Error 1

Ns make failed!

Sol:

/ns-allinone-2.29/ns-2.29/queue

open red.cc

void

REDQueue::trace(TracedVar* v)

{

Replace the commented line with the lines following them

//char wrk[500], *p;

char wrk[500];

const char *p;

Error 5

dsr/dsragent.cc:2737:18: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

dsr/dsragent.cc:2756:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [dsr/dsragent.o] Error 1

Ns make failed!

Sol:

/ns-allinone-2.29/ns-2.29/dsr

open dsragent.cc

add these callback helpers before SendBuf management and helpers

/* Callback helpers */

void

XmitFailureCallback(Packet *pkt, void *data)

{

DSRAgent *agent = (DSRAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

void

XmitFlowFailureCallback(Packet *pkt, void *data)

{

DSRAgent *agent = (DSRAgent *)data;

agent->xmitFlowFailed(pkt);

}

Error 6

dsr/dsragent.cc: In function ‘void XmitFailureCallback(Packet*, void*)’:

dsr/dsragent.cc:2802:1: error: redefinition of ‘void XmitFailureCallback(Packet*, void*)’

dsr/dsragent.cc:218:1: error: ‘void XmitFailureCallback(Packet*, void*)’ previously defined here

dsr/dsragent.cc:2614:1: error: ‘void DSRAgent::xmitFailed(Packet*, const char*)’ is private

dsr/dsragent.cc:2805:24: error: within this context

dsr/dsragent.cc: In function ‘void XmitFlowFailureCallback(Packet*, void*)’:

dsr/dsragent.cc:2809:1: error: redefinition of ‘void XmitFlowFailureCallback(Packet*, void*)’

dsr/dsragent.cc:225:1: error: ‘void XmitFlowFailureCallback(Packet*, void*)’ previously defined here

dsr/dsragent.cc:2562:1: error: ‘void DSRAgent::xmitFlowFailed(Packet*, const char*)’ is private

dsr/dsragent.cc:2812:28: error: within this context

make: *** [dsr/dsragent.o] Error 1

Ns make failed!

Sol:

/ns-allinone-2.29/ns-2.29/dsr

open dsragent.cc

Remove these lines starting from 2802 and 2809

void

XmitFailureCallback(Packet *pkt, void *data)

{

DSRAgent *agent = (DSRAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

void

XmitFlowFailureCallback(Packet *pkt, void *data)

{

DSRAgent *agent = (DSRAgent *)data;

agent->xmitFlowFailed(pkt);

}

Error 7

diffusion/diffusion.cc: In member function ‘void DiffusionAgent::MACprepare(Packet*, nsaddr_t, int, bool)’:

diffusion/diffusion.cc:427:26: error: ‘XmitFailedCallback’ was not declared in this scope

make: *** [diffusion/diffusion.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/diffusion

open diffusion.cc

add these

/* Callback helper */

void XmitFailedCallback(Packet *pkt, void *data)

{

DiffusionAgent *agent = (DiffusionAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

After this line

#include “routing_table.h”

Error 8

char *MsgStr[]= {“”, “INTEREST”, “DATA”, “DATA_READY”, “DATA_REQUEST”,

diffusion/diffusion.cc: In function ‘void XmitFailedCallback(Packet*, void*)’:

diffusion/diffusion.cc:468:6: error: redefinition of ‘void XmitFailedCallback(Packet*, void*)’

diffusion/diffusion.cc:84:6: error: ‘void XmitFailedCallback(Packet*, void*)’ previously defined here

diffusion/diffusion.h:197:8: error: ‘void DiffusionAgent::xmitFailed(Packet*)’ is protected

diffusion/diffusion.cc:471:24: error: within this context

make: *** [diffusion/diffusion.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/diffusion

open diffusion.cc

remove these lines starting from 468

void XmitFailedCallback(Packet *pkt, void *data)

{

DiffusionAgent *agent = (DiffusionAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

Error 9

diffusion/omni_mcast.cc: In member function ‘void OmniMcastAgent::ConsiderNew(Packet*)’:

diffusion/omni_mcast.cc:243:19: warning: variable ‘hashPtr’ set but not used [-Wunused-but-set-variable]

diffusion/omni_mcast.cc:246:25: warning: variable ‘forward_nodeID’ set but not used [-Wunused-but-set-variable]

diffusion/omni_mcast.cc: In member function ‘void OmniMcastAgent::MACprepare(Packet*, nsaddr_t, unsigned int, bool)’:

diffusion/omni_mcast.cc:388:26: error: ‘OmniMcastXmitFailedCallback’ was not declared in this scope

make: *** [diffusion/omni_mcast.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/diffusion

open omni_mcast.cc

Add these lines

/* Callback helper */

void OmniMcastXmitFailedCallback(Packet *pkt, void *data)

{

OmniMcastAgent *agent = (OmniMcastAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

after this line

#include “god.h”

and before

static class OmniMcastClass : public TclClass {

Error 10

diffusion/omni_mcast.cc: In function ‘void OmniMcastXmitFailedCallback(Packet*, void*)’:

diffusion/omni_mcast.cc:429:6: error: redefinition of ‘void OmniMcastXmitFailedCallback(Packet*, void*)’

diffusion/omni_mcast.cc:84:6: error: ‘void OmniMcastXmitFailedCallback(Packet*, void*)’ previously defined here

diffusion/omni_mcast.h:212:8: error: ‘void OmniMcastAgent::xmitFailed(Packet*)’ is protected

diffusion/omni_mcast.cc:432:24: error: within this context

make: *** [diffusion/omni_mcast.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/diffusion

open omni_mcast.cc

Remove the these lines starting from 429

void OmniMcastXmitFailedCallback(Packet *pkt, void *data)

{

OmniMcastAgent *agent = (OmniMcastAgent *)data; // cast of trust

agent->xmitFailed(pkt);

}

Error 11

queue/rio.cc: In member function ‘virtual void RIOQueue::trace(TracedVar*)’:

queue/rio.cc:565:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:566:38: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:567:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:568:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:569:39: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:570:40: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rio.cc:571:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/rio.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/queue

open rio.cc

Replace this line

char wrk[500], *p;

with lines

char wrk[500];

const char *p;

in

void

RIOQueue::trace(TracedVar* v)

{

Error 12

tcp/tcp-sack-rh.cc: At global scope:

tcp/tcp-sack-rh.cc:68:15: error: extra qualification ‘SackRHTcpAgent::’ on member ‘newack’ [-fpermissive]

make: *** [tcp/tcp-sack-rh.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/tcp

open tcp-sack-rh.cc

Replace this line

virtual void SackRHTcpAgent::newack(Packet* pkt);

with

virtual void newack(Packet* pkt);

in

class SackRHTcpAgent : public TcpAgent {

Error 13

queue/pi.cc: In member function ‘virtual void PIQueue::trace(TracedVar*)’:

queue/pi.cc:316:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/pi.cc:317:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/pi.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/queue

open pi.cc

Replace this line

char wrk[500], *p;

with lines

char wrk[500];

const char *p;

in

void PIQueue::trace(TracedVar* v)

{

Error 14

queue/vq.cc: In member function ‘virtual void Vq::trace(TracedVar*)’:

queue/vq.cc:333:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/vq.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/queue

open vq.cc

Replace this line

char wrk[500], *p;

with lines

char wrk[500];

const char *p;

in

void Vq::trace(TracedVar* v)

{

Error 15

queue/rem.cc: In member function ‘virtual void REMQueue::trace(TracedVar*)’:

queue/rem.cc:335:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rem.cc:336:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

queue/rem.cc:337:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/rem.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/queue

open rem.cc

Replace this line

char wrk[500], *p;

with lines

char wrk[500];

const char *p;

in

void REMQueue::trace(TracedVar* v)

{

Error 16

queue/gk.cc: In member function ‘virtual void GK::trace(TracedVar*)’:

queue/gk.cc:207:35: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

make: *** [queue/gk.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/queue

open gk.cc

Replace this line

char wrk[500], *p;

with line

char wrk[500];

const char *p;

in

void GK::trace(TracedVar* v)

{

Error 17

pgm/pgm-agent.cc: At global scope:

pgm/pgm-agent.cc:307:8: error: extra qualification ‘PgmAgent::’ on member ‘trace_event’ [-fpermissive]

pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_rdata(Packet*)’:

pgm/pgm-agent.cc:607:30: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_nak(Packet*)’:

pgm/pgm-agent.cc:756:43: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

pgm/pgm-agent.cc: In member function ‘void PgmAgent::handle_ncf(Packet*)’:

pgm/pgm-agent.cc:853:28: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [pgm/pgm-agent.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/pgm

open pgm-agent.cc

replace line no. 307

void PgmAgent::trace_event(char *evType, double evTime);

with

void trace_event(char *evType, double evTime);

Error 18

pgm/pgm-sender.cc: At global scope:

pgm/pgm-sender.cc:189:8: error: extra qualification ‘PgmSender::’ on member ‘trace_event’ [-fpermissive]

pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::handle_nak(Packet*)’:

pgm/pgm-sender.cc:501:67: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

pgm/pgm-sender.cc: In member function ‘virtual void PgmSender::send_rdata(RdataItem*)’:

pgm/pgm-sender.cc:645:61: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [pgm/pgm-sender.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/pgm

open pgm-sender.cc

replace line no. 189

void PgmSender::trace_event(char *evType, nsaddr_t daddr, double evTime);

with

void trace_event(char *evType, nsaddr_t daddr, double evTime);

Error 19

pgm/pgm-receiver.cc: At global scope:

pgm/pgm-receiver.cc:186:8: error: extra qualification ‘PgmReceiver::’ on member ‘trace_event’ [-fpermissive]

pgm/pgm-receiver.cc: In member function ‘void PgmReceiver::generate_Nak(int)’:

pgm/pgm-receiver.cc:617:34: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

make: *** [pgm/pgm-receiver.o] Error 1

Ns make failed!

Sol

/ns-allinone-2.29/ns-2.29/pgm

open pgm-receiver.cc

replace line no. 186

void PgmReceiver::trace_event(char *evType, double evTime);

with
void trace_event(char *evType, double evTime);

Posted in Network Simulation | Tagged | Leave a comment

Adding New Protocol

Step 1: Create new header and source files for new proposed algorithm.

Step 2: Put these files inside respective folder /home/user/ns-allinone-2.–/ns-2.–/

Step 3: Need to place that information in Makefile.in (in ns-allinone-2.–/ns-2.–/). Open Makefile.in using any editor (usually vi or gedit) and add the folder information to the OBJ_CC variable)

Step 5: Put new proposed algorithm information anywhere inside the OBJ_CC variable

For example: “propalgo/propalgo.o \”

Step 6: After editing the file entry, follow these steps:

1. Go to /home/user/ns-allinone-2.–/ns-2.–/

2. ./configure // replace Makefile with modified one.)

3. make clean //(*optional) use this, If you want to recompile the whole ns2.

4. make //this will make all object files which are missing

Compilation will be success if there are no errors in the modified code and NS will be created.

Step 7: Run TCL script for the new protocol.

Posted in Network Simulation | Leave a comment

how to recompile NS2

NS2 need to be recompiled in two cases.

1. When modifying the existing algorithm

By using same header and source files

2. When adding new files/Protocols

By adding new header and source files

Modifying the Existing Algorithm:

Step 1: Change the existing algorithm.

Step 2: execute the following command

make clean

make depend

make

Compilation will be success if there are no errors in the modified code and NS will be created.

Step 3: Run TCL script for the modified algorithm.

Posted in Network Simulation | Leave a comment

importance of seed in simulation

By default NS2 is deterministic in nature that means the result is same for every run or simulation.

Statistical analysis is achieved by running simulation for several runs and finding averages or variance for all the runs. Since NS2 is deterministic so same results are there for every run. Therefore the variance of the results is will be zero. We require randomness so that the averages and variances would be meaningful.

Seed is a used for introducing this randomness. Different seed creates different results. In order to introduce randomness different seeds are used.

This can be achieved by inserting $defaultRNG seed n into the Tcl script prior to $ns run
where n is an integer. If n is

an integer, NS2 will use n as a seed for random number generator.
zero, NS2 will change the seed according to clock and counter. Basically, the simulation results tends to be different for every run.

For example, NS2 sets n to “1” by default. Therefore, every run generate the same result.

But if you set n to 101, by executing

$defaultRNG seed 101

the result would be different from the result corresponding to the default setting. But all the result with n = 101 would still be the same

Posted in Network Simulation | Tagged | Leave a comment

How to install NS-2.34 in Fedora 15

This post shows the detailed procedure of installing NS-2.34 in fedora 15. This post also indicates the errors faced during installation and the possible solutions.
1. Download the ns-allinone-2.34 package from net http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.34/ in directory like /usr/src.
2. Go to /usr/src and extract ns-allinone-2.34.tar
tar xvfz ns-allinone-2.34.tar.gz
3.go to ns-allinone-2.34
cd ns-allinone-2.34
4. install
./install

Errors
1

tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly [-fpermissive]
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]
make: *** [tools/ranvar.o] Error 1
Ns make failed!

Sol:

open the /tools/ranvar.cc file. change line no 219 as shown in bold

double GammaRandomVariable::value()

{
// Proposed by Marsaglia in 2000:
// G. Marsaglia, W. W. Tsang: A simple method for gereating Gamma variables
// ACM Transactions on mathematical software, Vol. 26, No. 3, Sept. 2000
if (alpha_ < 1) {
double u = rng_->uniform(1.0);
//return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
}

double x, v, u;
double d = alpha_ – 1.0 / 3.0;
double c = (1.0 / 3.0) / sqrt (d);

2.

In file included from mac/mac-802_11Ext.cc:66:0:
mac/mac-802_11Ext.h: In member function ‘u_int32_t PHY_MIBExt::getHdrLen11()’:
mac/mac-802_11Ext.h:175:19: error: expected primary-expression before ‘struct’
mac/mac-802_11Ext.h:175:41: error: ‘dh_body’ was not declared in this scope
mac/mac-802_11Ext.h:175:51: error: ‘offsetof’ was not declared in this scope
mac/mac-802_11Ext.h:177:3: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [mac/mac-802_11Ext.o] Error 1
Ns make failed!
Sol:
open /mac/mac-802_11Ext.cc and add #include <cstddef>

#include “delay.h”
#include “connector.h”
#include “packet.h”
#include “random.h”
#include “mobilenode.h”
#include “arp.h”
#include “ll.h”
#include “mac.h”
#include <cstddef>
#include “mac-802_11Ext.h”
#include “cmu-trace.h”
#include <iostream>
#include “common/agent.h”

3.

mobile/nakagami.cc: In member function ‘virtual double Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*)’:

mobile/nakagami.cc:183:73: error: cannot call constructor ‘ErlangRandomVariable::ErlangRandomVariable’ directly [-fpermissive]
mobile/nakagami.cc:183:73: error: for a function-style cast, remove the redundant ‘::ErlangRandomVariable’ [-fpermissive]
mobile/nakagami.cc:185:67: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly [-fpermissive]
mobile/nakagami.cc:185:67: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’ [-fpermissive]
make: *** [mobile/nakagami.o] Error 1
Ns make failed!

Sol.

open mobile/nakagami.cc and replace line no 183 and 185 with lines as shown in bold

unsigned int int_m = (unsigned int)(floor (m));

double resultPower;

if (int_m == m) {
//resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
resultPower = ErlangRandomVariable(Pr/m, int_m).value();
} else {
//resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();
resultPower = GammaRandomVariable(m, Pr/m).value();
}
return resultPower;
}
After installation put the paths in bashrc file

(1) You MUST put /usr/src/ns-allinone-2.34/otcl-1.13, /usr/src/ns-allinone-2.34/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH <paths>
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>

(2) You MUST put /usr/src/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.
go to etc/bashrc and paste the following lines at the end of file

fi
# vim:ts=4:sw=4
#for ns-allinone-2.34
export PATH=/usr/src/ns-allinone-2.34/tcl8.4.18/unix:/usr/src/ns-allinone-2.34/tk8.4.18/unix:/usr/src/ns-allinone-2.34/bin:$PATH
export LD_LIBRARY_PATH=/usr/src/ns-allinone-2.34/tcl8.4.18/unix:/usr/src/ns-allinone-2.34/tk8.4.18/unix:/usr/src/ns-allinone-2.34/otcl-1.13:/usr/src/ns-allinone-2.34/lib:$LD_LIBRARY_PATH
export TCL_LIBRARY=/usr/src/ns-allinone-2.34/tcl8.4.18/library

Posted in Network Simulation | Tagged , | Leave a comment

How to run NS2 simulation

This post explains the method of running ns2 and important phases of simulating any network

Executable file ns created in the NS2 home directory after installing or recompiling NS2 can be invoked by executing the following statement from the shell:

$ ns [filename] [arguments], where [filename] and <arguments> are optional.

Without any argument the command will bring up an NS2 environment. NS2 waits to interpret commands from the standard input (i.e., keyboard) line-by-line.

If [filename] is present, NS2 will interpret the input script [filename] a tcl simulation script written according to tcl syntax.

Finally, the [arguments] separated by a white space are input to [filename].

Simulation Steps

Any simulation consists of three main phases: pre simulation, simulation and post simulation.

Phase 1: Pre Simulation

The first phase in simulating any network is to design or plan the simulation. In this phase the simulation purposes, network configuration and assumptions, network parameters, movement and traffic scenarios, the performance measures, and the type of expected results should be determined.

Phase 2: Simulation

This step implements the design of phase 1. It consists of two phases:

• Configuration phase: In this phase network components are created and configured according to the simulation design. Also, the events are scheduled to start at a certain time.

• Simulation Phase: This phase starts simulation configured in previous configuration phase. It maintains the simulation clock and executes events chronologically. This phase usually runs until the simulation clock reached a value specified in the configuration phase.

Phase 3: Post Simulation Processing

The main tasks in this phase include verifying the integrity of the program and evaluating the performance of the simulated network. While the first task is referred to as debugging and any debugger like gdb can be used. The second one can be achieved by collecting and compiling simulation results. During simulation trace files are generated and these trace file can be used to evaluate the performance of simulated network. Trace file can be processed by Awk (gawk) or perl.

Posted in Network Simulation | Tagged | Leave a comment

how to solve errors during installation of Mannasim in ns-allinone-2.34

This post list the errors occurred during installation of mannasim in ns-allinone-2.34 and also provide solution for them.

1.
mannasim/accessPointApp.o mannasim/accessPointApp.cc
In file included from mannasim/processing.h:44:0,
from mannasim/accessPointApp.h:45,
from mannasim/accessPointApp.cc:37:
mannasim/sensorNode.h:36:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/accessPointApp.o] Error 1
sol:
Go to mannasim/sensorNode.h
#ifndef __ns_sensornode_h__
#define __ns_sensornode_h__
#include
Comment and change this
//#include to
#include #include “app.h”
#include “mobilenode.h”
#include “battery.h”
2.
/diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o mannasim/accessPointApp.o mannasim/accessPointApp.cc
In file included from mannasim/processing.h:45:0,
from mannasim/accessPointApp.h:45,
from mannasim/accessPointApp.cc:37:
mannasim/sensedData.h:40:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/accessPointApp.o] Error 1
Sol.
Go to mannasim/sensedData.h
Comment and change these
//#include //#include
to
#include #include
#include
#include <common/ns-process.h>
3.
ffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o mannasim/accessPointApp.o mannasim/accessPointApp.cc
In file included from mannasim/processing.h:47:0,
from mannasim/accessPointApp.h:45,
from mannasim/accessPointApp.cc:37:
mannasim/dataGenerator.h:28:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/accessPointApp.o] Error 1
Sol.
Go to mannasim/dataGenerator.h
Comment and change this
//#include to
#include #include <tools/rng.h>
#include <common/ns-process.h>
#include “battery.h”
#include “sensorNode.h”
#include “sensorBaseApp.h”
#include “util/accounts.h”
4.
mannasim/onDemandData.o mannasim/onDemandData.cc
mannasim/onDemandData.cc: In constructor ‘OnDemandData::OnDemandData()’:
mannasim/onDemandData.cc:44:33: error: cannot call constructor ‘OnDemandData::OnDemandData’ directly [-fpermissive]
mannasim/onDemandData.cc:44:33: error: for a function-style cast, remove the redundant ‘::OnDemandData’ [-fpermissive]
make: *** [mannasim/onDemandData.o] Error 1
Sol.
Go to mannasim/onDemandData.cc
Comment the following lines
//OnDemandData :: OnDemandData()
//{
/// REAL request type is default.
//OnDemandData::OnDemandData(REAL);
//}
5.
mannasim/diffusion/commonNodeDiffApp.o mannasim/diffusion/commonNodeDiffApp.cc
In file included from mannasim/diffusion/commonNodeDiffApp.cc:9:0:
mannasim/diffusion/commonNodeDiffApp.h:6:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/diffusion/commonNodeDiffApp.o] Error 1
Sol.
Go to mannasim/diffusion/commonNodeDiffApp.h
#ifndef _COMMONNODEDIFFAPP_H_
#define _COMMONNODEDIFFAPP_H_
Comment and change this
//#include to
#include #include
#include “nrAttributes.h”
#include “attrsExporter.h”
#include “../commonNodeApp.h”
6.
/diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o mannasim/leach/rca/rca-ll.o mannasim/leach/rca/rca-ll.cc
mannasim/leach/rca/rca-ll.cc:13:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/leach/rca/rca-ll.o] Error 1
Sol.
Go to mannasim/leach/rca/rca-ll.cc
#include “delay.h”
//#include “object.h”
#include “packet.h”
//#include “debug.h”
Comment and change this
//#include “list.h”
to
#include “list”
#include “arp.h”
#include “topography.h”
#include “trace.h”
#include “node.h”
#include “mac.h”
#include “ll.h”
#include “mannasim/leach/rca/rca-ll.h”
#include “random.h”
7.
mannasim/leach/rca/rcagent.o mannasim/leach/rca/rcagent.cc
In file included from mannasim/leach/rca/rcagent.cc:7:0:
./mannasim/leach/app/leachApp.h:7:18: fatal error: list.h: No such file or directory compilation terminated.
make: *** [mannasim/leach/rca/rcagent.o] Error 1
Sol.
Go to ./mannasim/leach/app/leachApp.h
#define _LEACHAPP_H_
#include <mannasim/sensorBaseApp.h>
#include <mannasim/sensedData.h>
#include <scheduler.h>
Comment and change this
//#include <list.h>
to
#include <list>
#include <mannasim/leach/mac/mac-sensor.h>

Posted in mannasim | Tagged | Leave a comment

How to change default timeout and title in boot screen in dual bootable system

This post show how to change the default timeout period and title in dual bootable system.
1. Go to /boot/grub/grub.conf
2. open grub.conf
3. change timeout=5,title Fedora (2.6.38.6-26.rc1.fc15.i686.PAE) and title Other
4. reboot the system

Posted in linux | Tagged , | Leave a comment