merge conflicts
This commit is contained in:
commit
4e229dbed8
@ -1,14 +1,14 @@
|
||||
package fr.ntr;
|
||||
|
||||
public class Packets {
|
||||
static final int packetSize = 100;
|
||||
static final int PACKET_SIZE = 100;
|
||||
private int startTimeSending;
|
||||
private int endTimeSending;
|
||||
private int durationSending;
|
||||
private int bitsNumberRemaining;
|
||||
|
||||
public Packets(int startTimeSending){
|
||||
this.bitsNumberRemaining = packetSize;
|
||||
this.bitsNumberRemaining = PACKET_SIZE;
|
||||
this.startTimeSending = startTimeSending;
|
||||
}
|
||||
|
||||
|
@ -26,16 +26,14 @@ public class User {
|
||||
}
|
||||
|
||||
public void generateBandwidth() {
|
||||
|
||||
for(int y = 0; y < bandwidthTable[0].length; y++) {
|
||||
double rand = this.random.nextDouble();
|
||||
for(int x = 0; x < bandwidthTable.length; x++) {
|
||||
double h = 1 * Math.sqrt(-2 * Math.log(1 - rand));
|
||||
double gain = h * h * Math.pow(10, rand * 1/10) * Math.pow(1 / this.distance, 3.5);
|
||||
double spectralEfficiency = (20 * gain) / (15000 * (3.9*Math.pow(10, -21)));
|
||||
double mkn = Math.log(1 + spectralEfficiency) / Math.log(2);
|
||||
this.bandwidthTable[x][y] = mkn;
|
||||
}
|
||||
this.bandwidthTable[0][y] = mkn;
|
||||
this.bandwidthTable[1][y] = mkn;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,9 +52,9 @@ public class User {
|
||||
}
|
||||
// On calcule le nombre de paquets qu'on peut transmettre
|
||||
int bitsToSend = random.nextInt(2 * mbis + 1) + this.leftForNextSource;
|
||||
int nbPacketsToSend = bitsToSend / Packets.packetSize ;
|
||||
int nbPacketsToSend = bitsToSend / Packets.PACKET_SIZE;
|
||||
// On conserve le nombre de bits restants pour la prochaine génération
|
||||
this.leftForNextSource = bitsToSend % Packets.packetSize;
|
||||
this.leftForNextSource = bitsToSend % Packets.PACKET_SIZE;
|
||||
// On crée les paquets
|
||||
for(int i = 0; i < nbPacketsToSend; i++) {
|
||||
this.packetsToSend.add(new Packets(ticks));
|
||||
|
Reference in New Issue
Block a user