Check if user is not null in computeInterference

This commit is contained in:
Remi Boure 2023-03-30 09:41:10 +02:00
parent b3507b09eb
commit 6619812a84

View File

@ -71,18 +71,22 @@ public class AccessPoint {
//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) {
if (user1 == user2 && (user1 != null || user2 != null)) {
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;
//System.out.println("Interference Cell1 /2 ="+frameCell1[k][l].getUser().getBandwidthTable()[k][l]);
//System.out.println("Interference Cell2 /2 ="+frameCell2[k][l].getUser().getBandwidthTable()[k][l]);
}
//User loin
else {
frameCell1[k][l].getUser().getBandwidthTable()[k][l] = bandwidth1 / 4;
frameCell2[k][l].getUser().getBandwidthTable()[k][l] = bandwidth2 / 4;
//System.out.println("Interference Cell1 /4 ="+frameCell1[k][l].getUser().getBandwidthTable()[k][l]);
//System.out.println("Interference Cell2 /4 ="+frameCell2[k][l].getUser().getBandwidthTable()[k][l]);
}
}
}