Program Perl Average Delay, Average Throughput, dan PDR Program Perl Jumlah Hop Routing

3. Program Perl Average Delay, Average Throughput, dan PDR

infile = ARGV[0]; highest_packet_id[0] =0; action =0; time = 2; node_type = 18; packet_type = 34; packet_size = 36; src = 44; packet_id = 40; open data, infile || die cant open infile ; while data { x = split ; if x[src] eq cbr{ if x[action] eq sand x[node_type] eq AGT{ highest_packet_id=x[packet_id]; start_time[x[packet_id]] =x[time]; num_sent[x[packet_id]] = 1; } } if x[action] eq rand x[node_type] eq AGT{ end_time[x[packet_id]] = x[time]; size[x[packet_id]] = x[packet_size]; num_rcvd[x[packet_id]] = 1; } } for x[packet_id] = 0 ; x[packet_id]=highest_packet_id ; x[packet_id]++{ start = start_time[x[packet_id]]; end = end_time[x[packet_id]]; packet_duration = end - start; sized = size[x[packet_id]]; if sized 0{ th = sizedpacket_duration; } rcvd = rcvd + num_rcvd[x[packet_id]]; sent = sent+ num_sent[x[packet_id]]; if start end{ total_delay = total_delay + packet_duration; total_th = total_th + th; } } avg_delay = total_delay rcvd; avg_th = total_thrcvd; packet_del = rcvd sent 100; print STDOUT Average delay = avg_delay\n; print STDOUT Average throughput = avg_th\n; print STDOUT Packet Sent = sent\n; print STDOUT Packet Received = rcvd\n; print STDOUT Packet Delivery = packet_del \n; close data; exit0; Gambar A.3 Listing program Perl Average Delay, Average Throughput, dan PDR.

4. Program Perl Jumlah Hop Routing

infile = ARGV[0]; highest_packet_id[0] =0; action = 0; time = 2; node_type = 18; src = 44; packet_id = 40; PacketWasForwarded = 48; open data, infile || die cant open infile ; while data { x = split ; if x[src] eq cbr{ if x[action] eq rand x[node_type] eq AGT{ highest_packet_id=x[packet_id]; if x[PacketWasForwarded] eq 2{ num_PacketWasForwarded1[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 3{ num_PacketWasForwarded2[x[packe t_id]] = 1;} if x[PacketWasForwarded] eq 4{ num_PacketWasForwarded3[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 5{ num_PacketWasForwarded4[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 6{ num_PacketWasForwarded5[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 7{ num_PacketWasForwarded6[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 8{ num_PacketWasForwarded7[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 9{ num_PacketWasForwarded8[x[packet_id]] = 1;} if x[PacketWasForwarded] eq 10{ num_PacketWasForwarded9[x[packet_id]] = 1;} } } } for x[packet_id] = 0 ; x[packet_id]=highest_packet_id ; x[packet_id]++{ hop1=hop1 + num_PacketWasForwarded1[x[packet_id]]; hop2=hop2 + num_PacketWasForwarded2[x[packet_id]]; hop3=hop3 + num_PacketWasForwarded3[x[packet_id]]; hop4=hop4 + num_PacketWasForwarded4[x[packet_id]]; hop5=hop5 + num_PacketWasForwarded5[x[packet_id]]; hop6=hop6 + num_PacketWasForwarded6[x[packet_id]]; hop7=hop7 + num_PacketWasForwarded7[x[packet_id]]; hop8=hop8 + num_PacketWasForwarded8[x[packet_id]]; hop9=hop9 + num_PacketWasForwarded9[x[packet_id]]; } print STDOUT hop 1 = hop1\n; print STDOUT hop 2 = hop2\n; print STDOUT hop 3 = hop3\n; print STDOUT hop 4 = hop4\n; print STDOUT hop 5 = hop5\n; print STDOUT hop 6 = hop6\n; print STDOUT hop 7 = hop7\n; print STDOUT hop 8 = hop8\n; print STDOUT hop 9 = hop9\n; close data; exit0; Gambar A.4 Listing program Perl jumlah hop routing. 85 LAMPIRAN B HASIL SIMULASI DAN PROGRAM PERL

1. Hasil Simulasi DSDV dan OLSR