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