From 69203e16461d44ef9135834244fad4159f949cbe Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 10 Mar 2023 09:17:15 +0100 Subject: [PATCH 1/6] blabla --- src/main/java/fr/ntr/AccessPoint.java | 2 +- src/main/java/fr/ntr/Main.java | 2 +- src/main/java/fr/ntr/Packets.java | 2 +- src/main/java/fr/ntr/scheduler/MaxSNR.java | 16 ++++++++++++---- src/main/java/fr/ntr/scheduler/RoundRobin.java | 7 ------- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index ce47e14..92fad87 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -54,4 +54,4 @@ public class AccessPoint { public int getFrameSize(){ return this.timeSlotNb * this.subCarrierNb; } -} +} \ No newline at end of file diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index 06e6613..ff789fa 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -19,4 +19,4 @@ public class Main { System.out.println("Hello World"); } -} +} \ No newline at end of file diff --git a/src/main/java/fr/ntr/Packets.java b/src/main/java/fr/ntr/Packets.java index d52ecab..3036906 100644 --- a/src/main/java/fr/ntr/Packets.java +++ b/src/main/java/fr/ntr/Packets.java @@ -13,4 +13,4 @@ public class Packets { this.bitsNumberRemaining = bitsNumberRemaining; this.user = user; } -} +} \ No newline at end of file diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 41e0ceb..d81bb8a 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -5,14 +5,22 @@ import fr.ntr.User; public class MaxSNR extends Scheduler { private String name; - - + @Override public void scheduling() { } - private void selectionUtilisateur(int Ts, int Sp, List Users) { - + private User selectionUtilisateur(int Ts, int Sp, List Users) { + User selectedUser = null; + double maxSNR= 0; + for (User user : Users) { + double snr = (Math.log(1 + effSpect) / Math.log(2)); + if (snr > maxSNR) { + maxSNR = snr; + selectedUser = user; + } + } + return selectedUser; } public MaxSNR(String name) { diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 1db8218..0d19b57 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -22,12 +22,5 @@ public class RoundRobin extends Scheduler { //Sp =sous porteuse private void selectionUtilisateur(int Ts, int Sp, List Users) { int random = new Random().nextInt(0, Users.size()-1); - - } - - - - - } From fb37cd6d62e968bda9bf4cee4651e40132b6ffc7 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 10 Mar 2023 09:29:10 +0100 Subject: [PATCH 2/6] conf --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index d81bb8a..7f50f67 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -14,7 +14,7 @@ public class MaxSNR extends Scheduler { User selectedUser = null; double maxSNR= 0; for (User user : Users) { - double snr = (Math.log(1 + effSpect) / Math.log(2)); + double snr = ; if (snr > maxSNR) { maxSNR = snr; selectedUser = user; From 57b477a5782889cd3c4f5f7fb808499efb0a1ee0 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 10 Mar 2023 11:01:51 +0100 Subject: [PATCH 3/6] conflit 1 --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 13 ++----------- src/main/java/fr/ntr/scheduler/RoundRobin.java | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 5347c32..4dca0c4 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -11,17 +11,8 @@ public class MaxSNR extends Scheduler { public void scheduling() { } - private User selectionUtilisateur(int Ts, int Sp, List Users) { - User selectedUser = null; - double maxSNR= 0; - for (User user : Users) { - double snr = ; - if (snr > maxSNR) { - maxSNR = snr; - selectedUser = user; - } - } - return selectedUser; + private void selectionUtilisateur(List Users) { + for(User u: Users) } public MaxSNR(String name) { diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index f181539..2d8f8b6 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -27,7 +27,7 @@ public class RoundRobin extends Scheduler { * Entry Time slot (int), Sous porteuse(int), and users ( List) * Return the user in function of TS and SP selected */ - private UserGroup UserSelection(int Ts, int Sp, List Users) { + private UserGroup UserSelection(int Ts, int Sp, UserGroup Users) { for (int i = 0; i < Ts; i++) { for (int j = 0; j < Sp; j++) { index++; From 665ca35c696b81050bddcf30246408f4795639db Mon Sep 17 00:00:00 2001 From: iboyeau Date: Fri, 10 Mar 2023 11:38:52 +0100 Subject: [PATCH 4/6] Wip roundRobin --- src/main/java/fr/ntr/AccessPoint.java | 9 ++++-- src/main/java/fr/ntr/ResourceBlock.java | 8 ++++++ .../java/fr/ntr/scheduler/RoundRobin.java | 28 +++++++++++++++++-- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 7e54cda..9f255e6 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -92,7 +92,12 @@ public class AccessPoint { public ResourceBlock[][] getFrame() { return frame; } - public void setFrame(ResourceBlock[][] frame) { - this.frame = frame; + + public static int getTimeSlotNb() { + return timeSlotNb; + } + + public static int getSubCarrierNb() { + return subCarrierNb; } } diff --git a/src/main/java/fr/ntr/ResourceBlock.java b/src/main/java/fr/ntr/ResourceBlock.java index ec0bc6d..588e40e 100644 --- a/src/main/java/fr/ntr/ResourceBlock.java +++ b/src/main/java/fr/ntr/ResourceBlock.java @@ -8,4 +8,12 @@ public class ResourceBlock { this.user = user; this.bandwith = bandwith; } + + public void setUser(User user) { + this.user = user; + } + + public void setBandwith(double bandwith) { + this.bandwith = bandwith; + } } diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 331661f..2618282 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -1,5 +1,9 @@ package fr.ntr.scheduler; import java.util.List; +import java.util.Random; + +import fr.ntr.AccessPoint; +import fr.ntr.ResourceBlock; import fr.ntr.User; @@ -8,19 +12,37 @@ public class RoundRobin extends Scheduler { private String name; private int index; - public RoundRobin(String name, int index) { + private List users; + private ResourceBlock[][] frame; + + public RoundRobin(String name, int index, List users, ResourceBlock[][] frame ) { this.name = name; this.index = index; + this.users = users; + this.frame = frame; } /** * Entry + * Rempli la trame avec les utilisateurs * Return */ @Override public void scheduling() { - index = 0; + Random random = new Random(); + index = random.nextInt(users.size()-1); + for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) { + for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) { + + if (users.get(index).getPacketsToSend() == null) { + users.remove(index); + } + frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users)); + + //AccessPoint.setFrame[Ts][Sp](); + } + } } /** @@ -30,7 +52,7 @@ public class RoundRobin extends Scheduler { private User UserSelection(int Ts, int Sp, List Users) { for (int i = 0; i < Ts; i++) { for (int j = 0; j < Sp; j++) { - index++; + index++; } } return Users.get(index%(Users.size() - 1)); From bdb674a63fae732b0fa426a069e1d1863f5a5878 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 10 Mar 2023 11:55:01 +0100 Subject: [PATCH 5/6] MaxSnr v1 --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index d825ec1..2a1fefe 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -1,23 +1,34 @@ package fr.ntr.scheduler; import java.util.List; + +import fr.ntr.AccessPoint; +import fr.ntr.User; import fr.ntr.UserGroup; public class MaxSNR extends Scheduler { - private String name; - - + private List users; + @Override public void scheduling() { + User userMax = null; + for(int ts = 0; ts < 2; i++){ + for(int sp = 0; sp < 100; j++){ + userMax = selectionUtilisateur(sp, ts, users); + } + } } - private void selectionUtilisateur(int Ts, int Sp, List Users) { - + private User selectionUtilisateur(int sp, int ts, List Users) { + double MaxSnr = 0.0; + User userMax = null; + for(User u: Users){ + if (MaxSnr < u.getBandwidthTable()[ts][sp]){ + MaxSnr = u.getBandwidthTable()[ts][sp]; + userMax = u; + } + } + return userMax; } - public MaxSNR(String name) { - this.name = name; - } - - } From f7d751b07a8a3d6aaab40042cd9fc8cfcafbc2e1 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 10 Mar 2023 12:07:18 +0100 Subject: [PATCH 6/6] maxsnr v1 corrige --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 2a1fefe..a762cda 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -12,8 +12,8 @@ public class MaxSNR extends Scheduler { @Override public void scheduling() { User userMax = null; - for(int ts = 0; ts < 2; i++){ - for(int sp = 0; sp < 100; j++){ + for(int ts = 0; ts < 2; ts++){ + for(int sp = 0; sp < 100; sp++){ userMax = selectionUtilisateur(sp, ts, users); } }