MaxSNR fix
This commit is contained in:
parent
505c1a9729
commit
c93bd0d763
@ -1,5 +1,6 @@
|
||||
package fr.ntr;
|
||||
|
||||
import fr.ntr.scheduler.MaxSNR;
|
||||
import fr.ntr.scheduler.RoundRobin;
|
||||
import fr.ntr.scheduler.Scheduler;
|
||||
|
||||
@ -26,7 +27,8 @@ public class Main {
|
||||
int subCarrierNb = 100;
|
||||
List<User> users = generateUsers(maximumLoad, timeSlotNb, subCarrierNb);
|
||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||
Scheduler scheduler = new RoundRobin("round robin", 0, frame, users);
|
||||
//Scheduler scheduler = new RoundRobin("round robin", 0, frame, users);
|
||||
Scheduler scheduler = new MaxSNR(frame, users);
|
||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
||||
accessPoint.startSimulation(numberOfTicks);
|
||||
}
|
||||
|
@ -10,15 +10,24 @@ public class MaxSNR extends Scheduler {
|
||||
|
||||
private ResourceBlock[][] frame;
|
||||
|
||||
|
||||
public MaxSNR( ResourceBlock[][] frame, List<User> users) {
|
||||
this.frame = frame;
|
||||
this.users = 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);
|
||||
if (userMax.getPacketsToSend().size() != 0) {
|
||||
userMax.getPacketsSent().add(userMax.getPacketsToSend().get(0));
|
||||
userMax.getPacketsToSend().remove(userMax.getPacketsToSend().get(0));
|
||||
frame[ts][sp].setUser(selectionUtilisateur(sp, ts, users));
|
||||
frame[ts][sp].setUser(userMax);
|
||||
frame[ts][sp].setBandwidth(userMax.getBandwidthTable()[ts][sp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user