update main
This commit is contained in:
parent
cc73eb8a93
commit
431248b0a4
18
plot/main.py
18
plot/main.py
@ -48,13 +48,15 @@ def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
||||
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#(n/ (200 * 10000)) * 100
|
||||
allocate[nb, 1] = n
|
||||
print(n/data.shape[0])
|
||||
nb += 1
|
||||
return allocate
|
||||
|
||||
@ -68,6 +70,9 @@ 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.sort(axis=0)
|
||||
@ -87,19 +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].grid()
|
||||
|
||||
#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].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].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].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].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()
|
@ -2,6 +2,7 @@ package fr.ntr;
|
||||
|
||||
import fr.ntr.scheduler.MaxSNR;
|
||||
import fr.ntr.scheduler.ProportionalFair;
|
||||
import fr.ntr.scheduler.RoundRobin;
|
||||
import fr.ntr.scheduler.Scheduler;
|
||||
|
||||
import java.io.File;
|
||||
@ -51,8 +52,8 @@ public class Main {
|
||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
//Scheduler scheduler = new MaxSNR(frame, users);
|
||||
Scheduler scheduler = new ProportionalFair(frame, users);
|
||||
// Scheduler scheduler = new RoundRobin(frame, users);
|
||||
//Scheduler scheduler = new ProportionalFair(frame, users);
|
||||
Scheduler scheduler = new RoundRobin(frame, users);
|
||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||
}
|
||||
@ -84,4 +85,6 @@ public class Main {
|
||||
|
||||
return users;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user