Merge branch 'master' of gitlab.istic.univ-rennes1.fr:18008147/ntr
This commit is contained in:
commit
f91c300a2a
@ -1,6 +1,5 @@
|
|||||||
package fr.ntr;
|
package fr.ntr;
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -42,7 +41,6 @@ public class AccessPoint {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lancer la simulation
|
* Lancer la simulation
|
||||||
*
|
|
||||||
* @param duration
|
* @param duration
|
||||||
*/
|
*/
|
||||||
public void startSimulation(int duration, int nbUsers) {
|
public void startSimulation(int duration, int nbUsers) {
|
||||||
@ -62,7 +60,7 @@ public class AccessPoint {
|
|||||||
private void init(int nbUsers) {
|
private void init(int nbUsers) {
|
||||||
double[] distance = { 200d, 500d };
|
double[] distance = { 200d, 500d };
|
||||||
for (int i = 0; i < nbUsers; i++) {
|
for (int i = 0; i < nbUsers; i++) {
|
||||||
User user = new User(distance[i]);
|
User user = new User(distance[i], timeSlotNb, subCarrierNb);
|
||||||
user.generateBandwidth();
|
user.generateBandwidth();
|
||||||
user.createPackets();
|
user.createPackets();
|
||||||
this.users.add(user);
|
this.users.add(user);
|
||||||
|
@ -10,21 +10,25 @@ public class User {
|
|||||||
private final List<Packets> packetsToSend;
|
private final List<Packets> packetsToSend;
|
||||||
private final List<Packets> packetsSent;
|
private final List<Packets> packetsSent;
|
||||||
|
|
||||||
public User(double distance) {
|
public User(double distance, int timeSlotNb, int subCarrierNb) {
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
this.bandwidthTable = new double[1][1]; // TODO: 03/03/2023 Changer valeurs
|
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
|
||||||
this.packetsToSend = new ArrayList<>();
|
this.packetsToSend = new ArrayList<>();
|
||||||
this.packetsSent = new ArrayList<>();
|
this.packetsSent = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateBandwidth() {
|
public void generateBandwidth() {
|
||||||
double X = Math.random();
|
double random = Math.random();
|
||||||
double h = 8 * Math.sqrt(-2 * Math.log(1 - X));
|
for(int i = 0; i < bandwidthTable.length; i++) {
|
||||||
double gain = h * Math.pow(10, X*8/10) * Math.pow(1/this.distance, 3.5);
|
for(int j = 0; j < bandwidthTable[i].length; j++) {
|
||||||
double spectralEfficacity = (43 * gain)/(15000*(-174));
|
double h = 8 * Math.sqrt(-2 * Math.log(1 - random));
|
||||||
double mkn = Math.log1p(spectralEfficacity);
|
double gain = h * Math.pow(10, random*8/10) * Math.pow(1/this.distance, 3.5);
|
||||||
this.bandwidthTable[][] = mkn; // Voir comment remplir le tableau
|
double spectralEfficiency = (43 * gain)/(15000*(-174));
|
||||||
|
double mkn = Math.log1p(spectralEfficiency);
|
||||||
|
this.bandwidthTable[i][j] = mkn;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createPackets() {
|
public void createPackets() {
|
||||||
|
Reference in New Issue
Block a user