Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/fr/ntr/Main.java
This commit is contained in:
Quentin Legot 2023-03-24 09:08:59 +01:00
commit 2c1c2819f3
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package fr.ntr;
import fr.ntr.scheduler.MaxSNR;
import fr.ntr.scheduler.RoundRobin;
import fr.ntr.scheduler.Scheduler;
@ -27,7 +28,7 @@ public class Main {
for(int i = 2; i < maximumLoad; i+=2) {
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
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);
}

View File

@ -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]);
}
}
}
}