LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-05-2011, 05:29 AM   #16
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0

hello every body

I'm doing my research based on leader election algorithms for wireless sensor network, may any one who knows other leader election algorithms help me with it installation packages and instruction so that I can add it on ns2.34.

Thank you.
 
Old 05-06-2011, 12:00 AM   #17
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Quote:
Originally Posted by keepwalking View Post
hello every body

I'm doing my research based on leader election algorithms for wireless sensor network, may any one who knows other leader election algorithms help me with it installation packages and instruction so that I can add it on ns2.34.

Thank you.
Hello ... What do you mean by leader selection algorithm ? Do you mean cluster heads as in LEACH ?
 
Old 05-08-2011, 01:58 AM   #18
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0
@deepa_2111

Yes I mean cluster heads as in LEACH
thanks
 
Old 05-10-2011, 12:07 PM   #19
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Hmm ...

I am finding a lot of discrepancies with the actual LEACH paper. For example, the avg energy/round plot for different clusters. After porting, I find that the values are 5 times that in the LEACH paper. Do you guys have the same findings ? Can you post your plots if you have ?
 
Old 05-10-2011, 06:46 PM   #20
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
What did you want help with ? Adding LEACH code to ns-2 ?

Quote:
Originally Posted by keepwalking View Post
@deepa_2111

Yes I mean cluster heads as in LEACH
thanks
 
Old 05-11-2011, 02:17 AM   #21
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0
adding LEACH to Ns2.34
when I'm using the make command I get the following error:

Code:
trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$ ns
ns: command not found
can any one help me to to solve this problem.
 
Old 05-11-2011, 08:08 AM   #22
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Quote:
Originally Posted by keepwalking View Post
adding LEACH to Ns2.34
when I'm using the make command I get the following error:

Code:
trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$ ns
ns: command not found
can any one help me to to solve this problem.
That is because the format_rca declaration has not been added to cmu-trace.h file. Add the code in #ifdef ... #endif
Code:
...
void	format_tora(Packet *p, int offset);
        void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
	void    format_aomdv(Packet *p, int offset);
#ifdef MIT_uAMPS
	void    format_rca(Packet *p, int offset);
#endif
 
Old 05-12-2011, 08:02 AM   #23
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0
hey Deepa 2111

I have added the code you said I must add but it still shows the same error. Please look at this code below for class cmu-trace.h

Code:
/* -*-	Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*-
 *
 * Copyright (c) 1997 Regents of the University of California.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the Computer Systems
 *	Engineering Group at Lawrence Berkeley Laboratory.
 * 4. Neither the name of the University nor of the Laboratory may be used
 *    to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $Header: /cvsroot/nsnam/ns-2/trace/cmu-trace.h,v 1.28 2009/01/15 06:23:49 tom_henderson Exp $
 */

/* Ported from CMU/Monarch's code, nov'98 -Padma.*/

#ifndef __cmu_trace__
#define __cmu_trace__

#include "trace.h"
#include "god.h"

#ifndef __PRETTY_FUNCTION__
#define __PRETTY_FUNCTION__ ("")
#endif /* !__PRETTY_FUNCTION__ */

/* ======================================================================
   Global Defines
   ====================================================================== */
#define	DROP            'D'
#define	RECV            'r'
#define	SEND    	's'
#define	FWRD    	'f'

// change wrt Mike's code
#define EOT             'x'



#define TR_ROUTER	0x01
#define TR_MAC		0x02
#define TR_IFQ		0x04
#define TR_AGENT	0x08

#define TR_PHY		0x10

#define DROP_END_OF_SIMULATION		"END"
#define	DROP_MAC_COLLISION		"COL"
#define DROP_MAC_DUPLICATE		"DUP"
#define DROP_MAC_PACKET_ERROR		"ERR"
#define DROP_MAC_RETRY_COUNT_EXCEEDED	"RET"
#define DROP_MAC_INVALID_STATE		"STA"
#define DROP_MAC_BUSY			"BSY"
#define DROP_MAC_INVALID_DST            "DST"
#define DROP_MAC_SLEEP                  "SLP"   // smac sleep state

