reuse3 selector

This commit is contained in:
iboyeau 2023-04-07 10:22:06 +02:00
parent ede383eab8
commit d00e5d70de
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 cell1;
private final Cell cell2; private final Cell cell2;
private final Boolean reuse3 = false;
public AccessPoint (Cell cell1, Cell cell2){ public AccessPoint (Cell cell1, Cell cell2){
this.cell1 = cell1; this.cell1 = cell1;
this.cell2 = cell2; this.cell2 = cell2;
@ -27,15 +29,16 @@ public class AccessPoint {
cell1.preScheduling(); cell1.preScheduling();
cell2.preScheduling(); cell2.preScheduling();
for(int ts = 0; ts < Cell.getTimeSlotNb(); ts++) { for(int ts = 0; ts < Cell.getTimeSlotNb(); ts++) {
for (int sp = 0; sp < Cell.getSubCarrierNb(); sp++) { for (int sp = 0; sp < (reuse3 ? Cell.getSubCarrierNb() : Cell.getSubCarrierNb()/2); sp++) {
User user1 = cell1.schedule(ticks, ts, sp); User user1 = cell1.schedule(ticks, ts, sp);
User user2 = cell2.schedule(ticks, ts, sp); User user2 = cell2.schedule(ticks, ts, reuse3 ? 0 : 50 + sp);
boolean haveInterference = user1 == user2 && user1 != null; boolean haveInterference = user1 == user2 && user1 != null;
cell1.consumeResource(ticks, ts, sp, haveInterference); cell1.consumeResource(ticks, ts, sp, haveInterference);
cell2.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) { public static void main (String[] args) {
if (args.length == 2) { if (args.length == 2) {
int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation
int maximumLoad; // Nombre maximal d'utilisateurs dans le système 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 //instancie numberOfTicks et maximumLoad
try { try {
numberOfTicks = Integer.parseInt(args[0]); numberOfTicks = Integer.parseInt(args[0]);
@ -40,20 +35,15 @@ public class Main {
//instancie nombre de time slots et sous-porteuses //instancie nombre de time slots et sous-porteuses
int timeSlotNb = 2; int timeSlotNb = 2;
//nb subcarrier si reuse1 ou reuse3 //nb subcarrier si reuse1 ou reuse3
int subCarrierNb; int subCarrierNb = 100;
if (isReuse3) {
subCarrierNb = 100 / nbcell;
}
else{
subCarrierNb = 100;
}
//préparation pour exportation des données //préparation pour exportation des données
File folder = new File("export"); File folder = new File("export");
if (!folder.exists() && !folder.mkdir()) { if (!folder.exists() && !folder.mkdir()) {
System.err.println("Cannot create export folder"); System.err.println("Cannot create export folder");
System.exit(1); System.exit(1);
} }
Arrays.stream(Objects.requireNonNull(new File("export").listFiles())) Arrays.stream(Objects.requireNonNull(new File("export").listFiles()))
.filter(File::isFile) .filter(File::isFile)