This commit is contained in:
Tr1xt4n 2023-04-07 08:12:46 +02:00
parent 376c76b17c
commit cc73eb8a93

View File

@ -45,19 +45,18 @@ def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
nb += 1
return delays
def rb_available_distance(arr: list[tuple[int, np.ndarray]], distance) -> np.ndarray:
available = np.zeros((size, 2))
def rb_allocate_distance(arr: list[tuple[int, np.ndarray]], distance) -> np.ndarray:
allocate = np.zeros((size, 2))
nb = 0
for nb_users, data in arr:
n = 0
for x in data[:,6]:
if int(x) == distance:
n+=1
available[nb, 0] = nb_users
available[nb, 1] = n/ (200 * 10000) * 100
allocate[nb, 0] = nb_users
allocate[nb, 1] = n#(n/ (200 * 10000)) * 100
nb += 1
return available
return allocate
np_arr: list[tuple[int, np.ndarray]] = list()
@ -67,8 +66,8 @@ for i in nb_files:
averages = mean_mkn(np_arr)
available = rb_available(np_arr)
available_lp1 = rb_available_distance(np_arr, 200)
available_lp2 = rb_available_distance(np_arr, 400)
allocate_lp1 = rb_allocate_distance(np_arr, 200)
allocate_lp2 = rb_allocate_distance(np_arr, 400)
delays = delay(np_arr)
delays.sort(axis=0)
@ -88,9 +87,18 @@ ax[1, 0].scatter(delays[:, 0], delays[:, 1])
ax[1, 0].set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
ax[1, 0].grid()
#ax[1, 1].scatter(available[:, 0], (available_lp1[:, 1]/available_lp2[:, 1])/available[:, 1] * 100)
ax[1, 1].scatter(available[:, 0], available_lp1[:, 1])
ax[1, 1].scatter(available[:, 0], available_lp2[:, 1])
#ax[1, 1].scatter(available[:, 0], (available[:, 1]/available_lp1[:, 1]/available_lp2[:, 1])*100)
available.sort(axis=0)
ax[1, 1].scatter(available[:, 0], (allocate_lp1[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100)
ax[1, 1].plot(available[:, 0], (allocate_lp1[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100)
ax[1, 1].scatter(available[:, 0], (allocate_lp2[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100)
ax[1, 1].plot(available[:, 0], (allocate_lp2[:, 1]/(allocate_lp1[:, 1] + allocate_lp2[:, 1]))*100)
ax[1, 1].set(xlabel='number of users', ylabel='RB utilisés proche/loin/total', title='RB utilisés distance')
ax[1, 1].grid()