This commit is contained in:
Remi Boure 2023-03-10 12:09:15 +01:00
parent aa7be85663
commit 2dee3fd7f8
3 changed files with 13 additions and 8 deletions

View File

@ -47,7 +47,7 @@ public class AccessPoint {
for (int ticks = 0; ticks < duration; ++ticks) { for (int ticks = 0; ticks < duration; ++ticks) {
// Simulation // Simulation
reset(); reset();
init(nbUsers); init(nbUsers, ticks);
schedule(); schedule();
// traite les données et les enregistre dans un fichier // traite les données et les enregistre dans un fichier
analyseData(); analyseData();
@ -57,13 +57,18 @@ public class AccessPoint {
/** /**
* Génération du débit et des paquets * Génération du débit et des paquets
*/ */
private void init(int nbUsers) { private void init(int nbUsers, int ticks) {
double n = 200;
double timeInterval = 50;
double[] distance = { 200d, 1000d }; double[] distance = { 200d, 1000d };
for (int i = 0; i < distance.length; i++) { for (int i = 0; i < distance.length; i++) {
for(int j = 0; j < nbUsers; j++){ for(int j = 0; j < nbUsers; j++){
User user = new User(distance[i], timeSlotNb, subCarrierNb); User user = new User(distance[i], timeSlotNb, subCarrierNb);
user.generateBandwidth(); user.generateBandwidth();
user.createPackets(); if(ticks % timeInterval){
n = user.createPackets(n);
}
this.users.add(user); this.users.add(user);
} }
} }

View File

@ -5,12 +5,10 @@ public class Packets {
private int creationTime; private int creationTime;
private int endTimeSending; private int endTimeSending;
private double bitsNumberRemaining; private double bitsNumberRemaining;
private User user;
public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining, User user){ public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining){
this.creationTime = creationTime; this.creationTime = creationTime;
this.endTimeSending = endTimeSending; this.endTimeSending = endTimeSending;
this.bitsNumberRemaining = bitsNumberRemaining; this.bitsNumberRemaining = bitsNumberRemaining;
this.user = user;
} }
} }

View File

@ -2,6 +2,7 @@ package fr.ntr;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
public class User { public class User {
@ -31,8 +32,9 @@ public class User {
} }
} }
public void createPackets() { public void createPackets(double m) {
Random random = new Random();
double mbis = random.nextDouble() * (2 * m);
} }
/** /**