#define DROP_RTR_NO_ROUTE		"NRTE"  // no route
#define DROP_RTR_ROUTE_LOOP		"LOOP"  // routing loop
#define DROP_RTR_TTL                    "TTL"   // ttl reached zero
#define DROP_RTR_QFULL                  "IFQ"   // queue full
#define DROP_RTR_QTIMEOUT               "TOUT"  // packet expired
#define DROP_RTR_MAC_CALLBACK           "CBK"   // MAC callback
#define DROP_RTR_SALVAGE	        "SAL"

#define DROP_IFQ_QFULL                  "IFQ"   // no buffer space in IFQ
#define DROP_IFQ_ARP_FULL               "ARP"   // dropped by ARP
#define DROP_IFQ_FILTER                 "FIL"

#define DROP_OUTSIDE_SUBNET             "OUT"   // dropped by base stations if received rtg updates from nodes outside its domain.

#define MAX_ID_LEN	3
#define MAX_NODE	4096

/**
 * This class allows a dynamic library to define the tracing format
 * for newly defined packet types 
 * 
 */
class PacketTracer
{
	public:
		PacketTracer();
        	virtual ~PacketTracer();
		void setNext(PacketTracer *next);
		PacketTracer *getNext();
		int format_unknow(Packet *p, int offset, BaseTrace *pt_, int newtrace);
	protected:
		virtual int format(Packet *p, int offset, BaseTrace *pt_, int newtrace) = 0;	//return 0 if the packet is unknown
		PacketTracer *next_;
};


class CMUTrace : public Trace {
public:
	CMUTrace(const char *s, char t);
	void	recv(Packet *p, Handler *h);
	void	recv(Packet *p, const char* why);

	static void addPacketTracer(PacketTracer *pt);


private:
	char	tracename[MAX_ID_LEN + 1];
	int	nodeColor[MAX_NODE];
        int     tracetype;
        MobileNode *node_;
	int     newtrace_;

	//<zheng: ns 2.27 removed the following part, but we need it to control the broadcast radius>
        static double  bradius;
        static double  radius_scaling_factor_;
        static double  duration_scaling_factor_;
        static void calculate_broadcast_parameters();
	//</zheng>

        int initialized() { return node_ && 1; }
	int node_energy();
	int	command(int argc, const char*const* argv);
	void	format(Packet *p, const char *why);

        void    nam_format(Packet *p, int offset);

	void	format_phy(Packet *p, int offset);
	
	void	format_mac_common(Packet *p, const char *why, int offset);
	void    format_mac(Packet *p, int offset);
	void    format_smac(Packet *p, int offset);
	void	format_ip(Packet *p, int offset);

	void	format_arp(Packet *p, int offset);
	void    format_hdlc(Packet *p, int offset);
	void	format_dsr(Packet *p, int offset);
	void	format_msg(Packet *p, int offset);
	void	format_tcp(Packet *p, int offset);
	void    format_sctp(Packet *p, int offset);
	void	format_rtp(Packet *p, int offset);
	void	format_tora(Packet *p, int offset);
        void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
	void    format_aomdv(Packet *p, int offset);
#ifdef MIt_uAMPS
	void format_impe(Packet *p, int offset);
#endif

	// This holds all the tracers added at run-time
	static PacketTracer *pktTrc_;

};

#endif /* __cmu_trace__ */
 
Old 05-12-2011, 08:40 AM   #24
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Hey !

You have not added the format_rca declaration. You have added a "format_impe" declaration. This maybe why the error still persists.
i am not sure if the #ifdef is case sensitive. If it is, change "MIt_uAMPS" to "MIT_uAMPS"

Quote:
Originally Posted by keepwalking View Post
hey Deepa 2111

I have added the code you said I must add but it still shows the same error. Please look at this code below for class cmu-trace.h

Code:
        void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
	void    format_aomdv(Packet *p, int offset);
#ifdef MIt_uAMPS
	void format_impe(Packet *p, int offset);
#endif

	// This holds all the tracers added at run-time
	static PacketTracer *pktTrc_;

};

#endif /* __cmu_trace__ */
 
Old 05-16-2011, 01:54 AM   #25
keepwalking
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 0
Thank deepa 2111 for helping me to so out the problem for cra format.

now it gives me the following error and may you please help me to solve this problem.

