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

This commit is contained in:
Remi Boure 2023-03-30 08:40:04 +02:00
commit b3507b09eb
2 changed files with 38 additions and 20 deletions

View File

@ -12,8 +12,8 @@ import fr.ntr.scheduler.Scheduler;
public class AccessPoint { public class AccessPoint {
private Cell cell1; private final Cell cell1;
private Cell cell2; private final Cell cell2;
private List<User> users; private List<User> users;
private FileOutputStream outputDataFile; private FileOutputStream outputDataFile;
@ -66,7 +66,7 @@ public class AccessPoint {
ResourceBlock[][] frameCell1 = cell1.getFrame(); ResourceBlock[][] frameCell1 = cell1.getFrame();
ResourceBlock[][] frameCell2 = cell2.getFrame(); ResourceBlock[][] frameCell2 = cell2.getFrame();
for (int k = 0; k > frameCell1.length; k++ ) { for (int k = 0; k < frameCell1.length; k++ ) {
for (int l = 0; l < frameCell1[k].length; l++) { 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 //interférences si les deux cellules parlent au même UE sur le même time slot
User user1 = frameCell1[k][l].getUser(); User user1 = frameCell1[k][l].getUser();
@ -75,7 +75,7 @@ public class AccessPoint {
double bandwidth1 = frameCell1[k][l].getBandwidth(); double bandwidth1 = frameCell1[k][l].getBandwidth();
double bandwidth2 = frameCell2[k][l].getBandwidth(); double bandwidth2 = frameCell2[k][l].getBandwidth();
//User proche //User proche
if (user1.getDistance() > 200d) { if (user1.getDistance() < 200d) {
frameCell1[k][l].getUser().getBandwidthTable()[k][l] = bandwidth1 / 2; frameCell1[k][l].getUser().getBandwidthTable()[k][l] = bandwidth1 / 2;
frameCell2[k][l].getUser().getBandwidthTable()[k][l] = bandwidth2 / 2; frameCell2[k][l].getUser().getBandwidthTable()[k][l] = bandwidth2 / 2;
} }
@ -86,15 +86,35 @@ public class AccessPoint {
} }
} }
} }
// traite les données et les enregistre dans un fichier
/* try {
analyseData(ticks);
} catch (IOException e) {
System.out.println("Can't export data");
}*/
} }
} }
/* /*
private void analyseData(int tick) throws IOException { private void analyseData(int tick) throws IOException {
for(int i = 0; i < cell1.getFrame().length; i++) { double delayAverage = 0.0;
for(int j = 0; j < cell1.getFrame()[i].length; j++) { int nbPacketsSent = 0;
ResourceBlock ur = cell1.getFrame()[i][j]; for(User u: this.users){
List<Packets> packets = u.getPacketsSent();
nbPacketsSent += packets.size();
for (Packets p: packets){
delayAverage += p.getDurationSending();
}
}
/*delayAverage = delayAverage/nbPacketsSent;
for(int i = 0; i < frame.length; i++) {
for(int j = 0; j < frame[i].length; j++) {
ResourceBlock ur = frame[i][j];
if(ur.getUser() != null) { if(ur.getUser() != null) {
String data = (tick + ";" + i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n"); String data = (tick + ";" + i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";" + delayAverage +";\n");
try{ try{
outputDataFile.write(data.getBytes()); outputDataFile.write(data.getBytes());
}catch(IOException e){ }catch(IOException e){
@ -104,7 +124,5 @@ public class AccessPoint {
} }
} }
} }
} }*/
}
*/
} }

View File

@ -25,7 +25,7 @@ public class Main {
} }
int timeSlotNb = 2; int timeSlotNb = 2;
int subCarrierNb = 100; int subCarrierNb = 100;
for(int i = 2; i < maximumLoad; i+=2) { for(int i = 2; i < maximumLoad; i += 2) {
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb); List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
//TODO : changes schedulers //TODO : changes schedulers