LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 06-10-2011, 03:20 AM   #1
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Rep: Reputation: 2
File Trace NS-2 and Program AWK.


This is a trace-all the files so that you can imagine my trace file format.

Code:
+ 0.1 1 0 cbr 164 ------- 1 1.0 0.0 0 0
- 0.1 1 0 cbr 164 ------- 1 1.0 0.0 0 0
r 0.111312 1 0 cbr 164 ------- 1 1.0 0.0 0 0
+ 0.111312 0 4 DTNBundle 164 ------- 1 0.0 4.0 -1 1
- 0.111312 0 4 DTNBundle 164 ------- 1 0.0 4.0 -1 1
+ 0.111312 0 1 DTNBundle 73 ------- 3 0.0 1.0 -1 2
- 0.111312 0 1 DTNBundle 73 ------- 3 0.0 1.0 -1 2
+ 0.112312 0 1 DTNBundle 81 ------- 2 0.0 1.0 -1 3
- 0.112312 0 1 DTNBundle 81 ------- 2 0.0 1.0 -1 3
+ 0.1125 1 0 cbr 164 ------- 1 1.0 0.0 0 4
- 0.1125 1 0 cbr 164 ------- 1 1.0 0.0 0 4
r 0.121896 0 1 DTNBundle 73 ------- 3 0.0 1.0 -1 2
+ 0.121896 1 0 cbr 72 ------- 4 1.0 0.0 0 5
- 0.121896 1 0 cbr 72 ------- 4 1.0 0.0 0 5
r 0.122624 0 4 DTNBundle 164 ------- 1 0.0 4.0 -1 1
+ 0.122624 4 5 DTNBundle 164 ------- 1 4.0 5.0 -1 6
- 0.122624 4 5 DTNBundle 164 ------- 1 4.0 5.0 -1 6
+ 0.122624 4 0 DTNBundle 76 ------- 3 4.0 0.0 -1 7
- 0.122624 4 0 DTNBundle 76 ------- 3 4.0 0.0 -1 7
+ 0.122624 4 8 DTNBundle 84 ------- 2 4.0 8.0 -1 8
- 0.122624 4 8 DTNBundle 84 ------- 2 4.0 8.0 -1 8
r 0.12296 0 1 DTNBundle 81 ------- 2 0.0 1.0 -1 3
This is awk filter fourth column in the file traces.
Code:
BEGIN{
i=0;
}
{
action=$1;
cl1=$2;
Cl2=$3;
cl3=$4;
cl4=$5;
if(action=="+"){
c1[i]=cl1;
c2[i]=cl2;
c3[i]=cl3;
c4[i]=cl4
i++;
}
}
END{
for(j=0;j<=i;j++){
printf("%f %x %d %s\n", c1[j], c2[j], c3[j], c4[j]);
}
}
but after running second column is have value "0"

you can edit or tell me why do I fix this.
Thank you very much.

Here is a snippet of my results.
Code:
0.122624 0 5 DTNBundle
0.122624 0 0 DTNBundle
0.123812 0 4 DTNBundle
0.123812 0 1 DTNBundle
0.125000 0 0 cbr
0.133296 0 1 DTNBundle
0.133936 0 4 DTNBundle
0.134936 0 4 DTNBundle
0.135124 0 5 DTNBundle
0.135124 0 0 DTNBundle
0.136312 0 4 DTNBundle
0.136312 0 1 DTNBundle
0.137500 0 0 cbr
0.144544 0 0 DTNBundle
0.145544 0 0 DTNBundle
0.145796 0 1 DTNBundle
0.146436 0 4 DTNBundle
0.147436 0 4 DTNBundle
0.147624 0 5 DTNBundle
0.147624 0 0 DTNBundle
0.148812 0 4 DTNBundle
0.148812 0 1 DTNBundle

Last edited by easyvn112; 06-10-2011 at 03:21 AM.
 
Old 06-10-2011, 03:26 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It's always 0 because you inadvertently used an uppercase C instead of lowercase:
Code:
cl1=$2;
Cl2=$3;
cl3=$4;
cl4=$5;
Change it to lower case and the result should be what you expect.
 
Old 06-10-2011, 04:48 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,011

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194
I would add that such an elaborate script is not really required:
Code:
awk '/^[+]/{printf "%f %x %d %s\n",$2,$3,$4,$5}' file
 
