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 Throughput in contiki cooja simulator using script editor

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

    nodeCount = 31;

    data_length = 23;

    totalPRR = 0;

    controlpackets = 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;

    throughput = (totalReceived * data_length * 8) / total_simulation_time;

    log.log(“Total PRR ” + totalPRR + ” recv ” + totalReceived + ” sent ” + totalSent + ” Throughput ” + throughput + “\n”);

    } else if(msgArray.length == 6) {

    // Sent packet

    packetsSent[id]++;

    log.log(” IIIID ” + id + ” packetsSent[id] ” + packetsSent[id] + “\n”);

    }

    }

     

    }</script>