Fix RR (still found errors in createPackets)

This commit is contained in:
Quentin Legot 2023-03-17 11:33:08 +01:00
parent 0f61c29fe9
commit ef7e5f287a
3 changed files with 6 additions and 7 deletions

View File

@ -103,7 +103,6 @@ public class AccessPoint {
}
private void reset() {
this.users = new ArrayList<>();
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb];
}

View File

@ -41,9 +41,9 @@ public class Main {
List<User> users = new ArrayList<>();
// 2 groupes d'utilisateurs, proches et éloignés
double[] distance = { 200d, 1000d };
for (int i = 0; i < distance.length; i++) {
for(int j = 0; j < nbUsers; j++){
User user = new User(distance[i], timeSlotNb, subCarrierNb);
for (double v : distance) {
for (int j = 0; j < nbUsers; j++) {
User user = new User(v, timeSlotNb, subCarrierNb);
users.add(user);
}
}

View File

@ -31,13 +31,13 @@ public class RoundRobin extends Scheduler {
public void scheduling() {
//selection aleatoire du premier utilisateur
Random random = new Random();
index = random.nextInt(users.size()-1);
index = random.nextInt(users.size());
//Pour chaque time slot et sous porteuses
for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) {
for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) {
// on enleve le packet transmis de la liste
// TO Verify sub the packet send need Set packet
// on enlève le packet transmis de la liste
// TODO Verify sub the packet send need Set packet
users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0));
users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0));
//on ajoute l'utilisateur a la frame