Old 06-10-2011, 05:49 AM   #4
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Original Poster
Rep: Reputation: 2
Thank you very much.
here is link Trace file you can help me how to draw xraph or gnuplot delay packet at the node?
http://www.mediafire.com/?ztfw4j77x2zho9h
http://www.mediafire.com/?lb9h3labipyf4gf#1

Last edited by easyvn112; 06-10-2011 at 05:52 AM.
 
Old 06-10-2011, 08:13 AM   #5
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Original Poster
Rep: Reputation: 2
Quote:
Originally Posted by colucix View Post
It's always 0 because you inadvertently used an uppercase C instead of lowercase:
Code:
cl1=$2;
Cl2=$3;
cl3=$4;
cl4=$5;
Change it to lower case and the result should be what you expect.
Thank you very much. All right.
 
Old 06-10-2011, 08:30 AM   #6
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,011

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194
Well the usual story would be, show us what you have done and where you are stuck (like your first post) and then we can help.
 
Old 06-11-2011, 12:54 AM   #7
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Original Poster
Rep: Reputation: 2
Cái này nói cũng khó, đây là file Nam ma ḿnh đang làm mô phỏng.
http://www.mediafire.com/?306toggqiap9a6q
Ḿnh đang làm mô phỏng về mạng DTN (Delay toleran networking. Ḿnh đă tính được tỉ lệ gói tin nhận và Drop. Bây giờ quan trọng ḿnh muốn lấy delay để tiến hành so sánh, với các khoảng thời gian thay đổi và thời gian truyền lại gói.
Đây là mă code TCL....

Code:
# Set variables.

set DATALOAD 8000

set MTU 1500

set PACKETSIZE 100



Agent/DTNAgent set custodian_ 1

Agent/DTNAgent set retransmit_ 0.5



# Create a simulator object

set ns [new Simulator]



# Open a trace file

set nf [open demo.nam w]

$ns namtrace-all $nf



set nk [open all.tr w]

$ns trace-all $nk

# Setup packet type colours for nam.

$ns color 1 Blue

$ns color 2 Chocolate

$ns color 3 Darkgreen

$ns color 4 Purple



# Define a 'finish' procedure

proc finish {} {

        global ns nf nk

        $ns flush-trace

        close $nf

	close $nk

        exec nam demo.nam &

        exit 0

}



# Create nodes

set t0n0 [$ns node]

set t0n1 [$ns node]

set t0n2 [$ns node]

set t0n3 [$ns node]



set t1n0 [$ns node]

set t1n1 [$ns node]

set t1n2 [$ns node]

set t1n3 [$ns node]



set t2n0 [$ns node]

set t2n1 [$ns node]

set t2n2 [$ns node]

set t2n3 [$ns node]



set t3n0 [$ns node]

set t3n1 [$ns node]

set t3n2 [$ns node]

set t3n3 [$ns node]



# Connect the nodes with links.

$ns duplex-link $t0n0 $t0n1 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t0n2 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t0n3 1Mb 10ms DropTail



$ns duplex-link $t1n0 $t1n1 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t1n2 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t1n3 1Mb 10ms DropTail



$ns duplex-link $t2n0 $t2n1 1Mb 10ms DropTail

$ns duplex-link $t2n0 $t2n2 1Mb 10ms DropTail

$ns duplex-link $t2n0 $t2n3 1Mb 10ms DropTail



$ns duplex-link $t3n0 $t3n1 1Mb 10ms DropTail

$ns duplex-link $t3n0 $t3n2 1Mb 10ms DropTail

$ns duplex-link $t3n0 $t3n3 1Mb 10ms DropTail



$ns duplex-link $t0n0 $t1n0 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t2n0 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t3n0 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t2n0 1Mb 10ms DropTail



# Create and attach agents.

set d0 [new Agent/DTNAgent]

$ns attach-agent $t0n0 $d0

set d1 [new Agent/DTNAgent]

$ns attach-agent $t0n1 $d1

set d2 [new Agent/DTNAgent]

$ns attach-agent $t0n2 $d2

set d3 [new Agent/DTNAgent]

$ns attach-agent $t0n3 $d3

set d4 [new Agent/DTNAgent]

$ns attach-agent $t1n0 $d4

set d5 [new Agent/DTNAgent]

$ns attach-agent $t1n1 $d5

set d6 [new Agent/DTNAgent]

$ns attach-agent $t1n2 $d6

set d7 [new Agent/DTNAgent]

$ns attach-agent $t1n3 $d7

set d8 [new Agent/DTNAgent]

$ns attach-agent $t2n0 $d8

set d9 [new Agent/DTNAgent]

$ns attach-agent $t2n1 $d9

set d10 [new Agent/DTNAgent]

$ns attach-agent $t2n2 $d10

set d11 [new Agent/DTNAgent]

$ns attach-agent $t2n3 $d11

set d12 [new Agent/DTNAgent]

$ns attach-agent $t3n0 $d12

set d13 [new Agent/DTNAgent]

$ns attach-agent $t3n1 $d13

set d14 [new Agent/DTNAgent]

$ns attach-agent $t3n2 $d14

set d15 [new Agent/DTNAgent]

$ns attach-agent $t3n3 $d15



# Set local Region

$d0  region "R0"

$d1  region "R0"

$d2  region "R0"

$d3  region "R0"



$d4  region "R1"

$d5  region "R1"

$d6  region "R1"

$d7  region "R1"



$d8  region "R2"

$d9  region "R2"

$d10 region "R2"

$d11 region "R2"



$d12 region "R3"

$d13 region "R3"

$d14 region "R3"

$d15 region "R3"



# Setup routing tables.

# R0

$d0  add "R1" $t1n0 1 1 $MTU

$d0  add "R1" $t2n0 1 2 $MTU

$d0  add "R2" $t2n0 1 1 $MTU

$d0  add "R2" $t1n0 1 2 $MTU

$d0  add "R3" $t3n0 1 1 $MTU

$d1  add "*"  $t0n0 1 0 $MTU

$d2  add "*"  $t0n0 1 0 $MTU

$d3  add "*"  $t0n0 1 0 $MTU



# R1

$d4  add "R0" $t0n0 1 1 $MTU

$d4  add "R0" $t2n0 1 2 $MTU

$d4  add "R2" $t2n0 1 1 $MTU

$d4  add "R2" $t0n0 1 2 $MTU

$d4  add "R3" $t0n0 1 2 $MTU

$d4  add "R3" $t2n0 1 3 $MTU

$d5  add "*"  $t1n0 1 0 $MTU

$d6  add "*"  $t1n0 1 0 $MTU

$d7  add "*"  $t1n0 1 0 $MTU



# R2

$d8  add "R0" $t0n0 1 1 $MTU

$d8  add "R0" $t1n0 1 2 $MTU

$d8  add "R1" $t1n0 1 1 $MTU

$d8  add "R1" $t0n0 1 2 $MTU

$d8  add "R3" $t0n0 1 2 $MTU

$d8  add "R3" $t1n0 1 3 $MTU

$d9  add "*"  $t2n0 1 0 $MTU

$d10 add "*"  $t2n0 1 0 $MTU

$d11 add "*"  $t2n0 1 0 $MTU



# R3

$d12 add "R0" $t0n0 1 1 $MTU

$d12 add "R1" $t0n0 1 2 $MTU

$d12 add "R2" $t0n0 1 2 $MTU

$d13 add "*"  $t3n0 1 0 $MTU

$d14 add "*"  $t3n0 1 0 $MTU

$d15 add "*"  $t3n0 1 0 $MTU



# Callback functions

Agent/DTNAgent instproc indData {sid did rid cos options lifespan adu} {

    $self instvar node_

    $self instvar $adu

    puts "node [$node_ id] ($did) received bundle from \

              $sid : '$adu'"

}



Agent/DTNAgent instproc indSendError {sid did rid cos options lifespan adu} {

    $self instvar node_

    puts "node [$node_ id] ($sid) got send error on bundle to \

              $did : '$adu'"

}



Agent/DTNAgent instproc indSendToken {binding sendtoken} {

    $self instvar node_

    puts "node [$node_ id] Send binding $binding bound to token $sendtoken"

    if { [string equal $binding "deleteme" ] } {

	$self cancel $sendtoken

    }

}



Agent/DTNAgent instproc indRegToken {binding regtoken} {

    $self instvar node_

    puts "node [$node_ id] Reg binding $binding bound to token $regtoken"

    if { [string equal $binding "t1n3:1" ] } {

        $self deregister $regtoken

    }

}



# Create a CBR traffic source. 

set cbr0 [new Application/Traffic/CBR]

$cbr0 set packetSize_ $PACKETSIZE

$cbr0 set rate_ [ expr 8 * $DATALOAD ]

$cbr0 attach-agent $d1



# Setup application interface.

$d1 app src      R0,$t0n1:10

$d1 app dest     R1,$t1n1:42

$d1 app rpt_to   R0,$t0n1:11

$d1 app cos      NORMAL

$d1 app options  CUST,REPCUST,EERCPT,REPRCPT,REPFWD

$d1 app lifespan 300



# Register a destination action.

$d5 register SINK t1n1:42 R1,$t1n1:42



# Run the CBR for 0.5 seconds.

$ns at 0.1 "$cbr0 start"

$ns at 0.6 "$cbr0 stop"



# Cause "link failure"

for {set x 0} {$x<5} {incr x} {

    $ns rtmodel-at [expr 0.05+0.20*$x]  down $t0n0 $t1n0

    $ns rtmodel-at [expr 0.06+0.20*$x]  down $t2n0 $t1n0

    $ns rtmodel-at [expr 0.07+0.20*$x]  up   $t0n0 $t1n0

    $ns rtmodel-at [expr 0.08+0.20*$x]  up   $t2n0 $t1n0

}



$ns at 100.0 "finish"



#Run the simulation

$ns run

để chạy được code các bạn cần cài đặt thành công

http://www.illuvatar.nu/ns-dtn/code/

vào trong NS2...
Các bạn giúp ḿnh với nhé....

Sorry v́ tớ học kém tiếng anh.

Last edited by easyvn112; 06-11-2011 at 01:19 AM.
 
Old 06-11-2011, 03:10 AM   #8
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by easyvn112 View Post
Cái này nói cũng khó, đây là file Nam ma ḿnh đang làm mô phỏng.
Please, easyvn112 can you translate your post in English? Thanks.
 
Old 06-12-2011, 06:48 AM   #9
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Original Poster
Rep: Reputation: 2
This analysis is difficult, this is the file Nam's simulations.
http://www.mediafire.com/?306toggqiap9a6q
I'm doing on the network simulation DTN (Delay toleran networking. I've calculated the percentage of packets received and Drop. Now I want to get the delay is important to conduct a comparison with the time change and the transmission time back pack.
This is TCL code ....

Code:
# Set variables.

set DATALOAD 8000

set MTU 1500

set PACKETSIZE 100



Agent/DTNAgent set custodian_ 1

Agent/DTNAgent set retransmit_ 0.5



# Create a simulator object

set ns [new Simulator]



# Open a trace file

set nf [open demo.nam w]

$ns namtrace-all $nf



set nk [open all.tr w]

$ns trace-all $nk

# Setup packet type colours for nam.

$ns color 1 Blue

$ns color 2 Chocolate

$ns color 3 Darkgreen

$ns color 4 Purple



# Define a 'finish' procedure

proc finish {} {

        global ns nf nk

        $ns flush-trace

        close $nf

	close $nk

        exec nam demo.nam &

        exit 0

}



# Create nodes

set t0n0 [$ns node]

set t0n1 [$ns node]

set t0n2 [$ns node]

set t0n3 [$ns node]



set t1n0 [$ns node]

set t1n1 [$ns node]

set t1n2 [$ns node]

set t1n3 [$ns node]



set t2n0 [$ns node]

set t2n1 [$ns node]

set t2n2 [$ns node]

set t2n3 [$ns node]



set t3n0 [$ns node]

set t3n1 [$ns node]

set t3n2 [$ns node]

set t3n3 [$ns node]



# Connect the nodes with links.

$ns duplex-link $t0n0 $t0n1 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t0n2 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t0n3 1Mb 10ms DropTail



$ns duplex-link $t1n0 $t1n1 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t1n2 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t1n3 1Mb 10ms DropTail



$ns duplex-link $t2n0 $t2n1 1Mb 10ms DropTail

$ns duplex-link $t2n0 $t2n2 1Mb 10ms DropTail

$ns duplex-link $t2n0 $t2n3 1Mb 10ms DropTail



$ns duplex-link $t3n0 $t3n1 1Mb 10ms DropTail

$ns duplex-link $t3n0 $t3n2 1Mb 10ms DropTail

$ns duplex-link $t3n0 $t3n3 1Mb 10ms DropTail



$ns duplex-link $t0n0 $t1n0 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t2n0 1Mb 10ms DropTail

$ns duplex-link $t0n0 $t3n0 1Mb 10ms DropTail

$ns duplex-link $t1n0 $t2n0 1Mb 10ms DropTail



# Create and attach agents.

set d0 [new Agent/DTNAgent]

$ns attach-agent $t0n0 $d0

set d1 [new Agent/DTNAgent]

$ns attach-agent $t0n1 $d1

set d2 [new Agent/DTNAgent]

$ns attach-agent $t0n2 $d2

set d3 [new Agent/DTNAgent]

$ns attach-agent $t0n3 $d3

set d4 [new Agent/DTNAgent]

$ns attach-agent $t1n0 $d4

set d5 [new Agent/DTNAgent]

$ns attach-agent $t1n1 $d5

set d6 [new Agent/DTNAgent]

$ns attach-agent $t1n2 $d6

set d7 [new Agent/DTNAgent]

$ns attach-agent $t1n3 $d7

set d8 [new Agent/DTNAgent]

$ns attach-agent $t2n0 $d8

set d9 [new Agent/DTNAgent]

$ns attach-agent $t2n1 $d9

set d10 [new Agent/DTNAgent]

$ns attach-agent $t2n2 $d10

set d11 [new Agent/DTNAgent]

$ns attach-agent $t2n3 $d11

set d12 [new Agent/DTNAgent]

$ns attach-agent $t3n0 $d12

set d13 [new Agent/DTNAgent]

$ns attach-agent $t3n1 $d13

set d14 [new Agent/DTNAgent]

$ns attach-agent $t3n2 $d14

set d15 [new Agent/DTNAgent]

$ns attach-agent $t3n3 $d15



# Set local Region

$d0  region "R0"

$d1  region "R0"

$d2  region "R0"

$d3  region "R0"



$d4  region "R1"

$d5  region "R1"

$d6  region "R1"

$d7  region "R1"



$d8  region "R2"

$d9  region "R2"

$d10 region "R2"

$d11 region "R2"



$d12 region "R3"

$d13 region "R3"

$d14 region "R3"

$d15 region "R3"



# Setup routing tables.

# R0

$d0  add "R1" $t1n0 1 1 $MTU

$d0  add "R1" $t2n0 1 2 $MTU

$d0  add "R2" $t2n0 1 1 $MTU

$d0  add "R2" $t1n0 1 2 $MTU

$d0  add "R3" $t3n0 1 1 $MTU

$d1  add "*"  $t0n0 1 0 $MTU

$d2  add "*"  $t0n0 1 0 $MTU

$d3  add "*"  $t0n0 1 0 $MTU



# R1

$d4  add "R0" $t0n0 1 1 $MTU

$d4  add "R0" $t2n0 1 2 $MTU

$d4  add "R2" $t2n0 1 1 $MTU

$d4  add "R2" $t0n0 1 2 $MTU

$d4  add "R3" $t0n0 1 2 $MTU

$d4  add "R3" $t2n0 1 3 $MTU

$d5  add "*"  $t1n0 1 0 $MTU

$d6  add "*"  $t1n0 1 0 $MTU

$d7  add "*"  $t1n0 1 0 $MTU



# R2

$d8  add "R0" $t0n0 1 1 $MTU

$d8  add "R0" $t1n0 1 2 $MTU

$d8  add "R1" $t1n0 1 1 $MTU

$d8  add "R1" $t0n0 1 2 $MTU

$d8  add "R3" $t0n0 1 2 $MTU

$d8  add "R3" $t1n0 1 3 $MTU

$d9  add "*"  $t2n0 1 0 $MTU

$d10 add "*"  $t2n0 1 0 $MTU

$d11 add "*"  $t2n0 1 0 $MTU



# R3

$d12 add "R0" $t0n0 1 1 $MTU

$d12 add "R1" $t0n0 1 2 $MTU

$d12 add "R2" $t0n0 1 2 $MTU

$d13 add "*"  $t3n0 1 0 $MTU

$d14 add "*"  $t3n0 1 0 $MTU

$d15 add "*"  $t3n0 1 0 $MTU



# Callback functions

Agent/DTNAgent instproc indData {sid did rid cos options lifespan adu} {

    $self instvar node_

    $self instvar $adu

    puts "node [$node_ id] ($did) received bundle from \

              $sid : '$adu'"

}



Agent/DTNAgent instproc indSendError {sid did rid cos options lifespan adu} {

    $self instvar node_

    puts "node [$node_ id] ($sid) got send error on bundle to \

              $did : '$adu'"

}



Agent/DTNAgent instproc indSendToken {binding sendtoken} {

    $self instvar node_

    puts "node [$node_ id] Send binding $binding bound to token $sendtoken"

    if { [string equal $binding "deleteme" ] } {

	$self cancel $sendtoken

    }

}



Agent/DTNAgent instproc indRegToken {binding regtoken} {

    $self instvar node_

    puts "node [$node_ id] Reg binding $binding bound to token $regtoken"

    if { [string equal $binding "t1n3:1" ] } {

        $self deregister $regtoken

    }

}



# Create a CBR traffic source. 

set cbr0 [new Application/Traffic/CBR]

$cbr0 set packetSize_ $PACKETSIZE

$cbr0 set rate_ [ expr 8 * $DATALOAD ]

$cbr0 attach-agent $d1



# Setup application interface.

$d1 app src      R0,$t0n1:10

$d1 app dest     R1,$t1n1:42

$d1 app rpt_to   R0,$t0n1:11

$d1 app cos      NORMAL

$d1 app options  CUST,REPCUST,EERCPT,REPRCPT,REPFWD

$d1 app lifespan 300



# Register a destination action.

$d5 register SINK t1n1:42 R1,$t1n1:42



# Run the CBR for 0.5 seconds.

$ns at 0.1 "$cbr0 start"

$ns at 0.6 "$cbr0 stop"



# Cause "link failure"

for {set x 0} {$x<5} {incr x} {

    $ns rtmodel-at [expr 0.05+0.20*$x]  down $t0n0 $t1n0

    $ns rtmodel-at [expr 0.06+0.20*$x]  down $t2n0 $t1n0

    $ns rtmodel-at [expr 0.07+0.20*$x]  up   $t0n0 $t1n0

    $ns rtmodel-at [expr 0.08+0.20*$x]  up   $t2n0 $t1n0

}



$ns at 100.0 "finish"



#Run the simulation

$ns run
You want to run the code you need to install successfully package DTN in the NS2.
Here is the download link and instructions to install ns2 in the DTN.
http://www.illuvatar.nu/ns-dtn/code/
Thank you very much.
 
Old 06-12-2011, 07:36 AM   #10
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,011

Rep: Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194Reputation: 3194
So what is the issue with this code?
 
Old 06-13-2011, 04:47 AM   #11
easyvn112
Member
 
Registered: Mar 2011
Posts: 37

Original Poster
Rep: Reputation: 2
I want to calculate drop the packet and received packet latency between two consecutive nodes. So to add anything to the TCL code?
 
Old 07-07-2012, 02:23 PM   #12
DarkCompiled
LQ Newbie
 
Registered: Jul 2012
Posts: 3

Rep: Reputation: Disabled
Trace Analysis

Hi easyvn112,

It's probably a little late, but I'll answer anyway...
For the analysis you can
- do it manually, for instance: http://nile.wpi.edu/NS/analysis.html
- use ready to use awk scripts: http://www.winlab.rutgers.edu/~zhibi.../ns_trace.html
- use external command line tools like NS-2 Trace Analyzer: http://sourceforge.net/projects/trace-analyzer/support
- use Trace Graph: http://www.angelfire.com/al4/esorkor/
- use the tool I've developed, NS2 Visual Trace Analyzer: http://nsvisualtraceanalyzer.wordpress.com/

I would advise you to try Trace Graph or my tool first, because they are ready to calculate many statistics at once without loosing effort configuring custom scripts or parameters.

Best reagards,
Fernando
 
  


Reply

Tags
ns2, trace, trace+awk



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
awk scripts for trace file mikes1313 Linux - Newbie 7 04-18-2013 05:11 PM
detect file deletion on an operating system and trace the file history or activity? lovsis Linux - Security 2 10-19-2010 08:52 AM
How to trace and disable the HTTP TRACE method in Apache 1.3.33 with FreeBSD? SomnathG Linux - Security 1 11-11-2008 09:41 AM
What is the best way to trace down a program ? exceed1 Linux - General 3 04-26-2008 08:31 PM
obtaining program execution trace? arjunsub Programming 2 02-20-2005 09:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:47 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration