Merge branch 'ajout_cellule' of gitlab.istic.univ-rennes1.fr:18008147/ntr into ajout_cellule

This commit is contained in:
Quentin Legot 2023-04-07 10:31:48 +02:00
commit 797b2a17f7
2 changed files with 14 additions and 21 deletions

View File

@ -7,6 +7,8 @@ public class AccessPoint {
private final Cell cell1;
private final Cell cell2;
private final Boolean reuse3 = false;
public AccessPoint (Cell cell1, Cell cell2){
this.cell1 = cell1;
this.cell2 = cell2;
@ -27,15 +29,16 @@ public class AccessPoint {
cell1.preScheduling();
cell2.preScheduling();
for(int ts = 0; ts < Cell.getTimeSlotNb(); ts++) {
for (int sp = 0; sp < Cell.getSubCarrierNb(); sp++) {
User user1 = cell1.schedule(ticks, ts, sp);
User user2 = cell2.schedule(ticks, ts, sp);
boolean haveInterference = user1 == user2 && user1 != null;
cell1.consumeResource(ticks, ts, sp, haveInterference);
cell2.consumeResource(ticks, ts, sp, haveInterference);
for (int sp = 0; sp < (reuse3 ? Cell.getSubCarrierNb() : Cell.getSubCarrierNb()/2); sp++) {
User user1 = cell1.schedule(ticks, ts, sp);
User user2 = cell2.schedule(ticks, ts, reuse3 ? 0 : 50 + sp);
boolean haveInterference = user1 == user2 && user1 != null;
cell1.consumeResource(ticks, ts, sp, haveInterference);
cell2.consumeResource(ticks, ts, sp, haveInterference);
cell1.postScheduling(user1);
cell2.postScheduling(user2);
cell1.postScheduling(user1);
cell2.postScheduling(user2);
}
}

View File

@ -18,14 +18,9 @@ public class Main {
public static void main (String[] args) {
if (args.length == 2) {
int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation
int maximumLoad; // Nombre maximal d'utilisateurs dans le système
boolean isReuse3 = false; //reuse 1 par défaut sinon reuse 3
int nbcell = 2; //nombre de cellules que l'on va utiliser
//instancie numberOfTicks et maximumLoad
try {
numberOfTicks = Integer.parseInt(args[0]);
@ -40,20 +35,15 @@ public class Main {
//instancie nombre de time slots et sous-porteuses
int timeSlotNb = 2;
//nb subcarrier si reuse1 ou reuse3
int subCarrierNb;
if (isReuse3) {
subCarrierNb = 100 / nbcell;
}
else{
subCarrierNb = 100;
}
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);
System.exit(1);
}
Arrays.stream(Objects.requireNonNull(new File("export").listFiles()))
.filter(File::isFile)