Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If you want me send you modified ns-2.34 with LEACH Just send me email--> go to my name WSNs and left clike then send email ask about modified ns-2.34 with LEACH
Thank you
Click here to see the post LQ members have rated as the most helpful post in this thread.
Did you change "test" ? Please copy / paste the "test"
from post # 6, which is known to work.
Or did you use an MS - Windows app to copy or write
the test script, so is not UNIX text format any more ? ?
"" sleep: invalid time interval `2\r' "" looks like a formatting issue.
.....
Please, I need example of Leach protocole in ns2.34.Because the first example in leach-test is about opt(rp) dsdv.
Please Please Help my Help my Help my Please Please Please Please.
if you have installed leach in ns-2.34 and it works perfectly.
you will find exemple of leach with
./leach_test
in leach_test.tcl file you will find all parameters of simulation as number of nodes, initial energy and the protocole (algo=leach)
the results you find them in mit/leach_sims
leach.energy for energy of nodes during the simulation
leach.data the data receved by the base station for each node
leach.alive nodes stay alive
.
.
.
in MIT implementation there are four protocoles
leach
leach-c
MTE
Static clustering
you can choose the protocole with the modification of "alg" in leach_test.tcl
if you have installed leach in ns-2.34 and it works perfectly.
you will find exemple of leach with
./leach_test
in leach_test.tcl file you will find all parameters of simulation as number of nodes, initial energy and the protocole (algo=leach)
the results you find them in mit/leach_sims
leach.energy for energy of nodes during the simulation
leach.data the data receved by the base station for each node
leach.alive nodes stay alive
.
.
.
in MIT implementation there are four protocoles
leach
leach-c
MTE
Static clustering
you can choose the protocole with the modification of "alg" in leach_test.tcl
i'am using ns2.27 and when i excute the leach test i have some error
invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/ouerghi/Bureau/ns-allinone-2.27/ns-2.27/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/ouerghi/Bureau/ns-allinone-2.27/ns-2.27/mit/rca/resources/ns-energy-resource.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $env(RCA_LIBRARY)/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 18)
invoked from within
"source.orig mit/uAMPS/sims/uamps.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/sims/uamps.tcl"
(file "tcl/mobility/leach.tcl" line 18)
invoked from within
"source.orig tcl/mobility/leach.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)
i haven't this error the last night and i didn't modify any thing
if you have installed leach in ns-2.34 and it works perfectly.
you will find exemple of leach with
./leach_test
in leach_test.tcl file you will find all parameters of simulation as number of nodes, initial energy and the protocole (algo=leach)
the results you find them in mit/leach_sims
leach.energy for energy of nodes during the simulation
leach.data the data receved by the base station for each node
leach.alive nodes stay alive
.
.
.
in MIT implementation there are four protocoles
leach
leach-c
MTE
Static clustering
you can choose the protocole with the modification of "alg" in leach_test.tcl
i'am trying to write or excute an existing code without success
if you found how please tell me
thank you a lot
I have found this patch of gcc for ns-2.27. and also checked it. It works fine, ns-2.27 installed without error and then able to install the leach without error.
Code:
diff -uNr unmodified-ns-allinone-2.27/gt-itm/src/eval.c ns-allinone-2.27/gt-itm/src/eval.c
--- unmodified-ns-allinone-2.27/gt-itm/src/eval.c 2004-01-13 01:45:25.000000000 +0100
+++ ns-allinone-2.27/gt-itm/src/eval.c 2006-12-19 10:58:59.000000000 +0100
@@ -159,7 +159,7 @@
if (u == &dummy) {
if (verbose) {
if (artic_pt)
- printf(" and %d (this ends a connected
+ printf(" and %d (this ends a connected \
component of the graph)\n", idx(g, artic_pt));
else
printf("Isolated vertex %d\n", idx(g, v));
diff -uNr unmodified-ns-allinone-2.27/nam-1.10/agent.h ns-allinone-2.27/nam-1.10/agent.h
--- unmodified-ns-allinone-2.27/nam-1.10/agent.h 2004-01-13 01:53:29.000000000 +0100
+++ ns-allinone-2.27/nam-1.10/agent.h 2006-12-19 10:58:37.000000000 +0100
@@ -70,7 +70,7 @@
inline double width() {return width_;}
inline double height() {return height_;}
virtual void findClosestCornertoPoint(double x, double y,
- double &corner_x, double &corner_y) const = NULL;
+ double &corner_x, double &corner_y) const = 0;
virtual void place(double x, double y);
void label(const char* name, int anchor);
void color(const char* name);
diff -uNr unmodified-ns-allinone-2.27/nam-1.10/netgraph.h ns-allinone-2.27/nam-1.10/netgraph.h
--- unmodified-ns-allinone-2.27/nam-1.10/netgraph.h 2004-01-13 01:53:33.000000000 +0100
+++ ns-allinone-2.27/nam-1.10/netgraph.h 2006-12-19 10:57:29.000000000 +0100
@@ -68,7 +68,7 @@
virtual void handle(const TraceEvent&, double now, int direction);
virtual int command(int argc, const char *const *argv);
virtual void BoundingBox(BBox&);
- virtual void NetGraph::render(GraphView* view);
+ virtual void render(GraphView* view);
protected:
GraphView *views_;
float graphdata_[MAX_GRAPH];
diff -uNr unmodified-ns-allinone-2.27/nam-1.10/node.h ns-allinone-2.27/nam-1.10/node.h
--- unmodified-ns-allinone-2.27/nam-1.10/node.h 2004-01-13 01:53:34.000000000 +0100
+++ ns-allinone-2.27/nam-1.10/node.h 2006-12-19 10:57:29.000000000 +0100
@@ -223,7 +223,7 @@
Queue* queue() { return queue_; }
void add_sess_queue(unsigned int grp, Queue *q);
char * getTclScript();
- char * Node::getTclScriptLabel();
+ char * getTclScriptLabel();
void setTclScript(const char * label, const char * script);
int command(int argc, const char * const * argv);
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc 2004-01-13 01:57:58.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc 2006-12-19 10:57:29.000000000 +0100
@@ -370,7 +370,7 @@
INTF_INSERT(routing_table[dtype].active, OutPtr);
routing_table[dtype].num_active ++;
} else {
- GRAD_TMOUT(RetVal.cur) = max(GRAD_TMOUT(RetVal.cur),
+ GRAD_TMOUT(RetVal.cur) = MAX(GRAD_TMOUT(RetVal.cur),
dfh->ts_ + INTEREST_TIMEOUT);
}
@@ -789,7 +789,7 @@
if (RetVal.cur != NULL) {
cur_out = (Out_List *)(RetVal.cur);
GRADIENT(cur_out) = ORIGINAL;
- GRAD_TMOUT(RetVal.cur) = max(GRAD_TMOUT(RetVal.cur),
+ GRAD_TMOUT(RetVal.cur) = MAX(GRAD_TMOUT(RetVal.cur),
dfh->ts_ + INTEREST_TIMEOUT);
NUM_POS_RECV(cur_out)++;
} else {
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion/diffusion.cc ns-allinone-2.27/ns-2.27/diffusion/diffusion.cc
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion/diffusion.cc 2004-01-13 01:57:58.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion/diffusion.cc 2006-12-19 10:57:29.000000000 +0100
@@ -58,6 +58,8 @@
#include "god.h"
#include "routing_table.h"
+void XmitFailedCallback(Packet *pkt, void *data);
+
char *MsgStr[]= {"", "INTEREST", "DATA", "DATA_READY", "DATA_REQUEST",
"POS_REINFORCE", "NEG_REINFORCE", "INHIBIT", "TX_FAILED",
"DATA_STOP" };
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion/diffusion.h ns-allinone-2.27/ns-2.27/diffusion/diffusion.h
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion/diffusion.h 2004-01-13 01:57:58.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion/diffusion.h 2006-12-19 10:57:29.000000000 +0100
@@ -75,7 +75,7 @@
#define SEND_MESSAGE(x,y,z) send_to_dmux(prepare_message(x,y,z), 0)
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
class DiffusionAgent;
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion/omni_mcast.cc ns-allinone-2.27/ns-2.27/diffusion/omni_mcast.cc
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion/omni_mcast.cc 2004-01-13 01:57:59.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion/omni_mcast.cc 2006-12-19 10:57:29.000000000 +0100
@@ -59,6 +59,8 @@
#include "dsr/path.h"
#include "god.h"
+void OmniMcastXmitFailedCallback(Packet *pkt, void *data);
+
static class OmniMcastClass : public TclClass {
public:
OmniMcastClass() : TclClass("Agent/OmniMcast") {}
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc 2004-01-13 01:57:59.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc 2006-12-19 10:57:29.000000000 +0100
@@ -129,7 +129,7 @@
int most = 0;
for (cur=iif; cur!=NULL; cur = IN_NEXT(cur)) {
- most = max(most,NEW_ORG_RECV(cur));
+ most = MAX(most,NEW_ORG_RECV(cur));
}
return most;
}
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion3/filter_core/filter_core.hh ns-allinone-2.27/ns-2.27/diffusion3/filter_core/filter_core.hh
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion3/filter_core/filter_core.hh 2004-01-13 01:58:10.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion3/filter_core/filter_core.hh 2006-12-19 10:57:29.000000000 +0100
@@ -99,6 +99,7 @@
class DiffusionCoreAgent;
class HashEntry;
class NeighborEntry;
+class DiffRoutingAgent;
typedef list<NeighborEntry *> NeighborList;
typedef list<Tcl_HashEntry *> HashList;
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh
--- unmodified-ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh 2004-01-13 01:58:05.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh 2006-12-19 10:57:29.000000000 +0100
@@ -43,7 +43,8 @@
typedef signed int int32_t;
#endif
typedef signed short int16_t;
-#if defined (sparc)
+// #if defined (sparc)
+#if defined (__SVR4) && defined (__sun)
typedef char int8_t;
#else
// Conflicts with system declaration of int8_t in Solaris
@@ -221,6 +222,7 @@
};
// string specialization
+template <>
class NRSimpleAttribute<char *>: public NRAttribute {
public:
NRSimpleAttribute(int key, int type, int op, char *val, int size = 0);
@@ -236,6 +238,7 @@
};
// blob specialization
+template <>
class NRSimpleAttribute<void *>: public NRAttribute {
public:
NRSimpleAttribute(int key, int type, int op, void *val, int size);
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/dsr/dsragent.cc ns-allinone-2.27/ns-2.27/dsr/dsragent.cc
--- unmodified-ns-allinone-2.27/ns-2.27/dsr/dsragent.cc 2004-01-13 01:58:29.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/dsr/dsragent.cc 2006-12-19 10:57:29.000000000 +0100
@@ -188,6 +188,9 @@
*/
+void XmitFlowFailureCallback(Packet *pkt, void *data);
+void XmitFailureCallback(Packet *pkt, void *data);
+
/*===========================================================================
SendBuf management and helpers
---------------------------------------------------------------------------*/
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in
--- unmodified-ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in 2004-01-13 01:58:39.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in 2006-12-19 10:57:29.000000000 +0100
@@ -37,7 +37,7 @@
MKDEP = ../../../conf/mkdep
# when including files from ns, we need to take care STL_NAMESPACE
-DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@
+DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
CFLAGS = @V_CCOPT@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB@ -lm @LIBS@
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/setdest.h ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/setdest.h
--- unmodified-ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/setdest.h 2004-01-13 01:58:39.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/setdest.h 2006-12-19 10:57:29.000000000 +0100
@@ -23,20 +23,20 @@
return sqrt(X*X + Y*Y + Z*Z);
}
- 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);
}
inline vector operator-(const vector a) {
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in
--- unmodified-ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in 2004-01-13 01:58:44.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in 2006-12-19 10:57:29.000000000 +0100
@@ -38,7 +38,7 @@
# when including files from ns, we need to take care STL_NAMESPACE
CC = @CXX@
INCLUDE = -I. @V_INCLUDES@
-CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@
+CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB_TCL@ @V_LIB@ @LIBS@
INSTALL = @INSTALL@
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in
--- unmodified-ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in 2004-01-13 01:58:48.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in 2006-12-19 10:57:29.000000000 +0100
@@ -35,7 +35,7 @@
# when including files from ns, we need to take care STL_NAMESPACE
CC = @CXX@
INCLUDE = -I. -I../../.. @V_INCLUDES@
-CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@
+CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB_TCL@ @V_LIB@ @LIBS@
INSTALL = @INSTALL@
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/linkstate/ls.h ns-allinone-2.27/ns-2.27/linkstate/ls.h
--- unmodified-ns-allinone-2.27/ns-2.27/linkstate/ls.h 2004-01-13 01:59:00.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/linkstate/ls.h 2006-12-19 10:57:29.000000000 +0100
@@ -86,7 +86,7 @@
LsList() : baseList() {}
LsList(const _Tp& x) : baseList(1, x) {}
void eraseAll() {
- baseList::erase(begin(), end());
+ baseList::erase(baseList::begin(), baseList::end());
}
LsList<_Tp>& operator= (const LsList<_Tp> & x) {
return (LsList<_Tp> &)baseList::operator= (x);
@@ -109,7 +109,7 @@
return ib.second ? ib.first : baseMap::end();
}
- void eraseAll() { erase(begin(), end()); }
+ void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
T* findPtr(Key key) {
iterator it = baseMap::find(key);
return (it == baseMap::end()) ? (T *)NULL : &((*it).second);
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc
--- unmodified-ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc 2004-01-13 01:59:15.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc 2006-12-19 10:57:29.000000000 +0100
@@ -55,7 +55,7 @@
#include "diffusion/diff_header.h"
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
void Idle_Timer::expire(Event *) {
a_->UpdateIdleEnergy();
@@ -200,8 +200,8 @@
if (em()->energy() > 0) {
//double txtime = (8.*hdr_cmn::access(p)->size())/bandwidth_;
double txtime = hdr_cmn::access(p)->txtime();
- double start_time = max(channel_idle_time_, NOW);
- double end_time = max(channel_idle_time_, NOW+txtime);
+ double start_time = MAX(channel_idle_time_, NOW);
+ double end_time = MAX(channel_idle_time_, NOW+txtime);
double actual_txtime = end_time-start_time;
if (start_time > update_energy_time_) {
@@ -220,7 +220,7 @@
*/
// Sanity check
- double temp = max(NOW,last_send_time_);
+ double temp = MAX(NOW,last_send_time_);
/*
if (NOW < last_send_time_) {
@@ -228,8 +228,8 @@
}
*/
- double begin_adjust_time = min(channel_idle_time_, temp);
- double finish_adjust_time = min(channel_idle_time_, NOW+txtime);
+ double begin_adjust_time = MIN(channel_idle_time_, temp);
+ double finish_adjust_time = MIN(channel_idle_time_, NOW+txtime);
double gap_adjust_time = finish_adjust_time - begin_adjust_time;
if (gap_adjust_time < 0.0) {
fprintf(stderr,"What the heck ! negative gap time.\n");
@@ -354,8 +354,8 @@
em()->DecrRcvEnergy(rcvtime,Pr_consume_);
*/
- double start_time = max(channel_idle_time_, NOW);
- double end_time = max(channel_idle_time_, NOW+rcvtime);
+ double start_time = MAX(channel_idle_time_, NOW);
+ double end_time = MAX(channel_idle_time_, NOW+rcvtime);
double actual_rcvtime = end_time-start_time;
if (start_time > update_energy_time_) {
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/mobile/god.cc ns-allinone-2.27/ns-2.27/mobile/god.cc
--- unmodified-ns-allinone-2.27/ns-2.27/mobile/god.cc 2004-01-13 01:59:06.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/mobile/god.cc 2006-12-19 10:57:29.000000000 +0100
@@ -645,7 +645,7 @@
for(i = 0; i < num_nodes; i++) {
for(j = 0; j < num_nodes; j++) {
for(k = 0; k < num_nodes; k++) {
- MIN_HOPS(j,k) = min(MIN_HOPS(j,k), MIN_HOPS(j,i) + MIN_HOPS(i,k));
+ MIN_HOPS(j,k) = MIN(MIN_HOPS(j,k), MIN_HOPS(j,i) + MIN_HOPS(i,k));
}
}
}
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/mobile/god.h ns-allinone-2.27/ns-2.27/mobile/god.h
--- unmodified-ns-allinone-2.27/ns-2.27/mobile/god.h 2004-01-13 01:59:06.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/mobile/god.h 2006-12-19 10:57:29.000000000 +0100
@@ -85,20 +85,20 @@
return sqrt(X*X + Y*Y + Z*Z);
}
- 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);
}
inline vector operator-(const vector a) {
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc
--- unmodified-ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc 2004-01-13 01:59:06.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc 2006-12-19 10:57:29.000000000 +0100
@@ -133,7 +133,7 @@
endy = mn->destY();
if (vx > 0) {
- endi = min(dim_x_-1, (int)endx);
+ endi = MIN(dim_x_-1, (int)endx);
for (i = (int)x+1; i <= endi; i++) {
tm = (i-x)/vx;
pother = vy*tm + y;
@@ -182,7 +182,7 @@
}
}
if (vy > 0) {
- endi = min(dim_y_-1, (int)endy);
+ endi = MIN(dim_y_-1, (int)endy);
for (j = (int)y+1; j <= endi; j++) {
tm = (j-y)/vy;
pother = vx*tm + x;
@@ -237,11 +237,11 @@
adj = (int)ceil(mnr);
- ulx = min(dim_x_-1, grid_x + adj);
- uly = min(dim_y_-1, grid_y + adj);
- lly = max(0, grid_y - adj);
+ ulx = MIN(dim_x_-1, grid_x + adj);
+ uly = MIN(dim_y_-1, grid_y + adj);
+ lly = MAX(0, grid_y - adj);
- for (i = max(0, grid_x - adj); i <= ulx; i++) {
+ for (i = MAX(0, grid_x - adj); i <= ulx; i++) {
for (j = lly; j <= uly; j++) {
for (pgd = grid_[i][j]; pgd != 0; pgd = pgd->next()) {
if (mn->address() == pgd->address())
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h
--- unmodified-ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h 2004-01-13 01:59:06.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h 2006-12-19 10:57:29.000000000 +0100
@@ -13,8 +13,8 @@
#include "mobilenode.h"
-#define min(a,b) (((a)>(b))?(b):(a))
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MIN(a,b) (((a)>(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
#define aligngrid(a,b) (((a)==(b))?((b)-1):((a)))
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-agent.cc ns-allinone-2.27/ns-2.27/pgm/pgm-agent.cc
--- unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-agent.cc 2004-01-13 01:57:52.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/pgm/pgm-agent.cc 2006-12-19 10:57:29.000000000 +0100
@@ -275,7 +275,7 @@
void print_stats();
- void PgmAgent::trace_event(char *evType, double evTime);
+ void trace_event(char *evType, double evTime);
#ifdef PGM_DEBUG
void display_packet(Packet *pkt);
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-receiver.cc ns-allinone-2.27/ns-2.27/pgm/pgm-receiver.cc
--- unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-receiver.cc 2004-01-13 01:57:53.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/pgm/pgm-receiver.cc 2006-12-19 10:57:29.000000000 +0100
@@ -154,7 +154,7 @@
void print_stats();
void display_packet(Packet *pkt); // For debugging.
- void PgmReceiver::trace_event(char *evType, double evTime);
+ void trace_event(char *evType, double evTime);
EventTrace * et_; //Trace Object for Custom Event Trace
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-sender.cc ns-allinone-2.27/ns-2.27/pgm/pgm-sender.cc
--- unmodified-ns-allinone-2.27/ns-2.27/pgm/pgm-sender.cc 2004-01-13 01:57:53.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/pgm/pgm-sender.cc 2006-12-19 10:57:29.000000000 +0100
@@ -157,7 +157,7 @@
void display_packet(Packet *pkt); // For debugging.
- void PgmSender::trace_event(char *evType, nsaddr_t daddr, double evTime);
+ void trace_event(char *evType, nsaddr_t daddr, double evTime);
EventTrace * et_; //Trace Object for custom Event Traces
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/queue/cbq.cc ns-allinone-2.27/ns-2.27/queue/cbq.cc
--- unmodified-ns-allinone-2.27/ns-2.27/queue/cbq.cc 2004-01-13 01:58:58.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/queue/cbq.cc 2006-12-19 10:57:29.000000000 +0100
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/queue/cbq.cc,v 1.27 2000/09/01 03:04:05 haoboy Exp $ (LBL)";
+ "@(#) $Header: /nfs/jade/vint/CVSROOT/ns-2/queue/cbq.cc,v 1.28 2005/07/27 01:13:44 tomh Exp $ (LBL)";
#endif
@@ -87,6 +87,8 @@
#define LEAF_LEVEL 1 /* level# for leaves */
#define POWEROFTWO 16
+class CBQueue;
+
class CBQClass : public Connector {
public:
friend class CBQueue;
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/sctp/sctp.cc ns-allinone-2.27/ns-2.27/sctp/sctp.cc
--- unmodified-ns-allinone-2.27/ns-2.27/sctp/sctp.cc 2004-01-13 01:57:35.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/sctp/sctp.cc 2006-12-19 10:57:29.000000000 +0100
@@ -151,7 +151,7 @@
Packet::free(spDest->opRoutingAssistPacket);
spDest->opRoutingAssistPacket = NULL;
delete (SctpDest_S *) spCurrNode->vpData; //spDest
- (SctpDest_S *) spCurrNode->vpData = NULL;
+ spCurrNode->vpData = NULL;
}
if(spSctpTrace != NULL)
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/sctp/sctp.h ns-allinone-2.27/ns-2.27/sctp/sctp.h
--- unmodified-ns-allinone-2.27/ns-2.27/sctp/sctp.h 2004-01-13 01:57:35.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/sctp/sctp.h 2006-12-19 10:57:29.000000000 +0100
@@ -629,7 +629,7 @@
/* debugging functions
*/
- void SctpAgent::DumpSendBuffer();
+ void DumpSendBuffer();
/* sctp association state variable
*/
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/tcp/tcp-sack-rh.cc ns-allinone-2.27/ns-2.27/tcp/tcp-sack-rh.cc
--- unmodified-ns-allinone-2.27/ns-2.27/tcp/tcp-sack-rh.cc 2004-01-13 01:54:01.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/tcp/tcp-sack-rh.cc 2006-12-19 10:57:29.000000000 +0100
@@ -65,7 +65,7 @@
virtual void estadjust();
virtual void rhclear();
virtual void computefack();
- virtual void SackRHTcpAgent::newack(Packet* pkt);
+ virtual void newack(Packet* pkt);
protected:
int fack_; /* the FACK state variable */
int retran_data_; /* the number of retransmitted packets in the pipe */
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/tora/tora.cc ns-allinone-2.27/ns-2.27/tora/tora.cc
--- unmodified-ns-allinone-2.27/ns-2.27/tora/tora.cc 2004-01-13 01:53:55.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/tora/tora.cc 2006-12-19 10:57:29.000000000 +0100
@@ -182,7 +182,7 @@
{
TORADest *td = dstlist.lh_first;
- for( ; td; td = td = td->link.le_next)
+ for( ; td; td = td->link.le_next)
td->dump();
}
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/tora/tora_neighbor.h ns-allinone-2.27/ns-2.27/tora/tora_neighbor.h
--- unmodified-ns-allinone-2.27/ns-2.27/tora/tora_neighbor.h 2004-01-13 01:53:55.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/tora/tora_neighbor.h 2006-12-19 10:57:29.000000000 +0100
@@ -35,12 +35,14 @@
/* -*- c++ -*-
tora_neighbor.h
- $Id: tora_neighbor.h,v 1.2 1999/08/12 21:12:36 yaxu Exp $
+ $Id: tora_neighbor.h,v 1.3 2005/07/27 01:13:45 tomh Exp $
*/
#ifndef __tora_neighbor_h__
#define __tora_neighbor_h__
+class toraAgent;
+
enum LinkStatus {
LINK_UP = 0x0001, // upstream
LINK_DN = 0x0002, // downstream
diff -uNr unmodified-ns-allinone-2.27/ns-2.27/webcache/webtraf.cc ns-allinone-2.27/ns-2.27/webcache/webtraf.cc
--- unmodified-ns-allinone-2.27/ns-2.27/webcache/webtraf.cc 2004-01-13 01:53:52.000000000 +0100
+++ ns-allinone-2.27/ns-2.27/webcache/webtraf.cc 2006-12-19 10:57:29.000000000 +0100
@@ -412,8 +412,11 @@
nServer_ = atoi(argv[2]);
if (server_ != NULL)
delete []server_;
- server_ = new WebServer[nServer_](this);
-
+ server_ = (WebServer*) malloc(nServer_ * sizeof(WebServer));
+ WebServer tmp(this);
+ for (int i = 0; i < nServer_; i++) {
+ memcpy(&server_[i], &tmp, sizeof(WebServer));
+ }
return (TCL_OK);
} else if (strcmp(argv[1], "set-num-client") == 0) {
nClient_ = atoi(argv[2]);
diff -uNr unmodified-ns-allinone-2.27/otcl-1.8/configure ns-allinone-2.27/otcl-1.8/configure
--- unmodified-ns-allinone-2.27/otcl-1.8/configure 2004-01-13 02:00:00.000000000 +0100
+++ ns-allinone-2.27/otcl-1.8/configure 2006-12-19 10:57:29.000000000 +0100
@@ -4164,7 +4164,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
echo "$as_me:4169: result: $system" >&5
echo "${ECHO_T}$system" >&6
diff -uNr unmodified-ns-allinone-2.27/tcl8.4.5/unix/configure ns-allinone-2.27/tcl8.4.5/unix/configure
--- unmodified-ns-allinone-2.27/tcl8.4.5/unix/configure 2004-01-13 01:48:39.000000000 +0100
+++ ns-allinone-2.27/tcl8.4.5/unix/configure 2006-12-19 10:57:29.000000000 +0100
@@ -5497,7 +5497,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print }' /etc/.relid'`
+ system=MP-RAS-`awk '{print }' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
@@ -7052,7 +7052,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print }' /etc/.relid'`
+ system=MP-RAS-`awk '{print }' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
diff -uNr unmodified-ns-allinone-2.27/tcl8.4.5/unix/tcl.m4 ns-allinone-2.27/tcl8.4.5/unix/tcl.m4
--- unmodified-ns-allinone-2.27/tcl8.4.5/unix/tcl.m4 2004-01-13 01:48:42.000000000 +0100
+++ ns-allinone-2.27/tcl8.4.5/unix/tcl.m4 2006-12-19 10:57:29.000000000 +0100
@@ -774,7 +774,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
@@ -2105,7 +2105,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
diff -uNr unmodified-ns-allinone-2.27/tclcl-1.15/tclcl.h ns-allinone-2.27/tclcl-1.15/tclcl.h
--- unmodified-ns-allinone-2.27/tclcl-1.15/tclcl.h 2004-01-13 01:52:09.000000000 +0100
+++ ns-allinone-2.27/tclcl-1.15/tclcl.h 2006-12-19 10:57:29.000000000 +0100
@@ -45,7 +45,7 @@
}
#include "tclcl-config.h"
-#include "tclcl-mappings.h"
+// #include "tclcl-mappings.h"
#include "tracedvar.h"
struct Tk_Window_;
@@ -158,6 +158,8 @@
Tcl_HashTable objs_;
};
+#include "tclcl-mappings.h"
+
class InstVar;
class TclObject {
diff -uNr unmodified-ns-allinone-2.27/tk8.4.5/unix/configure ns-allinone-2.27/tk8.4.5/unix/configure
--- unmodified-ns-allinone-2.27/tk8.4.5/unix/configure 2004-01-13 01:43:26.000000000 +0100
+++ ns-allinone-2.27/tk8.4.5/unix/configure 2006-12-19 10:57:29.000000000 +0100
@@ -1955,7 +1955,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print }' /etc/.relid'`
+ system=MP-RAS-`awk '{print }' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
diff -uNr unmodified-ns-allinone-2.27/tk8.4.5/unix/tcl.m4 ns-allinone-2.27/tk8.4.5/unix/tcl.m4
--- unmodified-ns-allinone-2.27/tk8.4.5/unix/tcl.m4 2004-01-13 01:43:27.000000000 +0100
+++ ns-allinone-2.27/tk8.4.5/unix/tcl.m4 2006-12-19 10:57:29.000000000 +0100
@@ -774,7 +774,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
@@ -2105,7 +2105,7 @@
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
- system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+ system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517
Rep:
Post #84 , @ urashu06 , welcome to LQ.
Yes, the name of the patch is ns-2.27-gcc410.patch,
and there is a link to it in one of the posts : #41.
It isn't always working, using g++-4.1.x / gcc-4.1.x.
Are you telling, that it works in Ubuntu ?
Which Ubuntu version ? And which compiler did you use ?
EDIT : There is an answer from @urashu06 in post # 101.
..
if you have installed leach in ns-2.34 and it works perfectly.
you will find exemple of leach with
./leach_test
in leach_test.tcl file you will find all parameters of simulation as number of nodes, initial energy and the protocole (algo=leach)
the results you find them in mit/leach_sims
leach.energy for energy of nodes during the simulation
leach.data the data receved by the base station for each node
leach.alive nodes stay alive
.
.
.
in MIT implementation there are four protocoles
leach
leach-c
MTE
Static clustering
you can choose the protocole with the modification of "alg" in leach_test.tcl
When I change alg to leach-c but the resulta(leach.energy, leach.data, leach.alive) of leach-c = leach.
in wireless.tcl you will find the creation of nodes for leach, leach-c, mte... in "leach-create-mobile-node"
in uamps.tcl you will find that this methode call sens_gather_stats developped in stats.tcl
in stats.tcl you will find the creation of files leach.alive ...
that means that the results of leach, leach-c,.... you find it in this files.
in wireless.tcl you will find the creation of nodes for leach, leach-c, mte... in "leach-create-mobile-node"
in uamps.tcl you will find that this methode call sens_gather_stats developped in stats.tcl
in stats.tcl you will find the creation of files leach.alive ...
that means that the results of leach, leach-c,.... you find it in this files.
Can anyone please explain me in detail how clusterheads and clusters are formed in LEACH-C
What are the x and y coordinates i should take for the base station in simulation of LEACH-C. Actually LEACH-C performs very well compare to LEACH, but it happens that the the simulation is completing after 360 rounds for 100 nodes(with 5 nodes being alive ) in LEACH-C where it is 520 rounds for 100 nodes in LEACH..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.