From e90ad765107f2327988656d71ef5ea097e946ccd Mon Sep 17 00:00:00 2001 From: iboyeau Date: Fri, 17 Mar 2023 10:28:07 +0100 Subject: [PATCH 01/14] List packet set roundRobin (to verify) --- src/main/java/fr/ntr/scheduler/RoundRobin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 2e806fe..163e1c0 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -38,8 +38,9 @@ public class RoundRobin extends Scheduler { users.remove(index); }else{ - //sub the packet send need Set packet - users.get(index).getPacketsToSend(); + //TO Verify sub the packet send need Set packet + users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0)); + users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0)); } frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users)); From cb0ad20d89d9ca34c4b6e74f501d4a129486351c Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 17 Mar 2023 10:29:36 +0100 Subject: [PATCH 02/14] Fix createPackets --- src/main/java/fr/ntr/AccessPoint.java | 9 +++++---- src/main/java/fr/ntr/User.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 01ac564..1a79222 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -57,17 +57,18 @@ public class AccessPoint { private void updateBandwidth(int ticks) { int n = 200; - int timeInterval = 50 + new Random().nextInt(50); + Random random = new Random(); + int timeInterval = 50 + random.nextInt(51); for(User user : users) { - // On regénère le tableau de débits toutes les 50 ms + // On régénère le tableau de débits toutes les 50 ms if(ticks % 50 == 0){ user.generateBandwidth(); } - // On regénère les sources toutes les 50-100 ms + // On régénère les sources toutes les 50-100 ms if(ticks % timeInterval == 0){ n = user.createPackets(n); - timeInterval = 50 + new Random().nextInt(51); + timeInterval = 50 + random.nextInt(51); } } } diff --git a/src/main/java/fr/ntr/User.java b/src/main/java/fr/ntr/User.java index 8d62352..84861da 100644 --- a/src/main/java/fr/ntr/User.java +++ b/src/main/java/fr/ntr/User.java @@ -35,11 +35,11 @@ public class User { public int createPackets(int m) { Random random = new Random(); - int mbis = (int) random.nextDouble() * (2 * m); + int mbis = random.nextInt(2 * m); int nbPacketsToSend = mbis / Packets.packetSize; this.leftForNextSource = mbis % Packets.packetSize; for(int i = 0; i < nbPacketsToSend; i++){ - this.packetsToSend.add(new Packets(i, i, i)); // Voir pour les valeurs du contructeur Packets + this.packetsToSend.add(new Packets(i, i, i)); // Voir pour les valeurs du constructeur Packets } return mbis; } From e89eefa529b6e18edf0aabbcf4090c0a7edf91fb Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 17 Mar 2023 10:42:51 +0100 Subject: [PATCH 03/14] maj MAXSnr --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index c346bfd..0fc7211 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -1,18 +1,28 @@ package fr.ntr.scheduler; import java.util.List; +import fr.ntr.ResourceBlock; import fr.ntr.User; public class MaxSNR extends Scheduler { private List users; + private ResourceBlock[][] frame; + @Override public void scheduling() { User userMax = null; for(int ts = 0; ts < 2; ts++){ for(int sp = 0; sp < 100; sp++){ userMax = selectionUtilisateur(sp, ts, users); + if (userMax.getPacketsToSend() == null) { + users.remove(userMax); + }else{ + //sub the packet send need Set packet + userMax.getPacketsToSend(); + } + frame[ts][sp].setUser(selectionUtilisateur(sp, ts, users)); } } } From cdbb056bed8a23f054f8a1a1b94a499913718bc4 Mon Sep 17 00:00:00 2001 From: Loris Date: Fri, 17 Mar 2023 10:45:55 +0100 Subject: [PATCH 04/14] Main instancie frame et le donne au scheduler et AccessPoint --- src/main/java/fr/ntr/AccessPoint.java | 6 ++++-- src/main/java/fr/ntr/Main.java | 10 +++++++--- src/main/java/fr/ntr/scheduler/RoundRobin.java | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 1a79222..8592b0f 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -31,12 +31,14 @@ public class AccessPoint { private final double min, max; - public AccessPoint(Scheduler scheduler, double min, double max) { + public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, int timeSlotNb, int subCarrierNb, double min, double max) { this.min = min; this.max = max; this.users = new ArrayList<>(); this.scheduler = scheduler; - this.frame = new ResourceBlock[timeSlotNb][subCarrierNb]; + this.frame = frame; + this.timeSlotNb = timeSlotNb; + this.subCarrierNb = subCarrierNb; } /** diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index 3796cd7..e72e29d 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -1,11 +1,11 @@ package fr.ntr; import fr.ntr.scheduler.RoundRobin; +import fr.ntr.scheduler.Scheduler; public class Main { public static void main(String[] args) { - //TODO ajouter accès à AccessPoint if(args.length == 2) { int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation @@ -19,8 +19,12 @@ public class Main { System.exit(1); return; } - - AccessPoint accessPoint = new AccessPoint(new RoundRobin("round robin", 0), 0, 50); + //TODO : change timeSlotNb and subCarrierNb + int timeSlotNb = 0; + int subCarrierNb = 0; + ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; + Scheduler scheduler = new RoundRobin("round robin", 0, frame); + AccessPoint accessPoint = new AccessPoint(scheduler, frame, timeSlotNb, subCarrierNb, 0, 50); accessPoint.startSimulation(numberOfTicks, maximumLoad); } else { System.err.println("Please give launch arguments"); diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 163e1c0..f2ff2b1 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -15,9 +15,10 @@ public class RoundRobin extends Scheduler { private List users; private ResourceBlock[][] frame; - public RoundRobin(String name, int index) { + public RoundRobin(String name, int index, ResourceBlock[][] frame) { this.name = name; this.index = index; + this.frame = frame; } /** From 163d04be7b43e051f7b5dfae67b89a8234381fe6 Mon Sep 17 00:00:00 2001 From: iboyeau Date: Fri, 17 Mar 2023 10:47:51 +0100 Subject: [PATCH 05/14] cleaning round robin --- src/main/java/fr/ntr/scheduler/RoundRobin.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index 163e1c0..f803b03 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -34,16 +34,16 @@ public class RoundRobin extends Scheduler { //Pour chaque time slot et sous porteuses for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) { for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) { + // on enleve le packet transmis de la liste + // TO Verify sub the packet send need Set packet + users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0)); + users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0)); + //on ajoute l'utilisateur a la frame + frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users)); + //si un utilisateur n'a plus de packet a transmettre on supprime l'utilisateur de la liste if (users.get(index).getPacketsToSend() == null) { users.remove(index); - }else{ - - //TO Verify sub the packet send need Set packet - users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0)); - users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0)); } - frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users)); - } } } @@ -53,12 +53,13 @@ public class RoundRobin extends Scheduler { * Return the user in function of TS and SP selected */ private User UserSelection(int Ts, int Sp, List users) { - + //compte le nombre de bloc attribue for (int i = 0; i < Ts; i++){ for (int j = 0; j < Sp; j++) { index++; } } + //on retourne l'utilisateur return users.get(index%(users.size() - 1)); } From d7517d4226f98bb0a1b28617932f370faf3b88d0 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 17 Mar 2023 10:54:11 +0100 Subject: [PATCH 06/14] maj mSNR --- src/main/java/fr/ntr/scheduler/MaxSNR.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/MaxSNR.java b/src/main/java/fr/ntr/scheduler/MaxSNR.java index 0fc7211..9b7fd3a 100644 --- a/src/main/java/fr/ntr/scheduler/MaxSNR.java +++ b/src/main/java/fr/ntr/scheduler/MaxSNR.java @@ -16,13 +16,12 @@ public class MaxSNR extends Scheduler { for(int ts = 0; ts < 2; ts++){ for(int sp = 0; sp < 100; sp++){ userMax = selectionUtilisateur(sp, ts, users); + userMax.getPacketsSent().add(userMax.getPacketsToSend().get(0)); + userMax.getPacketsToSend().remove(userMax.getPacketsToSend().get(0)); + frame[ts][sp].setUser(selectionUtilisateur(sp, ts, users)); if (userMax.getPacketsToSend() == null) { users.remove(userMax); - }else{ - //sub the packet send need Set packet - userMax.getPacketsToSend(); } - frame[ts][sp].setUser(selectionUtilisateur(sp, ts, users)); } } } From 1978e5d636ec12c4bb44252a3479d412ec8f3ed3 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 17 Mar 2023 10:55:45 +0100 Subject: [PATCH 07/14] Add skeleton to analyseData --- src/main/java/fr/ntr/AccessPoint.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 8592b0f..8afa8d7 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -1,5 +1,8 @@ package fr.ntr; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -53,7 +56,11 @@ public class AccessPoint { updateBandwidth(ticks); schedule(); // traite les données et les enregistre dans un fichier - analyseData(); + try { + analyseData(); + } catch (IOException e) { + System.out.println("Can't export data"); + } } } @@ -93,8 +100,10 @@ public class AccessPoint { scheduler.scheduling(); } - private void analyseData() { - + private void analyseData() throws IOException { + FileOutputStream file = new FileOutputStream("data.csv", true); + // file.write("data1;data2".getBytes()); + file.close(); } private void plotData() { From a22170efd02c96a99eaa3a7af4ce86588bbe9505 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 17 Mar 2023 11:04:32 +0100 Subject: [PATCH 08/14] update analyzeData --- src/main/java/fr/ntr/AccessPoint.java | 11 ++++++++--- src/main/java/fr/ntr/ResourceBlock.java | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 8afa8d7..e35f33b 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -101,9 +101,14 @@ public class AccessPoint { } private void analyseData() throws IOException { - FileOutputStream file = new FileOutputStream("data.csv", true); - // file.write("data1;data2".getBytes()); - file.close(); + try(FileOutputStream file = new FileOutputStream("data.csv", true)) { + for(int i = 0; i < frame.length; i++) { + for(int j = 0; j < frame[i].length; j++) { + ResourceBlock ur = frame[i][j]; + file.write((i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n").getBytes()); + } + } + } } private void plotData() { diff --git a/src/main/java/fr/ntr/ResourceBlock.java b/src/main/java/fr/ntr/ResourceBlock.java index 588e40e..4fcc575 100644 --- a/src/main/java/fr/ntr/ResourceBlock.java +++ b/src/main/java/fr/ntr/ResourceBlock.java @@ -2,18 +2,26 @@ package fr.ntr; public class ResourceBlock { private User user; - private double bandwith; + private double bandwidth; - public ResourceBlock (User user, double bandwith) { + public ResourceBlock (User user, double bandwidth) { this.user = user; - this.bandwith = bandwith; + this.bandwidth = bandwidth; } public void setUser(User user) { this.user = user; } - public void setBandwith(double bandwith) { - this.bandwith = bandwith; + public void setBandwidth(double bandwidth) { + this.bandwidth = bandwidth; + } + + public User getUser() { + return user; + } + + public double getBandwidth() { + return bandwidth; } } From c7e2fed18823869b39efed4f410ad97aa491c30a Mon Sep 17 00:00:00 2001 From: Loris Date: Fri, 17 Mar 2023 11:11:26 +0100 Subject: [PATCH 09/14] Moved User generation in Main class --- src/main/java/fr/ntr/AccessPoint.java | 19 ++----------------- src/main/java/fr/ntr/Main.java | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 8afa8d7..afcc157 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -34,10 +34,10 @@ public class AccessPoint { private final double min, max; - public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, int timeSlotNb, int subCarrierNb, double min, double max) { + public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, List users, int timeSlotNb, int subCarrierNb, double min, double max) { this.min = min; this.max = max; - this.users = new ArrayList<>(); + this.users = users; this.scheduler = scheduler; this.frame = frame; this.timeSlotNb = timeSlotNb; @@ -49,7 +49,6 @@ public class AccessPoint { * @param duration */ public void startSimulation(int duration, int nbUsers) { - init(nbUsers); for (int ticks = 0; ticks < duration; ++ticks) { // Simulation reset(); @@ -82,20 +81,6 @@ public class AccessPoint { } } - /** - * Génération du débit et des paquets - */ - private void init(int nbUsers) { - // 2 groupes d'utilisateurs, proches et éloignés - double[] distance = { 200d, 1000d }; - for (int i = 0; i < distance.length; i++) { - for(int j = 0; j < nbUsers; j++){ - User user = new User(distance[i], timeSlotNb, subCarrierNb); - this.users.add(user); - } - } - } - private void schedule() { scheduler.scheduling(); } diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index e72e29d..eb99408 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -3,6 +3,9 @@ package fr.ntr; import fr.ntr.scheduler.RoundRobin; import fr.ntr.scheduler.Scheduler; +import java.util.ArrayList; +import java.util.List; + public class Main { public static void main(String[] args) { @@ -22,14 +25,30 @@ public class Main { //TODO : change timeSlotNb and subCarrierNb int timeSlotNb = 0; int subCarrierNb = 0; + List users = generateUsers(20, timeSlotNb, subCarrierNb); + //TODO : generate users ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; Scheduler scheduler = new RoundRobin("round robin", 0, frame); - AccessPoint accessPoint = new AccessPoint(scheduler, frame, timeSlotNb, subCarrierNb, 0, 50); + AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); accessPoint.startSimulation(numberOfTicks, maximumLoad); - } else { + } + else { System.err.println("Please give launch arguments"); System.err.println("gradle run --args=\" \""); System.exit(1); } } + + private static List generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) { + List users = new ArrayList<>(); + // 2 groupes d'utilisateurs, proches et éloignés + double[] distance = { 200d, 1000d }; + for (int i = 0; i < distance.length; i++) { + for(int j = 0; j < nbUsers; j++){ + User user = new User(distance[i], timeSlotNb, subCarrierNb); + users.add(user); + } + } + return users; + } } \ No newline at end of file From daba62febe4fed33bd2bcf7121309fcf3fb5ae5f Mon Sep 17 00:00:00 2001 From: Loris Date: Fri, 17 Mar 2023 11:13:25 +0100 Subject: [PATCH 10/14] Main now gives user list to RoundRobin --- src/main/java/fr/ntr/Main.java | 2 +- src/main/java/fr/ntr/scheduler/RoundRobin.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index eb99408..21922b1 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -28,7 +28,7 @@ public class Main { List users = generateUsers(20, timeSlotNb, subCarrierNb); //TODO : generate users ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; - Scheduler scheduler = new RoundRobin("round robin", 0, frame); + Scheduler scheduler = new RoundRobin("round robin", 0, frame, users); AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); accessPoint.startSimulation(numberOfTicks, maximumLoad); } diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index b70b8ed..f5dd855 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -15,10 +15,11 @@ public class RoundRobin extends Scheduler { private List users; private ResourceBlock[][] frame; - public RoundRobin(String name, int index, ResourceBlock[][] frame) { + public RoundRobin(String name, int index, ResourceBlock[][] frame, List users) { this.name = name; this.index = index; this.frame = frame; + this.users = users; } /** From 275a764752e0adc1ddd71398a49c0ea9bb6b7e19 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 17 Mar 2023 11:18:48 +0100 Subject: [PATCH 11/14] Add timeslot and subcarreir size --- src/main/java/fr/ntr/AccessPoint.java | 4 +++- src/main/java/fr/ntr/Main.java | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index b72c2c1..8d836d1 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -90,7 +90,9 @@ public class AccessPoint { for(int i = 0; i < frame.length; i++) { for(int j = 0; j < frame[i].length; j++) { ResourceBlock ur = frame[i][j]; - file.write((i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n").getBytes()); + String data = (i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n"); + System.out.println("data: " + data); + file.write(data.getBytes()); } } } diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index 21922b1..3c7457e 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -22,11 +22,9 @@ public class Main { System.exit(1); return; } - //TODO : change timeSlotNb and subCarrierNb - int timeSlotNb = 0; - int subCarrierNb = 0; + int timeSlotNb = 2; + int subCarrierNb = 100; List users = generateUsers(20, timeSlotNb, subCarrierNb); - //TODO : generate users ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; Scheduler scheduler = new RoundRobin("round robin", 0, frame, users); AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); From 29562074d76abc94bec340657be73a579aaa4e30 Mon Sep 17 00:00:00 2001 From: Loris Date: Fri, 17 Mar 2023 11:24:53 +0100 Subject: [PATCH 12/14] no more accents in ProportionalFair --- src/main/java/fr/ntr/scheduler/ProportionalFair.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/ntr/scheduler/ProportionalFair.java b/src/main/java/fr/ntr/scheduler/ProportionalFair.java index 1e0b650..5ffe2fd 100644 --- a/src/main/java/fr/ntr/scheduler/ProportionalFair.java +++ b/src/main/java/fr/ntr/scheduler/ProportionalFair.java @@ -23,7 +23,7 @@ public class ProportionalFair extends Scheduler { } @Override - protected void TraitementDonnées() { + protected void TraitementDonnees() { // TODO Auto-generated method stub } From 0f61c29fe96909f8ff493d3d2c7c266de2f2d151 Mon Sep 17 00:00:00 2001 From: Loris Date: Fri, 17 Mar 2023 11:25:41 +0100 Subject: [PATCH 13/14] no more accents EVERYWHERE --- src/main/java/fr/ntr/scheduler/Scheduler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/ntr/scheduler/Scheduler.java b/src/main/java/fr/ntr/scheduler/Scheduler.java index c7c1137..e21432d 100644 --- a/src/main/java/fr/ntr/scheduler/Scheduler.java +++ b/src/main/java/fr/ntr/scheduler/Scheduler.java @@ -8,7 +8,7 @@ public abstract class Scheduler { * Return */ public abstract void scheduling(); - protected void TraitementDonnées() { + protected void TraitementDonnees() { } } From ef7e5f287a90f25fdbf9d8a440948dfd9c0be979 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Fri, 17 Mar 2023 11:33:08 +0100 Subject: [PATCH 14/14] Fix RR (still found errors in createPackets) --- src/main/java/fr/ntr/AccessPoint.java | 1 - src/main/java/fr/ntr/Main.java | 6 +++--- src/main/java/fr/ntr/scheduler/RoundRobin.java | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/ntr/AccessPoint.java b/src/main/java/fr/ntr/AccessPoint.java index 8d836d1..9b87cdd 100644 --- a/src/main/java/fr/ntr/AccessPoint.java +++ b/src/main/java/fr/ntr/AccessPoint.java @@ -103,7 +103,6 @@ public class AccessPoint { } private void reset() { - this.users = new ArrayList<>(); this.frame = new ResourceBlock[timeSlotNb][subCarrierNb]; } diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index 3c7457e..70ae2e5 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -41,9 +41,9 @@ public class Main { List users = new ArrayList<>(); // 2 groupes d'utilisateurs, proches et éloignés double[] distance = { 200d, 1000d }; - for (int i = 0; i < distance.length; i++) { - for(int j = 0; j < nbUsers; j++){ - User user = new User(distance[i], timeSlotNb, subCarrierNb); + for (double v : distance) { + for (int j = 0; j < nbUsers; j++) { + User user = new User(v, timeSlotNb, subCarrierNb); users.add(user); } } diff --git a/src/main/java/fr/ntr/scheduler/RoundRobin.java b/src/main/java/fr/ntr/scheduler/RoundRobin.java index f5dd855..e6f4020 100644 --- a/src/main/java/fr/ntr/scheduler/RoundRobin.java +++ b/src/main/java/fr/ntr/scheduler/RoundRobin.java @@ -31,13 +31,13 @@ public class RoundRobin extends Scheduler { public void scheduling() { //selection aleatoire du premier utilisateur Random random = new Random(); - index = random.nextInt(users.size()-1); + index = random.nextInt(users.size()); //Pour chaque time slot et sous porteuses for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) { for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) { - // on enleve le packet transmis de la liste - // TO Verify sub the packet send need Set packet + // on enlève le packet transmis de la liste + // TODO Verify sub the packet send need Set packet users.get(index).getPacketsSent().add(users.get(index).getPacketsToSend().get(0)); users.get(index).getPacketsToSend().remove(users.get(index).getPacketsToSend().get(0)); //on ajoute l'utilisateur a la frame