From 671ccd2b1863ab12fb2f331b94ddc5f84e9cb3a4 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 31 Mar 2023 09:34:51 +0200 Subject: [PATCH] fix MaxSNR --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 809cd99..c56f9e5 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -35,10 +35,12 @@ public class MaxSNR extends Scheduler { private User userSelection(int ts, int sp) { double maxSnr = 0.0; User userMax = null; - for(User u: users){ - if (maxSnr < u.getBandwidthTable()[ts][sp]) { - maxSnr = u.getBandwidthTable()[ts][sp]; - userMax = u; + for(User u: users) { + if (!u.getPacketsToSend().isEmpty()) { + if (maxSnr < u.getBandwidthTable()[ts][sp]) { + maxSnr = u.getBandwidthTable()[ts][sp]; + userMax = u; + } } } return userMax;