try to create cell (to verify)

This commit is contained in:
iboyeau 2023-03-24 10:52:39 +01:00
parent 0d5044c4f7
commit 4c33dac028
2 changed files with 24 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package fr.ntr;
import fr.ntr.scheduler.MaxSNR;
import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler;
import java.util.ArrayList;
@ -9,18 +10,32 @@ import java.util.List;
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 subCarrierNb = 100;
for(int i = 2; i < maximumLoad; i+=2) {
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
currentCell.Users=users;
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);
}
return currentCell;
}
private static List<User> generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) {
List<User> users = new ArrayList<>();

View File

@ -3,10 +3,14 @@ package fr.ntr;
import fr.ntr.scheduler.MaxSNR;
import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler;
import fr.ntr.Cell;
import java.util.ArrayList;
import java.util.List;
import fr.ntr.Cell;
public class Main {
public static void main(String[] args) {
@ -22,6 +26,10 @@ public class Main {
System.exit(1);
return;
}
//TODO Verify this
Cell cell1= new Cell();
cell1 = cell1.createCell(maximumLoad,numberOfTicks);
}
else {
System.err.println("Please give launch arguments");