Packet Delivery Ratio in Ns2

Most significantly, the process of calculating the packet delivery ratio (PDR) is based on the generated and received packets which are recorded in the trace file. In addition, the packet delivery ratio is utilizing the awk scripts for the calculation process and the awk script processes the trace file which produces the graph result.

Calculate Packet Delivery Ratio Using Awk Script in Ns2

Hereby, we have highlighted the awk script code which is used to calculate the packet delivery ratio in network simulator 2.

if($4 == “AGT” && $1 == “s” && seqno < $6) {

 seqno = $6;

 } else if(($4 == “AGT”) && ($1 == “r”)) {

 receivedPackets++;

 } else if ($1 == “D” && $7 == “cbr” && $8 > 512){

 droppedPackets++;

}

Ns2 Simulation Code for Packet Delivery Ratio

We have to implement the Ns2 simulation tcl main file along with the code which is highlighted in the following for the graph generation of packet delivery ratio.

exec awk -f Packet_Delivery_Ratio.awk sample.tr > pdr.xg &

Without any doubt, the research scholars can contact us at any time because we are providing the 24/7 research service.