Main readability is over 9000
This commit is contained in:
parent
80b77f7c6d
commit
6b816534d7
@ -27,8 +27,8 @@ public class AccessPoint {
|
||||
cell2.updateBandwidth(ticks);
|
||||
cell1.schedule(ticks);
|
||||
cell2.schedule(ticks);
|
||||
//simulation des interférences
|
||||
computeInterference();
|
||||
// simulation des interférences
|
||||
// computeInterference();
|
||||
// traite les données et les enregistre dans un fichier
|
||||
try {
|
||||
cell1.analyseData(ticks);
|
||||
|
@ -41,12 +41,11 @@ public class Main {
|
||||
int timeSlotNb = 2;
|
||||
int subCarrierNb = 100;
|
||||
|
||||
|
||||
//préparation pour exportation des données
|
||||
File folder = new File("export");
|
||||
if(!folder.exists() && !folder.mkdir()) {
|
||||
System.err.println("Cannot create export folder");
|
||||
System.exit(1);
|
||||
|
||||
}
|
||||
Arrays.stream(Objects.requireNonNull(new File("export").listFiles()))
|
||||
.filter(File::isFile)
|
||||
@ -56,28 +55,38 @@ public class Main {
|
||||
}
|
||||
});
|
||||
|
||||
//instanciation des cellules, schedulers et utilisateurs
|
||||
Cell.setTimeSlotNb(timeSlotNb);
|
||||
Cell.setSubCarrierNb(subCarrierNb);
|
||||
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
for(int i = 2; i <= maximumLoad; i += 2) {
|
||||
//génération des utilisateurs
|
||||
List<User> usersCell1 = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
List<User> usersCell2 = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||
|
||||
//génération des trames
|
||||
ResourceBlock[][] frame1 = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
ResourceBlock[][] frame2 = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
|
||||
//TODO : changes schedulers
|
||||
//génération des schedulers
|
||||
Scheduler schedulerCell1 = new RoundRobin(frame1, frame2, usersCell1);
|
||||
Scheduler schedulerCell2 = new RoundRobin(frame2, frame1, usersCell2);
|
||||
try{
|
||||
|
||||
try {
|
||||
//préparation à exportation des données de chaque cellule
|
||||
FileOutputStream output = new FileOutputStream("export" + File.separator + (usersCell1.size()+usersCell2.size()) + ".csv", true);
|
||||
output.write("tick;x;y;user;bandwidth;delay;cell;\n".getBytes());
|
||||
|
||||
//création des cellules
|
||||
Cell cell1 = new Cell(0, schedulerCell1, frame1, usersCell1, output);
|
||||
Cell cell2 = new Cell(1, schedulerCell2, frame2, usersCell2, output);
|
||||
|
||||
//création de l'AccessPoint
|
||||
AccessPoint accessPoint = new AccessPoint(cell1, cell2);
|
||||
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||
} catch(IOException e) {
|
||||
}
|
||||
catch(IOException e) {
|
||||
System.err.println(e.getClass().getSimpleName() + " : " + e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
@ -85,11 +94,13 @@ public class Main {
|
||||
executor.shutdown();
|
||||
try {
|
||||
executor.awaitTermination(2, TimeUnit.MINUTES);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
executor.shutdownNow();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.err.println("Please give launch arguments");
|
||||
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
||||
System.exit(1);
|
||||
|
@ -12,9 +12,7 @@ public class User {
|
||||
private final List<Packets> packetsSent;
|
||||
private int leftForNextSource;
|
||||
private int timeInterval = 1;
|
||||
|
||||
public int totalbits = 0;
|
||||
|
||||
private int mbis;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
Reference in New Issue
Block a user