Need "cmu-trace.h" wrt new trace format- with detailed total energy and breakdown in idle, sleep, transmit and receive modes

17 views
Skip to first unread message

SS

unread,
Apr 18, 2019, 1:03:25 PM4/18/19
to Network Simulator 2 (NS2)

Hi Knudfl Sir,

I changed my "cmu-trace.cc" on ns-2.29 for detailed energy bifurcation as mentioned below:

if (thisnode) {
        if (thisnode->energy_model()) {
            // log detailed energy consumption
            // total energy and breakdown in idle, sleep, transmit and receive modes
            sprintf(pt_->buffer() + offset,
                "[energy %f ei %.3f es %.3f et %.3f er %.3f] ",
                thisnode->energy_model()->energy(),
                thisnode->energy_model()->ei(),
                thisnode->energy_model()->es(),               
                thisnode->energy_model()->et(),
                thisnode->energy_model()->er());   
        }
        }


As per your suggestion in post #2,  on "https://www.linuxquestions.org/questions/linux-newbie-8/new-trace-ns2-with-energy-update-ei-es-et-er-4175608381/

I checked all mentioned ".tcl" files with term "newtrace". Then I configure n make in: ns-allinone-2.29/ns-2.29$ ./configure && make, no errors.

Kindly share complete "cmu-trace.h" as few lines you shared in post#7, in the same thread.


I got temp.tr file as old one:

s -t 64.633100200 -Hs 15 -Hd 10 -Ni 15 -Nx 5.19 -Ny 88.27 -Nz 0.00 -Ne 996.625890 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 15.2 -Id 17.0 -It cbr -Il 532 -If 0 -Ii 2480 -Iv 31 -Pn cbr -Pi 102 -Pf 0 -Po 2
r -t 64.635721970 -Hs 16 -Hd 16 -Ni 16 -Nx 243.32 -Ny 310.72 -Nz 0.00 -Ne 995.982202 -Nl MAC -Nw --- -Ma 13a -Md 10 -Ms 2 -Mt 800 -Is 15.1 -Id 16.0 -It cbr -Il 532 -If 0 -Ii 2478 -Iv 30 -Pn cbr -Pi 127 -Pf 2 -Po 2
s -t 64.635731970 -Hs 16 -Hd -2 -Ni 16 -Nx 243.32 -Ny 310.72 -Nz 0.00 -Ne 995.982202 -Nl MAC -Nw --- -Ma 0 -Md 2 -Ms 0 -Mt 0
N -t 64.635732 -n 7 -e 994.578931
N -t 64.635732 -n 14 -e 994.523443
N -t 64.635732 -n 9 -e 995.829031


and need like:

s 10.000000000 _1_ AGT  --- 15 tcp 40 [0 0 0 0] [energy 49.995780 ei 0.000 es 0.000 et 0.001 er 0.004] ------- [1:0 3:0 32 0] [0 0] 0 0
r 10.000000000 _1_ RTR  --- 15 tcp 40 [0 0 0 0] [energy 49.995780 ei 0.000 es 0.000 et 0.001 er 0.004] ------- [1:0 3:0 32 0] [0 0] 0 0
s 12.041819866 _7_ RTR  --- 21 message 32 [0 0 0 0] [energy 49.995780 ei 0.000 es 0.000 et 0.001 er 0.004] ------- [7:255 -1:255 32 0] 
N -t 12.042335 -n 4 -e 49.995514
N -t 12.042335 -n 13 -e 49.995514


Please help.


Thanks & Regards




knudfl

unread,
Apr 18, 2019, 4:25:08 PM4/18/19
to Network Simulator 2 (NS2)

SS

unread,
Apr 19, 2019, 3:52:16 PM4/19/19
to Network Simulator 2 (NS2)
Thanks sir,

I again extracted the "cmu-trace.h" from the link " https://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.29/" for ns-2.29.3 version, as you mentioned, but its same as I already have in my installed ns-2.29 version and its missing lines (104-112), as you mentioned in  post#7 -thread- "https://www.linuxquestions.org/questions/linux-newbie-8/new-trace-ns2-with-energy-update-ei-es-et-er-4175608381/ ":
cmu-trace.h-104-		PacketTracer();
cmu-trace.h-105-        	virtual ~PacketTracer();
cmu-trace.h-106-		void setNext(PacketTracer *next);
cmu-trace.h-107-		PacketTracer *getNext();
cmu-trace.h:108:		int format_unknow(Packet *p, int offset, BaseTrace *pt_, int newtrace);
cmu-trace.h-109-	protected:
cmu-trace.h:110:		virtual int format(Packet *p, int offset, BaseTrace *pt_, int newtrace) = 0;	//return 0 if the packet is unknown
cmu-trace.h-111-		PacketTracer *next_;
cmu-trace.h-112-};
--
cmu-trace.h-125-	char	tracename[MAX_ID_LEN + 1];
cmu-trace.h-126-	int	nodeColor[MAX_NODE];
cmu-trace.h-127-        int     tracetype;
cmu-trace.h-128-        MobileNode *node_;
cmu-trace.h:129:	int     newtrace_;
cmu-trace.h-130-
cmu-trace.h-131-	//<zheng: ns 2.27 removed the following part, but we need it to control the broadcast radius>
 
Ultimately, I need to have bifurcated energy values in my trace file like-   "[energy %f ei %.3f es %.3f et %.3f er %.3f] ". I have running installations of ns-2.29 and ans-2.35 with OLSR but even with newtrace mention in tcl script and in "cmu-trace.cc" its not displaying bifurcated energy levelas as mentioned in my first post.

Kindly suggest...

Thanks & Regards

knudfl

unread,
Apr 19, 2019, 7:19:12 PM4/19/19
to Network Simulator 2 (NS2)
Well, my mistake probably. 
...  is about NIST-mobile , so may be the lines are from  ns-2.29-nist-mob-022707.tgz ?

The file `cmu-trace.h´  is attached as  "nistmob.cmu-trace.h".
nistmob.cmu-trace.h

SS

unread,
Apr 22, 2019, 12:56:01 PM4/22/19
to Network Simulator 2 (NS2)
Its okay sir, but still the file "nistmob.cmu-trace.h" is same as `cmu-trace.h´ in ns-2.29.3 and does not have modifications (*...missing lines (104-112)...) as shared in my previous post.

Thanks & Regards

knudfl

unread,
Apr 22, 2019, 3:10:44 PM4/22/19
to Network Simulator 2 (NS2)
@SS

Could be ns-2.35
$ cd ns-2.35/trace/
$ grep
-in -A2 -B4 newtrace *.h
cmu
-trace.h-104-                PacketTracer();

knudfl

unread,
Apr 22, 2019, 3:24:45 PM4/22/19
to Network Simulator 2 (NS2)
Attached is cmu-trace.h,  as  ns235__cmu-trace.h





On Monday, April 22, 2019 at 6:56:01 PM UTC+2, SS wrote:
ns235__cmu-trace.h

shell s

unread,
Apr 22, 2019, 11:22:55 PM4/22/19
to ns-u...@googlegroups.com
Thanks Sir,

Yes, it has the modification.

Regards


--
You received this message because you are subscribed to the Google Groups "Network Simulator 2 (NS2)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-users+u...@googlegroups.com.
To post to this group, send email to ns-u...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages