add space and maj reuse3

This commit is contained in:
iboyeau 2023-04-04 16:59:45 +02:00
parent 6b816534d7
commit f93b1c4c22
4 changed files with 20 additions and 51 deletions

View File

@ -39,31 +39,4 @@ public class AccessPoint {
} }
} }
public void computeInterference() {
ResourceBlock[][] frameCell1 = cell1.getFrame();
ResourceBlock[][] frameCell2 = cell2.getFrame();
for (int k = 0; k < frameCell1.length; k++) {
for (int l = 0; l < frameCell1[k].length; l++) {
//interférences si les deux cellules parlent au même UE sur le même time slot
User user1 = frameCell1[k][l].getUser();
User user2 = frameCell2[k][l].getUser();
if ((user1 != null || user2 != null) && user1 == user2) {
double bandwidth1 = frameCell1[k][l].getBandwidth();
double bandwidth2 = frameCell2[k][l].getBandwidth();
//User proche
if (user1.getDistance() < 200d) {
frameCell1[k][l].getUser().getBandwidthTable()[k][l] = bandwidth1 / 2;
frameCell2[k][l].getUser().getBandwidthTable()[k][l] = bandwidth2 / 2;
}
//User loin
else {
frameCell1[k][l].getUser().getBandwidthTable()[k][l] = bandwidth1 / 4;
frameCell2[k][l].getUser().getBandwidthTable()[k][l] = bandwidth2 / 4;
}
}
}
}
}
} }

View File

@ -22,7 +22,7 @@ public class Main {
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
//TODO make this cleanly
boolean isReuse3 = false; //reuse 1 par défaut sinon reuse 3 boolean isReuse3 = false; //reuse 1 par défaut sinon reuse 3
int nbcell = 2; //nombre de cellules que l'on va utiliser int nbcell = 2; //nombre de cellules que l'on va utiliser
@ -39,7 +39,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;
int subCarrierNb = 100; //nb subcarrier si reuse1 ou reuse3
int subCarrierNb;
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");

View File

@ -26,13 +26,6 @@ public class MaxSNR extends Scheduler {
allocateRessource(userMax, myFrame, neighborFrame, ts, sp, ticks); allocateRessource(userMax, myFrame, neighborFrame, ts, sp, ticks);
} }
} }
for(int ts = 0; ts < 2; ts++){
for(int sp = 0; sp < 100; sp++){
userMax = userSelection(ts, sp);
allocateRessource(userMax, myFrame, neighborFrame, ts, sp, ticks);
}
}
} }
/** /**
@ -48,7 +41,6 @@ public class MaxSNR extends Scheduler {
if (!u.getPacketsToSend().isEmpty() && (maxSnr < u.getBandwidthTable()[ts][sp])) { if (!u.getPacketsToSend().isEmpty() && (maxSnr < u.getBandwidthTable()[ts][sp])) {
maxSnr = u.getBandwidthTable()[ts][sp]; maxSnr = u.getBandwidthTable()[ts][sp];
userMax = u; userMax = u;
} }
} }
return userMax; return userMax;

View File

@ -6,11 +6,7 @@ import fr.ntr.User;
public abstract class Scheduler { public abstract class Scheduler {
/**
* Entry
* Rempli la trame avec les utilisateurs
* Return
*/
public abstract void scheduling(int ticks); public abstract void scheduling(int ticks);
protected void allocateRessource(User userMax, ResourceBlock[][] myFrame, ResourceBlock[][] neighborFrame, int ts, int sp, int ticks) { protected void allocateRessource(User userMax, ResourceBlock[][] myFrame, ResourceBlock[][] neighborFrame, int ts, int sp, int ticks) {
@ -24,12 +20,12 @@ public abstract class Scheduler {
//User proche //User proche
if (userMax.getDistance() < 200d) { if (userMax.getDistance() < 200d) {
rb1.getUser().getBandwidthTable()[ts][sp] = bandwidth1 / 2; rb1.getUser().getBandwidthTable()[ts][sp] = bandwidth1 / 2;
rb2.getUser().getBandwidthTable()[ts][sp] = bandwidth2 / 2; //rb2.getUser().getBandwidthTable()[ts][sp] = bandwidth2 / 2;
} }
//User loin //User loin
else { else {
rb1.getUser().getBandwidthTable()[ts][sp] = bandwidth1 / 4; rb1.getUser().getBandwidthTable()[ts][sp] = bandwidth1 / 4;
rb2.getUser().getBandwidthTable()[ts][sp] = bandwidth2 / 4; //rb2.getUser().getBandwidthTable()[ts][sp] = bandwidth2 / 4;
} }
} }
Packets p = userMax.getPacketsToSend().get(userMax.getPacketsToSend().size()-1); Packets p = userMax.getPacketsToSend().get(userMax.getPacketsToSend().size()-1);