package fr.ntr; import java.util.ArrayList; import java.util.List; import java.util.Random; import fr.ntr.scheduler.Scheduler; public class AccessPoint { private List users; private Scheduler scheduler; /** * nombre de slots */ private static int timeSlotNb; /** * Nombre de sous-porteuses */ private static int subCarrierNb; /** * trame */ private ResourceBlock[][] frame; /** * Reste pour la prochaine source */ private double leftForNextSource; /** * Portée minimum et maximum de l'antenne */ private final double min, max; public AccessPoint(Scheduler scheduler, double min, double max) { this.min = min; this.max = max; this.users = new ArrayList<>(); this.scheduler = scheduler; this.frame = new ResourceBlock[timeSlotNb][subCarrierNb]; } /** * Lancer la simulation * @param duration */ public void startSimulation(int duration, int nbUsers) { for (int ticks = 0; ticks < duration; ++ticks) { // Simulation reset(); init(nbUsers, 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) { double n = 200; double timeInterval = 50; 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); user.generateBandwidth(); if(ticks % timeInterval){ n = user.createPackets(n); } this.users.add(user); } } } private void schedule() { } private void analyseData() { } private void plotData() { } private void reset() { } public int getFrameSize() { return this.timeSlotNb * this.subCarrierNb; } public ResourceBlock[][] getFrame() { return frame; } public static int getTimeSlotNb() { return timeSlotNb; } public static int getSubCarrierNb() { return subCarrierNb; } }