2023-03-24 10:37:35 +01:00
|
|
|
import os
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
|
2023-03-24 10:48:49 +01:00
|
|
|
nb_files = os.listdir(".." + os.sep + "export")
|
2023-03-24 10:37:35 +01:00
|
|
|
|
|
|
|
size = len(nb_files)
|
|
|
|
|
|
|
|
|
2023-03-31 11:57:12 +02:00
|
|
|
def mean_mkn(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
2023-03-24 11:12:40 +01:00
|
|
|
averages_mkn = np.empty((size, 2))
|
|
|
|
nb = 0
|
2023-03-31 11:57:12 +02:00
|
|
|
for nb_users, data in arr:
|
2023-03-24 11:12:40 +01:00
|
|
|
rb = data[:, 4]
|
|
|
|
|
|
|
|
total = 0.0
|
|
|
|
for x in rb:
|
|
|
|
total = total + x
|
|
|
|
average = total / len(rb)
|
2023-03-31 11:57:12 +02:00
|
|
|
averages_mkn[nb, 0] = nb_users
|
2023-03-24 11:12:40 +01:00
|
|
|
averages_mkn[nb, 1] = average
|
|
|
|
nb += 1
|
|
|
|
return averages_mkn
|
|
|
|
|
|
|
|
|
2023-03-31 11:57:12 +02:00
|
|
|
def rb_available(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
2023-03-24 11:41:34 +01:00
|
|
|
available = np.zeros((size, 2))
|
|
|
|
nb = 0
|
2023-03-31 11:57:12 +02:00
|
|
|
for nb_users, data in arr:
|
|
|
|
available[nb, 0] = nb_users
|
2023-03-28 09:30:21 +02:00
|
|
|
available[nb, 1] = (data.shape[0] / (200 * 10000)) * 100
|
2023-03-24 11:41:34 +01:00
|
|
|
nb += 1
|
|
|
|
return available
|
|
|
|
|
2023-03-30 08:24:25 +02:00
|
|
|
|
2023-03-31 11:57:12 +02:00
|
|
|
def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
2023-03-28 09:25:04 +02:00
|
|
|
delays = np.zeros((size, 2))
|
|
|
|
nb = 0
|
2023-03-31 11:57:12 +02:00
|
|
|
for nb_users, data in arr:
|
2023-03-28 09:25:04 +02:00
|
|
|
d = data[:, 5]
|
|
|
|
for x in d:
|
2023-03-31 11:57:12 +02:00
|
|
|
delays[nb, 0] = nb_users
|
2023-03-28 09:25:04 +02:00
|
|
|
delays[nb, 1] = float(x)
|
|
|
|
nb += 1
|
|
|
|
return delays
|
2023-03-24 11:41:34 +01:00
|
|
|
|
2023-03-30 08:24:25 +02:00
|
|
|
|
2023-03-31 11:57:12 +02:00
|
|
|
np_arr: list[tuple[int, np.ndarray]] = list()
|
|
|
|
for i in nb_files:
|
|
|
|
np_arr.append((int(i.split(".")[0]), pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()))
|
|
|
|
|
|
|
|
averages = mean_mkn(np_arr)
|
|
|
|
available = rb_available(np_arr)
|
|
|
|
delays = delay(np_arr)
|
2023-03-28 09:35:26 +02:00
|
|
|
delays.sort(axis=0)
|
2023-03-24 10:37:35 +01:00
|
|
|
# Data for plotting
|
|
|
|
averages.sort(axis=0)
|
|
|
|
|
|
|
|
fig, ax = plt.subplots()
|
2023-03-24 11:41:34 +01:00
|
|
|
ax.scatter(averages[:, 0], averages[:, 1])
|
2023-03-24 10:37:35 +01:00
|
|
|
|
2023-03-24 11:41:34 +01:00
|
|
|
ax.set(xlabel='number of users', ylabel='Efficacité spectrale', title='Efficacité spectrale')
|
2023-03-24 10:37:35 +01:00
|
|
|
ax.grid()
|
|
|
|
|
|
|
|
# fig.savefig("test.png")
|
|
|
|
plt.show()
|
2023-03-24 11:41:34 +01:00
|
|
|
|
|
|
|
fig, ax = plt.subplots()
|
|
|
|
ax.scatter(available[:, 0], available[:, 1])
|
|
|
|
ax.set(xlabel='number of users', ylabel='RB utilisés', title='Pourcentage de RB utilisés')
|
|
|
|
ax.grid()
|
2023-03-28 09:35:26 +02:00
|
|
|
plt.show()
|
|
|
|
|
|
|
|
fig, ax = plt.subplots()
|
|
|
|
ax.scatter(delays[:, 0], delays[:, 1])
|
|
|
|
ax.set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
|
|
|
|
ax.grid()
|
2023-03-31 11:57:12 +02:00
|
|
|
plt.show()
|