added interference simulation in startSimulation()

This commit is contained in:
Loris 2023-03-28 08:59:16 +02:00
parent 5c533d37cc
commit ebba05aa0a

View File

@ -47,6 +47,32 @@ public class AccessPoint {
cell2.updateBandwidth(ticks);
cell1.schedule();
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);
}
}
}
}
// traite les données et les enregistre dans un fichier
/* try {