starting separate cell and main
This commit is contained in:
parent
ee09401244
commit
0d5044c4f7
@ -6,8 +6,33 @@ import fr.ntr.scheduler.Scheduler;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class Cell {
|
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<User> 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<User> generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) {
|
||||||
|
List<User> 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -22,15 +22,6 @@ public class Main {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int timeSlotNb = 2;
|
|
||||||
int subCarrierNb = 100;
|
|
||||||
for(int i = 2; i < maximumLoad; i+=2) {
|
|
||||||
List<User> 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 {
|
else {
|
||||||
System.err.println("Please give launch arguments");
|
System.err.println("Please give launch arguments");
|
||||||
@ -38,17 +29,4 @@ public class Main {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<User> generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) {
|
|
||||||
List<User> 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user