Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to calculate Packet Reception Ratio (PRR) in contiki cooja simulator using script editor

  • Packet Reception Ratio (PRR)
    <script>TIMEOUT(300000, log.log(“Total PRR ” + totalPRR + “\n”));packetsReceived= new Array();packetsSent = new Array();

    serverID = 1;

    nodeCount = 31;

    totalPRR = 0;

    for(i = 0; i <= nodeCount; i++) {

    packetsReceived[i] = 0;

    packetsSent[i] = 0;

    }

    while(1) {

    YIELD();

    msgArray = msg.split(‘ ‘);

    if(msgArray[0].equals(“DATA”)) {

    if(msgArray.length == 9) {

    // Received packet

    senderID = parseInt(msgArray[8]);

    packetsReceived[senderID]++;

    log.log(“SenderID ” + senderID + ” PRR ” + packetsReceived[senderID] / packetsSent[senderID] + “\n”);

    totalReceived = totalSent = 0;

    for(i = serverID + 1; i <= nodeCount; i++) {

    totalReceived += packetsReceived[i];

    totalSent += packetsSent[i];

    }

    totalPRR = totalReceived / totalSent;

    }

    }

    } </script>