diff --git a/src/main/java/fr/ntr/Cell.java b/src/main/java/fr/ntr/Cell.java index b0772d2..f3a0815 100644 --- a/src/main/java/fr/ntr/Cell.java +++ b/src/main/java/fr/ntr/Cell.java @@ -6,8 +6,33 @@ import fr.ntr.scheduler.Scheduler; import java.util.ArrayList; import java.util.List; + + public class Cell { - public static void createCell() { + public static void createCell(int maximumLoad, int generateUsers, int numberOfTicks) { + int timeSlotNb = 2; + int subCarrierNb = 100; + for(int i = 2; i < maximumLoad; i+=2) { + List users = generateUsers(i, timeSlotNb, subCarrierNb); + ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; + //Scheduler scheduler = new RoundRobin("round robin", 0, frame, users); + Scheduler scheduler = new MaxSNR(frame, users); + AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); + accessPoint.startSimulation(numberOfTicks); + } } + private static List generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) { + List users = new ArrayList<>(); + // 2 groupes d'utilisateurs, proches et éloignés + double[] distance = { 200d, 1000d }; + for (double v : distance) { + for (int j = 0; j < nbUsers; j++) { + User user = new User(v, timeSlotNb, subCarrierNb); + users.add(user); + } + } + return users; + } + } \ No newline at end of file diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index ac4f32a..b02106d 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -22,15 +22,6 @@ public class Main { System.exit(1); return; } - int timeSlotNb = 2; - int subCarrierNb = 100; - for(int i = 2; i < maximumLoad; i+=2) { - List users = generateUsers(i, timeSlotNb, subCarrierNb); - ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; - Scheduler scheduler = new MaxSNR(frame, users); - AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); - accessPoint.startSimulation(numberOfTicks); - } } else { System.err.println("Please give launch arguments"); @@ -38,17 +29,4 @@ public class Main { System.exit(1); } } - - private static List generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) { - List users = new ArrayList<>(); - // 2 groupes d'utilisateurs, proches et éloignés - double[] distance = { 200d, 1000d }; - for (double v : distance) { - for (int j = 0; j < nbUsers; j++) { - User user = new User(v, timeSlotNb, subCarrierNb); - users.add(user); - } - } - return users; - } } \ No newline at end of file