Skip to content
Snippets Groups Projects
Commit 4f3dd3c4 authored by Henrik Tjäder's avatar Henrik Tjäder
Browse files

Store lost packages in a variable

parent d700612d
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ from threading import Thread, Timer
import numpy as np
from array import *
#DEFINE INPUTS HERE
#CLIENT - SENDER
#UDP_DEST_IP = '::1' # IP ADDRESS TO SEND DATAGRAMS TO (v4 or v6)
......@@ -131,6 +132,7 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT,
# Or from here save it directly into the database?
PLR = 100 - ((packet_count_rcvd * 100.) / packet_count_snd)
lost = packet_count_snd - packet_count_rcvd
print('\n')
print(packet_count_snd, 'packets sent')
......@@ -178,6 +180,7 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT,
* (avg_packet_delay / packet_wait_time) * 100) + 0.5)
print('avg.rtt = ', avg_packet_delay)
print('stability = ', network_stability)
print('Lost packets = ', lost)
# Calculating MOS
# http://en.wikipedia.org/wiki/Mean_opinion_score
......@@ -194,12 +197,13 @@ def udp_client_send(UDP_DEST_IP, UDP_DEST_PORT,
else:
R = 93.2 - (EffectiveLatency - 120) / 10
# Now, let's deduct 2.5 R values per percentage of packet loss
R = R - ((packet_count_sent - packet_count_rcvd) * 2.5)
R = R - (lost * 2.5)
# Convert the R into an MOS value.(this is a known formula)
mos = 1 + (0.035) * R + (.000007) * R * (R-60) * (100-R)
print("MOS: ", mos)
#START THE THREADS FOR SENDER AND RECEIVER
if __name__ == "__main__":
receiver_thread = Thread(target=udp_client_receive,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment