Début d'initialisation et Calcul du débit pour un utilisateur
This commit is contained in:
parent
362684f1f8
commit
1131299232
@ -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;
|
||||||
|
|
||||||
import fr.ntr.scheduler.Scheduler;
|
import fr.ntr.scheduler.Scheduler;
|
||||||
|
|
||||||
@ -24,26 +25,58 @@ public class AccessPoint {
|
|||||||
* reste pour la prochaine source
|
* reste pour la prochaine source
|
||||||
*/
|
*/
|
||||||
private double leftForNextSource;
|
private double leftForNextSource;
|
||||||
|
/**
|
||||||
|
* portée minimum et maximum de l'antenne
|
||||||
|
*/
|
||||||
|
private final double min, max;
|
||||||
|
|
||||||
|
|
||||||
public AccessPoint(Scheduler scheduler) {
|
public AccessPoint(Scheduler scheduler, double min, double max) {
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
this.users = new ArrayList<User>();
|
this.users = new ArrayList<User>();
|
||||||
this.scheduler = scheduler;
|
this.scheduler = scheduler;
|
||||||
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startSimulation(int duration){
|
/**
|
||||||
|
* Lancer la simulation
|
||||||
|
* @param duration
|
||||||
|
*/
|
||||||
|
public void startSimulation(int duration, int nbUsers){
|
||||||
|
for(int ticks = 0; ticks < duration; ++ticks){
|
||||||
|
// Simulation
|
||||||
|
reset();
|
||||||
|
init(nbUsers);
|
||||||
|
schedule();
|
||||||
|
// traite les données et les enregistre dans un fichier
|
||||||
|
analyseData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Génération du débit et des paquets
|
* Génération du débit et des paquets
|
||||||
*/
|
*/
|
||||||
private void init(){
|
private void init(int nbUsers){
|
||||||
|
for(int i = 0; i < nbUsers; i++){
|
||||||
|
Random random = new Random();
|
||||||
|
double randomDist = this.min + random.nextDouble() * (this.max - this.min);
|
||||||
|
User user = new User(randomDist);
|
||||||
|
user.generateBandwidth();
|
||||||
|
user.createPackets();
|
||||||
|
this.users.add(user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dataAnalysis(){
|
private void schedule(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void analyseData(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void plotData(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,12 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void generateBandwidth() {
|
public void generateBandwidth() {
|
||||||
|
double X = Math.random();
|
||||||
|
double h = 8 * Math.sqrt(-2 * Math.log(1 - X));
|
||||||
|
double gain = h * Math.pow(10, X*8/10) * Math.pow(1/this.distance, 3.5);
|
||||||
|
double spectralEfficacity = (43 * gain)/(15000*(-174));
|
||||||
|
double mkn = Math.log1p(spectralEfficacity);
|
||||||
|
this.bandwidthTable[][] = mkn; // Voir comment remplir le tableau
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPackets() {
|
public void createPackets() {
|
||||||
|
Reference in New Issue
Block a user