Code:
trace/cmu-trace.cc:48:17: error: rca.h: No such file or directory
trace/cmu-trace.cc: In member function ‘void CMUTrace::format_rca(Packet*, int)’:
trace/cmu-trace.cc:1532: error: ‘ADV_CHAR’ was not declared in this scope
trace/cmu-trace.cc:1536: error: ‘REQ_CHAR’ was not declared in this scope
trace/cmu-trace.cc:1540: error: ‘DATA_CHAR’ was not declared in this scope
make: *** [trace/cmu-trace.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$
 
Old 05-16-2011, 04:18 PM   #26
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
@ Keepwalking,

Pls check out this link ::

http://www.linuxquestions.org/questi...368/page4.html

I have answered this question there
 
Old 05-17-2011, 08:18 AM   #27
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Keepwalking,

I got your mail. you said
Quote:
and when I'm running the ./test command it says permission denied can you please help me to solve this problem.
I had this problem when I didn't have admin privileges to modify the folders. I guess that is the problem you have too .
 
Old 06-04-2011, 02:11 AM   #28
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 179

Rep: Reputation: 268Reputation: 268Reputation: 268
Does ns2.1b5 also show similar results ????

Quote:
Originally Posted by MayTamer View Post
The total energy and other statistics are calculated through the tcl file "/mit/uAMPS/stats.tcl". the reason for this unreasonable value is that the expended energy of the node is added to the total energy even when the node is dead, while it should be zero. you can check the individual expended energies by reviewing the output file "leach.energy", so you need to check the status of the current node if it's still alive. otherwise the expended value should be zero.
 
Old 06-15-2011, 10:05 AM   #29
asrmaster
LQ Newbie
 
Registered: Feb 2011
Posts: 5

Rep: Reputation: 0
Question Inconsistent results

Hi Deepa,

Thanks for your reply, it solved the problem of calculating the energy consumption.

But I still see problems in the results. For ns-2.1b5 simulation results are approximately as follows:

Parameters:
energy: 2j energy per node;
number of nodes: 100;
network area: 100m x 100m;
number of clusters: 5;
distance from the base station: 75m;

Approximate results in ns-2.1b5:
Lifetime: 560
Amount of data being sent: between 62,000 and 64,000;

Approximate results in ns-2.34:
Lifetime: between 480 and 550;
Amount of data being sent: between 45000 and 55000;

That is, the ns-2.34 the results have a greater sway, with much variation. While ns-2.1b5, the results vary less. Moreover, ns-2.1b5, the results are better than the ns-2.34.

Does anyone know how to explain these differences?

NOTE: Please disregard any typos because my English is not very good.

Quote:
Originally Posted by deepa_2111 View Post
Hello ,

Thanks for ur replies. I modified the code as well ::

In \mac\Wireless-Phy.cc:
Code:
if (energy_)
	  { 
		if(alive_ != 0) // Deepa
		{
			if (energy_->remove(pktEnergy(Pt_, PXcvr_, ch->size())) != 0) 
			{
		  		printf("alive = 0\n");
		  		alive_ = 0;
			}
		} // Deepa
	  }
i.e., add the <code> if(alive_ != 0) </code> wherever the remove energy function is called,

and in mit\rca\energy.cc :
Code:
int EnergyResource::remove(double amount)
{
  double new_level = energy_level_ - amount;

  if(new_level >= 0 )
  {
  	energy_level_ = new_level;
  	expended_ += amount;
  } // Deepa
check if the new_level is greater or equal to 0. if it is not, energy cant be removed
 
Old 06-15-2011, 12:58 PM   #30
asrmaster
LQ Newbie
 
Registered: Feb 2011
Posts: 5

Rep: Reputation: 0
Complementing, the network consumption in LEACH-C, running on the ns-2.1b5, is around 198j (without your changes in WirelessPhy.cc and Energy.cc) to 100 nodes, with 2j energy, ie it is calculated correctly.
 
  


Reply

Tags
leach, leach-ns235, ns2, tcl-pp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to install leach patch in ns2.34 in ubuntu 9.10 anjon.sunny Linux - Newbie 9 04-30-2014 04:05 AM
installing leach patch in ns2.34 in ubuntu9.10 g_vaibh Ubuntu 13 04-29-2014 05:17 PM
LEACH protocol installation on NS2.27 Scofield Linux - General 255 03-08-2012 05:19 PM
Leach Installation on NS2 Asmaa Seyam Linux - General 3 10-19-2010 12:31 PM
[SOLVED] NS2 LEACH make problem dkpcad Linux - Wireless Networking 2 10-02-2010 09:04 AM


All times are GMT -5. The time now is 12:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration