-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDR, latency plot in Cooja simulator #20
Comments
PDR, latency, etc graph in Cooja Simulator is calculated by java code see S-logix |
How to calculate latency in ratio and pdr with energy consumption. |
any one know |
this code MIght be useful. <script> TIMEOUT(900000, log.log(" Energy_consumption = " + energyconsumption + " (Joules) " + "\n" + " Delay = " + avgdelay + " (Sec) " + "\n" + " PDR = " + totalPRR + "\n")); packetsReceived= new Array(); packetsSent = new Array(); timeReceived = new Array(); timeSent = new Array(); delay = new Array(); serverID = 1; nodeCount = 16; totalPRR = 0; throughput = 0; datalength = 23; delayval=0.0; avgdelay=0.0; totalenergy = 0.0; energy_t =0.0; energy_consumption = 0.0; energyconsumption =0.0; e_count=0; for(i = 0; i < nodeCount; i++) { packetsReceived[i] = 0; packetsSent[i] = 0; timeSent[i] = 0; timeReceived[i]=0; delay[i]=0; } while(1) { YIELD(); msgArray=msg.split(' '); if(msgArray[0].equals("Sending")) { if(msgArray.length == 9) { senderID = parseInt(msgArray[9]); packetsReceived[senderID]++; timeReceived[senderID] = time; totalReceived = totalSent = 0; totaldelay = 0.0; count1 = 0; for(i = serverID + 1; i < nodeCount; i++) { totalReceived += packetsReceived[i]; totalSent += packetsSent[i]; if (timeReceived[i] > 0) { delayval = timeReceived[i] - timeSent[i]; delayval = delayval / 10000000; if (delayval > 0) { delay[i] = delay[i] + delayval; } } } for(i = serverID + 1; i < nodeCount; i++) { count1++; totaldelay = totaldelay + delay[i]; } avgdelay = totaldelay / count1; totalPRR = totalReceived / totalSent; } else if(msgArray.length == 6) { packetsSent[id]++; timeSent[id] = time; } } if(msgArray[0].equals("Energy")) { if(msgArray.length == 6) { e_count++; energy_t = parseInt(msgArray[5]); totalenergy = energy_t + totalenergy; energy_consumption = totalenergy / e_count; energyconsumption = energy_consumption / 1000; energyconsumption = energyconsumption / 128; } } }</script> |
Hi. Have you solved that? |
hello any give or suggest packet delivery ratio source code using cooja simulator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to plot PDR, latency, etc graph in Cooja Simulator?
now collect view is removed
The text was updated successfully, but these errors were encountered: