Fix user
This commit is contained in:
parent
01b82d7ef4
commit
26c1871490
@ -61,7 +61,7 @@ public class AccessPoint {
|
|||||||
for(int i = 0; i < nbUsers; i++){
|
for(int i = 0; i < nbUsers; i++){
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
double randomDist = this.min + random.nextDouble() * (this.max - this.min);
|
double randomDist = this.min + random.nextDouble() * (this.max - this.min);
|
||||||
User user = new User(randomDist);
|
User user = new User(randomDist, timeSlotNb, subCarrierNb);
|
||||||
user.generateBandwidth();
|
user.generateBandwidth();
|
||||||
user.createPackets();
|
user.createPackets();
|
||||||
this.users.add(user);
|
this.users.add(user);
|
||||||
@ -87,4 +87,5 @@ public class AccessPoint {
|
|||||||
public int getFrameSize(){
|
public int getFrameSize(){
|
||||||
return this.timeSlotNb * this.subCarrierNb;
|
return this.timeSlotNb * this.subCarrierNb;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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