Change scheduler to RR
This commit is contained in:
parent
d646be8a6e
commit
5f18a8f3ea
@ -37,15 +37,15 @@ public class AccessPoint {
|
||||
* Lancer la simulation
|
||||
* @param duration
|
||||
*/
|
||||
public void startSimulation(int duration) {
|
||||
/*try{
|
||||
this.outputDataFile = new FileOutputStream("export" + File.separator + this.users.size() + ".csv", true);
|
||||
public void startSimulation(int duration, List<User> users) {
|
||||
try{
|
||||
this.outputDataFile = new FileOutputStream("export" + File.separator + users.size() + ".csv", true);
|
||||
outputDataFile.write("tick;x;y;user;bandwidth;delay;\n".getBytes());
|
||||
} catch(IOException e) {
|
||||
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
|
||||
System.exit(1);
|
||||
return;
|
||||
} */
|
||||
}
|
||||
for (int ticks = 0; ticks < duration; ++ticks) {
|
||||
// Simulation
|
||||
cell1.reset();
|
||||
@ -58,7 +58,7 @@ public class AccessPoint {
|
||||
computeInterference();
|
||||
// traite les données et les enregistre dans un fichier
|
||||
try {
|
||||
analyseData(ticks);
|
||||
analyseData(ticks, users);
|
||||
} catch (IOException e) {
|
||||
System.out.println("Can't export data");
|
||||
}
|
||||
@ -93,10 +93,10 @@ public class AccessPoint {
|
||||
}
|
||||
}
|
||||
|
||||
private void analyseData(int tick) throws IOException {
|
||||
private void analyseData(int tick, List<User> users) throws IOException {
|
||||
/* double delayAverage = 0.0;
|
||||
int nbPacketsSent = 0;
|
||||
for(User u: this.users){
|
||||
for(User u: users){
|
||||
List<Packets> packets = u.getPacketsSent();
|
||||
nbPacketsSent += packets.size();
|
||||
for (Packets p: packets){
|
||||
|
@ -9,7 +9,7 @@ public class Cell {
|
||||
|
||||
private final List<User> users;
|
||||
/**
|
||||
* scheduler utilisé par la cellule
|
||||
* Scheduler utilisé par la cellule
|
||||
*/
|
||||
private final Scheduler scheduler;
|
||||
/**
|
||||
@ -24,13 +24,6 @@ public class Cell {
|
||||
* Trame
|
||||
*/
|
||||
private final ResourceBlock[][] frame;
|
||||
/**
|
||||
* Reste pour la prochaine source
|
||||
*/
|
||||
private double leftForNextSource;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
public Cell(Scheduler scheduler, ResourceBlock[][] frame, List<User> users) {
|
||||
this.users = users;
|
||||
this.scheduler = scheduler;
|
||||
|
@ -56,13 +56,13 @@ public class Main {
|
||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
//TODO : changes schedulers
|
||||
Scheduler schedulerCell1 = new MaxSNR(frame, users);
|
||||
Scheduler schedulerCell2 = new MaxSNR(frame, users);
|
||||
Scheduler schedulerCell1 = new RoundRobin(frame, users);
|
||||
Scheduler schedulerCell2 = new RoundRobin(frame, users);
|
||||
|
||||
Cell cell1 = new Cell(schedulerCell1, frame, users);
|
||||
Cell cell2 = new Cell(schedulerCell2, frame, users);
|
||||
AccessPoint accessPoint = new AccessPoint(cell1, cell2);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks, users));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user