Compare commits

...
This repository has been archived on 2023-08-28. You can view files and clone it, but cannot push or open issues or pull requests.

4 Commits

Author SHA1 Message Date
Tr1xt4n
431248b0a4 update main 2023-04-13 10:56:15 +02:00
Tr1xt4n
cc73eb8a93 maj 2023-04-07 08:12:46 +02:00
Tr1xt4n
376c76b17c Merge branch 'master' of https://gitlab.istic.univ-rennes1.fr/18008147/ntr 2023-04-04 11:08:48 +02:00
Tr1xt4n
5b695174a6 4eme courbe 2023-04-04 09:56:16 +02:00
2 changed files with 42 additions and 3 deletions

View File

@ -45,6 +45,21 @@ def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
nb += 1 nb += 1
return delays return delays
def rb_allocate_distance(arr: list[tuple[int, np.ndarray]], distance) -> np.ndarray:
allocate = np.zeros((size, 2))
nb = 0
arr.sort()
for nb_users, data in arr:
n = 0
for x in data[:,6]:
if int(x) == distance:
n+=1
allocate[nb, 0] = nb_users
allocate[nb, 1] = n
print(n/data.shape[0])
nb += 1
return allocate
np_arr: list[tuple[int, np.ndarray]] = list() np_arr: list[tuple[int, np.ndarray]] = list()
for i in nb_files: for i in nb_files:
@ -52,6 +67,13 @@ 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)
allocate_lp1 = rb_allocate_distance(np_arr, 200)
allocate_lp2 = rb_allocate_distance(np_arr, 400)
allocate_total = allocate_lp1[:, 1] + allocate_lp2[:, 1]
print(allocate_total)
delays = delay(np_arr) delays = delay(np_arr)
delays.sort(axis=0) delays.sort(axis=0)
# Data for plotting # Data for plotting
@ -70,4 +92,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()
available.sort(axis=0)
#ax[1, 1].scatter(allocate_lp1[:, 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(allocate_lp2[:, 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()
plt.ylim(0, 100)
plt.show() plt.show()

View File

@ -2,6 +2,7 @@ package fr.ntr;
import fr.ntr.scheduler.MaxSNR; import fr.ntr.scheduler.MaxSNR;
import fr.ntr.scheduler.ProportionalFair; import fr.ntr.scheduler.ProportionalFair;
import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler; import fr.ntr.scheduler.Scheduler;
import java.io.File; import java.io.File;
@ -50,9 +51,9 @@ public class Main {
for(int i = 2; i <= maximumLoad; i += 2) { for(int i = 2; i <= maximumLoad; i += 2) {
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb); List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
// Scheduler scheduler = new MaxSNR(frame, users); //Scheduler scheduler = new MaxSNR(frame, users);
Scheduler scheduler = new ProportionalFair(frame, users); //Scheduler scheduler = new ProportionalFair(frame, users);
// Scheduler scheduler = new RoundRobin(frame, users); Scheduler scheduler = new RoundRobin(frame, users);
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users); AccessPoint accessPoint = new AccessPoint(scheduler, frame, users);
executor.submit(() -> accessPoint.startSimulation(numberOfTicks)); executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
} }
@ -84,4 +85,6 @@ public class Main {
return users; return users;
} }
} }