This repository has been archived on 2023-08-28. You can view files and clone it, but cannot push or open issues or pull requests.
ntr-interferences/src/main/java/fr/ntr/AccessPoint.java

99 lines
2.0 KiB
Java
Raw Normal View History

2023-03-03 10:38:35 +01:00
package fr.ntr;
2023-03-10 08:30:28 +01:00
import java.lang.reflect.Array;
2023-03-03 12:12:18 +01:00
import java.util.ArrayList;
2023-03-03 11:28:16 +01:00
import java.util.List;
import java.util.Random;
2023-03-03 11:28:16 +01:00
import fr.ntr.scheduler.Scheduler;
2023-03-03 10:38:35 +01:00
public class AccessPoint {
2023-03-03 11:28:16 +01:00
private List<User> users;
private Scheduler scheduler;
2023-03-03 11:47:53 +01:00
/**
* nombre de slots
*/
private static int timeSlotNb;
/**
* Nombre de sous-porteuses
2023-03-03 11:47:53 +01:00
*/
private static int subCarrierNb;
/**
* trame
*/
private ResourceBlock[][] frame;
/**
* Reste pour la prochaine source
2023-03-03 11:47:53 +01:00
*/
private double leftForNextSource;
/**
* Portée minimum et maximum de l'antenne
*/
private final double min, max;
2023-03-03 11:28:16 +01:00
2023-03-10 08:30:28 +01:00
public AccessPoint(Scheduler scheduler, double min, double max) {
this.min = min;
this.max = max;
this.users = new ArrayList<>();
2023-03-03 11:28:16 +01:00
this.scheduler = scheduler;
2023-03-03 12:12:18 +01:00
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb];
2023-03-03 11:28:16 +01:00
}
/**
* Lancer la simulation
2023-03-10 08:30:28 +01:00
*
* @param duration
*/
2023-03-10 08:30:28 +01:00
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();
}
2023-03-03 11:28:16 +01:00
}
2023-03-03 12:12:18 +01:00
/**
* Génération du débit et des paquets
*/
2023-03-10 08:30:28 +01:00
private void init(int nbUsers) {
2023-03-10 09:12:36 +01:00
double[] distance = { 200d, 500d };
2023-03-10 08:30:28 +01:00
for (int i = 0; i < nbUsers; i++) {
2023-03-10 09:12:36 +01:00
User user = new User(distance[i]);
user.generateBandwidth();
user.createPackets();
this.users.add(user);
}
}
2023-03-10 08:30:28 +01:00
private void schedule() {
}
2023-03-10 08:30:28 +01:00
private void analyseData() {
2023-03-03 11:28:16 +01:00
}
2023-03-10 08:30:28 +01:00
private void plotData() {
2023-03-03 11:28:16 +01:00
}
2023-03-10 08:30:28 +01:00
private void reset() {
2023-03-03 11:28:16 +01:00
}
2023-03-03 12:12:18 +01:00
2023-03-10 08:30:28 +01:00
public int getFrameSize() {
2023-03-03 12:12:18 +01:00
return this.timeSlotNb * this.subCarrierNb;
}
2023-03-10 08:30:28 +01:00
public ResourceBlock[][] getFrame() {
return frame;
}
public void setFrame(ResourceBlock[][] frame) {
this.frame = frame;
}
2023-03-03 10:38:35 +01:00
}