confl
This commit is contained in:
commit
ad8b56454c
@ -7,7 +7,7 @@ import java.util.Random;
|
|||||||
import fr.ntr.scheduler.Scheduler;
|
import fr.ntr.scheduler.Scheduler;
|
||||||
|
|
||||||
public class AccessPoint {
|
public class AccessPoint {
|
||||||
private List<User> users;
|
private List<UserGroup> users;
|
||||||
private Scheduler scheduler;
|
private Scheduler scheduler;
|
||||||
/**
|
/**
|
||||||
* nombre de slots
|
* nombre de slots
|
||||||
@ -60,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], timeSlotNb, subCarrierNb);
|
UserGroup user = new UserGroup(distance[i], timeSlotNb, subCarrierNb);
|
||||||
user.generateBandwidth();
|
user.generateBandwidth();
|
||||||
user.createPackets();
|
user.createPackets();
|
||||||
this.users.add(user);
|
this.users.add(user);
|
||||||
|
@ -5,9 +5,9 @@ public class Packets {
|
|||||||
private int creationTime;
|
private int creationTime;
|
||||||
private int endTimeSending;
|
private int endTimeSending;
|
||||||
private double bitsNumberRemaining;
|
private double bitsNumberRemaining;
|
||||||
private User user;
|
private UserGroup user;
|
||||||
|
|
||||||
public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining, User user){
|
public Packets(int creationTime, int endTimeSending, double bitsNumberRemaining, UserGroup user){
|
||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
this.endTimeSending = endTimeSending;
|
this.endTimeSending = endTimeSending;
|
||||||
this.bitsNumberRemaining = bitsNumberRemaining;
|
this.bitsNumberRemaining = bitsNumberRemaining;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package fr.ntr;
|
package fr.ntr;
|
||||||
|
|
||||||
public class ResourceBlock {
|
public class ResourceBlock {
|
||||||
private User user;
|
private UserGroup user;
|
||||||
private double bandwith;
|
private double bandwith;
|
||||||
|
|
||||||
public ResourceBlock (User user, double bandwith) {
|
public ResourceBlock (UserGroup user, double bandwith) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.bandwith = bandwith;
|
this.bandwith = bandwith;
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,14 @@ package fr.ntr;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class User {
|
public class UserGroup {
|
||||||
|
|
||||||
private final double distance;
|
private final double distance;
|
||||||
private final double[][] bandwidthTable;
|
private final double[][] bandwidthTable;
|
||||||
private final List<Packets> packetsToSend;
|
private final List<Packets> packetsToSend;
|
||||||
private final List<Packets> packetsSent;
|
private final List<Packets> packetsSent;
|
||||||
|
|
||||||
public User(double distance, int timeSlotNb, int subCarrierNb) {
|
public UserGroup(double distance, int timeSlotNb, int subCarrierNb) {
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
|
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
|
||||||
this.packetsToSend = new ArrayList<>();
|
this.packetsToSend = new ArrayList<>();
|
||||||
@ -22,10 +22,10 @@ public class User {
|
|||||||
double random = Math.random();
|
double random = Math.random();
|
||||||
for(int i = 0; i < bandwidthTable.length; i++) {
|
for(int i = 0; i < bandwidthTable.length; i++) {
|
||||||
for(int j = 0; j < bandwidthTable[i].length; j++) {
|
for(int j = 0; j < bandwidthTable[i].length; j++) {
|
||||||
double h = 8 * Math.sqrt(-2 * Math.log(1 - random));
|
double h = 1 * Math.sqrt(-2 * Math.log(1 - random));
|
||||||
double gain = h * Math.pow(10, random*8/10) * Math.pow(1/this.distance, 3.5);
|
double gain = h * Math.pow(10, random * 1/10) * Math.pow(1 / this.distance, 3.5);
|
||||||
double spectralEfficiency = (43 * gain)/(15000*(-174));
|
double spectralEfficiency = (43 * gain) / (15000 * (-174));
|
||||||
double mkn = Math.log1p(spectralEfficiency);
|
double mkn = Math.log(1 + spectralEfficiency) / Math.log(2);
|
||||||
this.bandwidthTable[i][j] = mkn;
|
this.bandwidthTable[i][j] = mkn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,4 +42,22 @@ public class User {
|
|||||||
return 0d;
|
return 0d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[][] getBandwidthTable() {
|
||||||
|
return bandwidthTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Packets> getPacketsToSend() {
|
||||||
|
return packetsToSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Packets> getPacketsSent() {
|
||||||
|
return packetsSent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -5,7 +5,8 @@ import fr.ntr.User;
|
|||||||
public class MaxSNR extends Scheduler {
|
public class MaxSNR extends Scheduler {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scheduling() {
|
public void scheduling() {
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package fr.ntr.scheduler;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import fr.ntr.User;
|
import fr.ntr.UserGroup;
|
||||||
|
|
||||||
public class ProportionalFair extends Scheduler {
|
public class ProportionalFair extends Scheduler {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class ProportionalFair extends Scheduler {
|
|||||||
public void scheduling() {
|
public void scheduling() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectionUtilisateur(int Ts, int Sp, List<User> Users) {
|
private void selectionUtilisateur(int Ts, int Sp, List<UserGroup> Users) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package fr.ntr.scheduler;
|
package fr.ntr.scheduler;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import fr.ntr.User;
|
import fr.ntr.UserGroup;
|
||||||
|
|
||||||
|
|
||||||
public class RoundRobin extends Scheduler {
|
public class RoundRobin extends Scheduler {
|
||||||
@ -27,7 +27,7 @@ public class RoundRobin extends Scheduler {
|
|||||||
* Entry Time slot (int), Sous porteuse(int), and users ( List<User>)
|
* Entry Time slot (int), Sous porteuse(int), and users ( List<User>)
|
||||||
* Return the user in function of TS and SP selected
|
* Return the user in function of TS and SP selected
|
||||||
*/
|
*/
|
||||||
private User UserSelection(int Ts, int Sp, List<User> Users) {
|
private UserGroup UserSelection(int Ts, int Sp, List<UserGroup> Users) {
|
||||||
for (int i = 0; i < Ts; i++) {
|
for (int i = 0; i < Ts; i++) {
|
||||||
for (int j = 0; j < Sp; j++) {
|
for (int j = 0; j < Sp; j++) {
|
||||||
index++;
|
index++;
|
||||||
|
Reference in New Issue
Block a user