Sunday, 2 November 2014

Terms Packet delivery ratio, Packet Lost, End to end delay

If you want to evaluate the performance of protocol using NS-2, first you have to define the evaluation criteria. This time I want to explore about Packet delivery ratio, packet lost and end to end delay.
What are they?
Packet delivery ratio : the ratio of the number of delivered data packet to the destination. This illustrates the level of delivered data to the destination.
∑ Number of packet receive / ∑ Number of packet send
The greater value of packet delivery ratio means the better performance of the protocol.
End-to-end Delay : the average time taken by a data packet to arrive in the destination. It also includes the delay caused by route discovery process and the queue in data packet transmission. Only the data packets that successfully delivered to destinations that counted.
∑ ( arrive time – send time ) / ∑ Number of connections
The lower value of end to end delay means the better performance of the protocol.
Packet Lost : the total number of packets dropped during the simulation.
Packet lost = Number of packet send – Number of packet received .
The lower value of the packet lost means the better performance of the protocol.
How to analyze trace file to find the result?
First : you must analyze the trace file with this Script PDR and E2ED
run this script with command :
awk -f PacketDeliveryRatio.awk (name trace file.tr)
awk -f Endtoenddelay.awk (name trace file.tr)

If error 
This is exactly what I need. However I couldn’t run the command. Probably I misunderstood something. On what file should I run “awk -f Endtoenddelay.awk (name trace file.tr)”
I downloaded the text file you provided, saved it as .awk file and run it like “awk -f pdr.awk ~/Desktop/mypackets.trace” but it returns all 0’s.

Solution
1. you must execute the awk files inside folder that contain your trace files.
2. please make sure that you are using new trace file format or old trace file format. you can check this type in your tcl schenario script.

how can i enable the new trace file format not the old one in the tcl script ?
You can changes it in your TCL file.
For example in this tcl files :
# wrls1.tcl
# A 3-node example for ad-hoc simulation with DSDV

# Define options
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 5 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 500 ;# X dimension of topography
set val(y) 400 ;# Y dimension of topography
set val(stop) 300 ;# time of simulation end

set ns [new Simulator]
set tracefd [open simple.tr w]
set windowVsTime2 [open win.tr w]
set namtrace [open simwrls.nam w]

$ns use-newtrace —————–> to enable new trace format
#$ns use-trace ——————-> if you delete tha “#” means that you enable old trace format
$ns trace-all $tracefd

#$ns new-trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo [new Topography]

$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)

If Division by zero error
Maybe there is problem in the variable definition.
Please check your trace files. Make sure that you use new trace format or old trace format.
After that changes the number of variable.
For Example:
Based on trace format bellow, the time variable is in row 3. so put $3 in your variable definition. In this case time=$3;

#Example of new trace format
#1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#s -t 1.142046604 -Hs 0 -Hd -2 -Ni 0 -Nx 1186.47 -Ny 1093.76 -Nz 0.00 -Ne 100.000000 -Nl AGT -Nw —
#
#22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 0.0 -Id 40.0 -It cbr -Il 512 -If 0 -Ii 3 -Iv 32 -Pn cbr -Pi 1 -Pf 0 -Po 16777215
event = $1;
time = $3;
node = $5;
type = $19;
reason = $21;
packetid = $41;
packettype = $35;
src = $31;
dst = $33;
cbr_packetid = $47;
numhops = $49;
opt_numhops = $51;
energy = $17;
 Possible error

Hi when i type this command for delay i don’t have any result what’s the problem ??
Please check your trace files. Make sure that you use new trace format or old trace format.
After that changes the number of variable.
For Example:
Based on trace format bellow, the time variable is in row 3. so put $3 in your variable definition. In this case time=$3;

#Example of new trace format
#1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#s -t 1.142046604 -Hs 0 -Hd -2 -Ni 0 -Nx 1186.47 -Ny 1093.76 -Nz 0.00 -Ne 100.000000 -Nl AGT -Nw —
#
#22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 0.0 -Id 40.0 -It cbr -Il 512 -If 0 -Ii 3 -Iv 32 -Pn cbr -Pi 1 -Pf 0 -Po 16777215
event = $1;
time = $3;
node = $5;
type = $19;
reason = $21;
packetid = $41;
packettype = $35;
src = $31;
dst = $33;
cbr_packetid = $47;
numhops = $49;
opt_numhops = $51;
energy = $17;


No comments:

Post a Comment