try to create cell (to verify)
This commit is contained in:
parent
0d5044c4f7
commit
4c33dac028
@ -1,6 +1,7 @@
|
|||||||
package fr.ntr;
|
package fr.ntr;
|
||||||
|
|
||||||
import fr.ntr.scheduler.MaxSNR;
|
import fr.ntr.scheduler.MaxSNR;
|
||||||
|
import fr.ntr.scheduler.RoundRobin;
|
||||||
import fr.ntr.scheduler.Scheduler;
|
import fr.ntr.scheduler.Scheduler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -9,18 +10,32 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
public class Cell {
|
public class Cell {
|
||||||
|
private int maximumLoad;
|
||||||
|
private int numberOfTicks;
|
||||||
|
private List<User> Users;
|
||||||
|
|
||||||
public static void createCell(int maximumLoad, int generateUsers, int numberOfTicks) {
|
public Cell(){
|
||||||
|
this.maximumLoad=0;
|
||||||
|
this.numberOfTicks=0;
|
||||||
|
this.Users=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cell createCell(int maximumLoad,int numberOfTicks) {
|
||||||
|
Cell currentCell = new Cell();
|
||||||
|
currentCell.maximumLoad=maximumLoad;
|
||||||
|
currentCell.numberOfTicks=numberOfTicks;
|
||||||
int timeSlotNb = 2;
|
int timeSlotNb = 2;
|
||||||
int subCarrierNb = 100;
|
int subCarrierNb = 100;
|
||||||
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);
|
||||||
|
currentCell.Users=users;
|
||||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||||
//Scheduler scheduler = new RoundRobin("round robin", 0, frame, users);
|
//Scheduler scheduler = new RoundRobin("round robin", 0, frame, users);
|
||||||
Scheduler scheduler = new MaxSNR(frame, users);
|
Scheduler scheduler = new MaxSNR(frame, users);
|
||||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
||||||
accessPoint.startSimulation(numberOfTicks);
|
accessPoint.startSimulation(numberOfTicks);
|
||||||
}
|
}
|
||||||
|
return currentCell;
|
||||||
}
|
}
|
||||||
private static List<User> generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) {
|
private static List<User> generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) {
|
||||||
List<User> users = new ArrayList<>();
|
List<User> users = new ArrayList<>();
|
||||||
|
@ -3,10 +3,14 @@ package fr.ntr;
|
|||||||
import fr.ntr.scheduler.MaxSNR;
|
import fr.ntr.scheduler.MaxSNR;
|
||||||
import fr.ntr.scheduler.RoundRobin;
|
import fr.ntr.scheduler.RoundRobin;
|
||||||
import fr.ntr.scheduler.Scheduler;
|
import fr.ntr.scheduler.Scheduler;
|
||||||
|
import fr.ntr.Cell;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import fr.ntr.Cell;
|
||||||
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -22,6 +26,10 @@ public class Main {
|
|||||||
System.exit(1);
|
System.exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO Verify this
|
||||||
|
Cell cell1= new Cell();
|
||||||
|
cell1 = cell1.createCell(maximumLoad,numberOfTicks);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
System.err.println("Please give launch arguments");
|
System.err.println("Please give launch arguments");
|
||||||
|
Reference in New Issue
Block a user