From 6619812a84cd6fd690f2afefff3fb53229c90792 Mon Sep 17 00:00:00 2001 From: Remi Boure Date: Thu, 30 Mar 2023 09:41:10 +0200 Subject: [PATCH] Check if user is not null in computeInterference --- src/main/java/fr/ntr/AccessPoint.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index e3026b2..cc53ea8 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -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]); } } }