diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index f77f4f5..ff0634d 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -49,29 +49,7 @@ public class AccessPoint { cell2.schedule(); //simulation des interférences - 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 == user2) { - double bandwidth1 = frameCell1[k][l].getBandwidth(); - double bandwidth2 = frameCell2[k][l].getBandwidth(); - //2 cas: utilisateur proche ou loin - if (user1.getDistance() > 200d) { - frameCell1[k][l].setBandwidth(bandwidth1 / 2); - frameCell2[k][l].setBandwidth(bandwidth2 / 2); - } - else { - frameCell1[k][l].setBandwidth(bandwidth1 / 4); - frameCell2[k][l].setBandwidth(bandwidth2 / 4); - } - } - } - } + computeInterference(); // traite les données et les enregistre dans un fichier @@ -84,6 +62,32 @@ 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 == user2) { + double bandwidth1 = frameCell1[k][l].getBandwidth(); + double bandwidth2 = frameCell2[k][l].getBandwidth(); + //User proche + if (user1.getDistance() > 200d) { + frameCell1[k][l].setBandwidth(bandwidth1 / 2); + frameCell2[k][l].setBandwidth(bandwidth2 / 2); + } + //User loin + else { + frameCell1[k][l].setBandwidth(bandwidth1 / 4); + frameCell2[k][l].setBandwidth(bandwidth2 / 4); + } + } + } + } + } /* private void analyseData(int tick) throws IOException { for(int i = 0; i < cell1.getFrame().length; i++) {