Merge branch 'master' of gitlab.istic.univ-rennes1.fr:18008147/ntr
This commit is contained in:
commit
545f230437
@ -97,7 +97,12 @@ public class AccessPoint {
|
||||
public ResourceBlock[][] getFrame() {
|
||||
return frame;
|
||||
}
|
||||
public void setFrame(ResourceBlock[][] frame) {
|
||||
this.frame = frame;
|
||||
|
||||
public static int getTimeSlotNb() {
|
||||
return timeSlotNb;
|
||||
}
|
||||
|
||||
public static int getSubCarrierNb() {
|
||||
return subCarrierNb;
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,12 @@ public class ResourceBlock {
|
||||
this.user = user;
|
||||
this.bandwith = bandwith;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setBandwith(double bandwith) {
|
||||
this.bandwith = bandwith;
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,34 @@
|
||||
package fr.ntr.scheduler;
|
||||
import java.util.List;
|
||||
|
||||
import fr.ntr.AccessPoint;
|
||||
import fr.ntr.User;
|
||||
import fr.ntr.UserGroup;
|
||||
|
||||
public class MaxSNR extends Scheduler {
|
||||
|
||||
private String name;
|
||||
|
||||
private List<User> users;
|
||||
|
||||
@Override
|
||||
public void scheduling() {
|
||||
User userMax = null;
|
||||
for(int ts = 0; ts < 2; ts++){
|
||||
for(int sp = 0; sp < 100; sp++){
|
||||
userMax = selectionUtilisateur(sp, ts, users);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void selectionUtilisateur(int Ts, int Sp, List<User> Users) {
|
||||
|
||||
private User selectionUtilisateur(int sp, int ts, List<User> Users) {
|
||||
double MaxSnr = 0.0;
|
||||
User userMax = null;
|
||||
for(User u: Users){
|
||||
if (MaxSnr < u.getBandwidthTable()[ts][sp]){
|
||||
MaxSnr = u.getBandwidthTable()[ts][sp];
|
||||
userMax = u;
|
||||
}
|
||||
|
||||
public MaxSNR(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
return userMax;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,19 +8,37 @@ public class RoundRobin extends Scheduler {
|
||||
private String name;
|
||||
private int index;
|
||||
|
||||
public RoundRobin(String name, int index) {
|
||||
private List<User> users;
|
||||
private ResourceBlock[][] frame;
|
||||
|
||||
public RoundRobin(String name, int index, List<User> users, ResourceBlock[][] frame ) {
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
this.users = users;
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry
|
||||
* Rempli la trame avec les utilisateurs
|
||||
* Return
|
||||
*/
|
||||
@Override
|
||||
public void scheduling() {
|
||||
index = 0;
|
||||
Random random = new Random();
|
||||
index = random.nextInt(users.size()-1);
|
||||
|
||||
for (int Ts = 0; Ts < AccessPoint.getTimeSlotNb(); Ts++) {
|
||||
for(int Sp = 0; Sp < AccessPoint.getSubCarrierNb(); Sp++) {
|
||||
|
||||
if (users.get(index).getPacketsToSend() == null) {
|
||||
users.remove(index);
|
||||
}
|
||||
frame[Ts][Sp].setUser(UserSelection(Ts, Sp, users));
|
||||
|
||||
//AccessPoint.setFrame[Ts][Sp]();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user