Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Appendix:
Appendix
To evaluate the trace file generated as simulation results having the above describe trace format we use AWK scripts to find delay, throughput. AWK is a programming language that is designed for processing textbased data, either in files or data streams, and was created at Bell Labs in the 1970s. The name AWK is derived from the family names of its authors - Alfred Aho, Peter Weinberger and Brian Kernighan. AWK is a language for processing files of text. A file is treated as a sequence of records, and by default each line is a record. Each line is broken up into a sequence of fields, so we can think of the first word in a line as the first field, the second word as the second field, and so on. An AWK program is of a sequence of pattern-action statements. AWK reads the input a line at a time. A line is scanned for each pattern in the program, and for each pattern that matches, the associated action is executed. This information comes from "The ns Manual" "Mobile Networking in ns: Trace Support" chapter, and the "trace/cmu-trace.cc" file. Wireless traces begin with one of four characters followed by one of two different trace formats, depending on whether the trace logs the X and Y coordinates of the mobile node.
Appendix
Event
Abbreviation
Type
Value
%.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x] %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] double int double double s: Send r: Receive d: Drop f: Forward string string int string int hexadecimal hexadecimal hexadecimal hexadecimal Time Node ID X Coordinate (If Logging Position) Y Coordinate (If Logging Position) Trace Name Reason Event Identifier Packet Type Packet Size Time To Send Data Destination MAC Address Source MAC Address Type (ARP, IP)
Wireless Event
Some older versions of NS2 have five hexidecimal values between the square braces. The first hexidecimal value is the MAC frame control information, and the remaining hexidecimal values are the same as listed above. Depending on the packet type, the trace may log additional information:
Appendix
Appendix # droppedPackets = 0; # receivedPackets = 0; count = 0; } { if($4 == "AGT" && $1 == "s" && seqno < $6) { seqno = $6; } # else if(($4 == "AGT") && ($1 == "r")) { # receivedPackets++; # } else if ($1 == "D" && $7 == "tcp" && $8 > 512){ # droppedPackets++; # } #end-to-end delay if($4 == "AGT" && $1 == "s") { start_time[$6] = $2; } else if(($7 == "tcp") && ($1 == "r")) { end_time[$6] = $2; } else if($1 == "D" && $7 == "tcp") { end_time[$6] = -1; } } END { for(i=0; i<=seqno; i++) { if(end_time[i] > 0) { delay[i] = end_time[i] - start_time[i]; count++; } else { delay[i] = -1; } } for(i=0; i<=seqno; i++) { if(delay[i] > 0) { n_to_n_delay = n_to_n_delay + delay[i]; } } n_to_n_delay = n_to_n_delay/count; print "\n"; # print "GeneratedPackets = " seqno+1; # print "ReceivedPackets = " receivedPackets; # print "Packet Delivery Ratio = " receivedPackets/(seqno+1)*100 #"%"; # print "Total Dropped Packets = " droppedPackets; print "Average End-to-End Delay = " n_to_n_delay * 1000 " ms"; print "\n"; }