Skip to content
Snippets Groups Projects
Commit 4807b49b authored by Daniel Björk's avatar Daniel Björk
Browse files

Added network_stability to generalize statistics

parent 87eda440
No related branches found
No related tags found
No related merge requests found
......@@ -119,7 +119,8 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT,
packet_count_snd = packet_count_snd + 1
#WAIT 5SEC FOR ALL PACKETS TO ARRIVE
time.sleep(3)
packet_wait_time = 3
time.sleep(packet_wait_time)
# Perhaps create a custom object where we store the statistics?
# Or from here save it directly into the database?
......@@ -138,10 +139,16 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT,
if rt_delay_array:
print 'std.dev = ', np.std(rt_delay_array)
#NETWORK STABILITY BASED ON PACKET LOSS AND DELAY, VALUE 0-100
network_stability = 0
if packet_count_rcvd == 0:
pass
else:
print 'avg.rtt = ', cumulative_delay / packet_count_rcvd
avg_packet_delay = cumulative_delay / packet_count_rcvd
#CALCULATE STABILITY
network_stability = int(((packet_count_rcvd/packet_count_snd)*(avg_packet_delay/packet_wait_time)*100)+0.5)
print 'avg.rtt = ', avg_packet_delay
#START THE THREADS FOR SENDER AND RECEIVER
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment