Merge branch 'master' of https://gitlab.istic.univ-rennes1.fr/18008147/ntr
This commit is contained in:
commit
ab55f67f52
@ -44,29 +44,21 @@ public class AccessPoint {
|
||||
* @param duration
|
||||
*/
|
||||
public void startSimulation(int duration, int nbUsers) {
|
||||
init(nbUsers);
|
||||
for (int ticks = 0; ticks < duration; ++ticks) {
|
||||
// Simulation
|
||||
reset();
|
||||
init(nbUsers, ticks);
|
||||
updateBandwidth(ticks);
|
||||
schedule();
|
||||
// traite les données et les enregistre dans un fichier
|
||||
analyseData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Génération du débit et des paquets
|
||||
*/
|
||||
private void init(int nbUsers, int ticks) {
|
||||
private void updateBandwidth(int ticks) {
|
||||
int n = 200;
|
||||
int timeInterval = 50 + new Random().nextInt(50);
|
||||
|
||||
// 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(User user : users) {
|
||||
// On regénère le tableau de débits toutes les 50 ms
|
||||
if(ticks % 50 == 0){
|
||||
user.generateBandwidth();
|
||||
@ -77,6 +69,18 @@ public class AccessPoint {
|
||||
n = user.createPackets(n);
|
||||
timeInterval = 50 + new Random().nextInt(51);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user