Analysis of Quality of Service in Wimax networks



Download 495,75 Kb.
Pdf ko'rish
bet39/40
Sana16.04.2023
Hajmi495,75 Kb.
#929022
1   ...   32   33   34   35   36   37   38   39   40
Bog'liq
Analysis of quality of service QoS in WiMAX networks

 
 
Appendix III 
The following is the PERL script used in for analysis of the trace file and to 
extract the QoS parameters. The script takes the trace file generated by ns-2 after the 
simulation is executed. It calculates throughput, packet loss, average jitter and average 
delay. 
#!/usr/bin/perl 
#This program is used to calculate the QoS Parameters from 
# NS-2 Trace file as input parameter 

use List::Util qw[min max]; 
use strict; 
my $infile=$ARGV[0]; 
my $node=$ARGV[1]; 
my %packet_info; 
my %node_hash ; 
if (!open (DATA,"<$infile")) 

# Print the titles for the columns 
print "FileName Throughput PacketLoss MinJitter MaxJitter 
AvgJitter MinDelay MaxDelay AvgDelay Node TypeTraffic NumPackets 
\n"; 
exit; 

#Start reading the file 
while ()

# Filter for packets 
if((/MAC.*exp/) || (/MAC.*tcp/) ||(/MAC.*cbr/) ||(/MAC.*udp/)) 

my @x = split(' '); 
my 
$action=$x[0]; 
my 
$ttime=$x[1]; 
my $node_id = $x[2]; 
my $packet_id = $x[5]; 
my $size = $x[7]; 
if(/exp/) 

$packet_info{$packet_id}->{flow} = "exp" ; 



86
elsif (/tcp/) 

$packet_info{$packet_id}->{flow} = "tcp" ; 

elsif (/cbr/) 

$packet_info{$packet_id}->{flow} = "cbr" ; 

elsif (/udp/) 

$packet_info{$packet_id}->{flow} = "udp" ; 

#Read the packet size 
$packet_info{$packet_id}->{size} = $size ; 
if ($action eq "s") 

if (!defined $packet_info{$packet_id}->{start}) 

$packet_info{$packet_id}->{start} = $ttime ; 

$packet_info{$packet_id}->{from_node} = $node_id 

$node_hash{$node_id} += 1 ; 

elsif ($action eq "r") 

# The packet is received 
$packet_info{$packet_id}->{end} = $ttime ; 
$packet_info{$packet_id}->{to_node} = $node_id ; 

elsif ($action eq "D") 

# The packet is dropped 
$packet_info{$packet_id}->{drop} = 1 ; 
$packet_info{$packet_id}->{from_node} 

$node_id 




print_node_stats ("ALL") ; 
print "\n"; 
foreach (sort keys(%node_hash)) 

print_node_stats ($_); 
print "\n"; 

sub print_node_stats () 

my $my_node = shift(@_); 
my $dropped = 0; 
my $transferred = 0; 
my 
@send_time; 
my 
@rec_time; 
my 
@packet_number; 
my 
@delay; 
my 
@from_node; 
my 
@to_node; 


87
my %flow = 0; 
my $count = 0; 
my $drop_count = 0; 
foreach my $packet (sort {$a <=> $b} keys(%packet_info)) 

if($my_node ne "ALL") 

if ($packet_info{$packet}->{from_node} ne 
$my_node) 

next; 



if ($packet_info{$packet}->{drop} == 1) 

$dropped += $packet_info{$packet}->{size}; 
$drop_count++; 

Else 

if (defined($packet_info{$packet}->{start}) 
&& defined($packet_info{$packet}->{end})) 

$send_time[$count] = 
$packet_info{$packet}->{start}; 
$rec_time[$count] = 
$packet_info{$packet}->{end}; 
$from_node[$count] = 
$packet_info{$packet}->{from_node}; 
$to_node[$count] = 
$packet_info{$packet}->{to_node}; 
$transferred += $packet_info{$packet}-
>{size}; 
$packet_number[$count] = $packet; 
$delay[$count] = $rec_time[$count]- 
$send_time[$count] ; 
$flow{$from_node[$count]} = 
$packet_info{$packet}->{flow}; 
$count++; 

else 

# Some packets are not marked as dropped but dont have end time so 
drop the packet 
$dropped += $packet_info{$packet}-
>{size}; 
$packet_info{$packet}->{drop} = 1; 
$drop_count++; 




my $total_size = @send_time; 
my 
@jitter; 
for my $i (0...$total_size -2) 



88
if ($packet_number[$i+1] == $packet_number[$i]) 

print "$i\n"; 

else 

# jitter ((recvtime(j)-sendtime(j))-(recvtime(i)-
sendtime(i)))/(j-i), j > i 
$jitter[$i] = (($rec_time[$i+1] - $send_time[$i+1]) 
- ($rec_time[$i] - $send_time[$i]))/($packet_number[$i+1] - 
$packet_number[$i]); 


my $sum = 0; 
foreach my $jit(@jitter) 

#Get absolute value of jitter 
$jit = -1*$jit if ($jit < 0); 
$sum 
+=$jit; 

my $sum_delay = 0; 
foreach 
(@delay) 

#Get absolute value of jitter 
$sum_delay 
+=$_; 

my $avg_jitter = $sum/$total_size; 
my $avg_delay = $sum_delay/$total_size; 
my $per_loss = ($dropped*100)/($dropped + $transferred); 
# transferred is in Bytes. To get Kbps we multiply by 8 and 
divide by 1000 
my $throughput = ($transferred*8)/(($rec_time[$total_size - 1] 
-$send_time[0])*1000); 
$infile =~ s/\./ /g; 
$infile =~ s/tr//g; 
print "$infile "; 
print " $throughput "; 
print "$per_loss "; 
print min(@jitter); 
print " "; 
print max(@jitter); 
print " "; 
print "$avg_jitter "; 
print min(@delay); 
print " "; 
print max(@delay); 
print " "; 
print "$avg_delay "; 
print "$my_node "; 
if($my_node ne "ALL") 

print "$flow{$my_node} "; 

print "$total_size "; 



Download 495,75 Kb.

Do'stlaringiz bilan baham:
1   ...   32   33   34   35   36   37   38   39   40




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish