scheduleing +1param

This commit is contained in:
Tr1xt4n 2023-03-28 08:39:19 +02:00
parent 2c5d1d2e94
commit 3a438472d0
3 changed files with 10 additions and 9 deletions

View File

@ -26,13 +26,12 @@ public class MaxSNR extends Scheduler {
if (userMax.getPacketsToSend().size() != 0) { if (userMax.getPacketsToSend().size() != 0) {
Packets p = userMax.getPacketsToSend().get(0); Packets p = userMax.getPacketsToSend().get(0);
userMax.getPacketsSent().add(p); userMax.getPacketsSent().add(p);
if(p.getDurationSending() != 0){ if(p.getBitsNumberRemaining() > 0){
if(p.getBitsNumberRemaining() > 0){ p.decreaseBitsNumberRemaining((int) userMax.getBandwidthTable()[ts][sp]);
p.decreaseBitsNumberRemaining((int) userMax.getBandwidthTable()[ts][sp]); } else {
} else { p.setDurationSending(ticks);
p.setDurationSending(ticks); }
}
}
userMax.getPacketsToSend().remove(p); userMax.getPacketsToSend().remove(p);
frame[ts][sp].setUser(userMax); frame[ts][sp].setUser(userMax);
frame[ts][sp].setBandwidth(userMax.getBandwidthTable()[ts][sp]); frame[ts][sp].setBandwidth(userMax.getBandwidthTable()[ts][sp]);

View File

@ -7,6 +7,8 @@ import fr.ntr.ResourceBlock;
import fr.ntr.User; import fr.ntr.User;
public class ProportionalFair extends Scheduler { public class ProportionalFair extends Scheduler {
private List<User> users; private List<User> users;
private ResourceBlock[][] frame; private ResourceBlock[][] frame;
@ -17,7 +19,7 @@ public class ProportionalFair extends Scheduler {
} }
@Override @Override
public void scheduling() { public void scheduling(int ticks) {
ArrayList<Double> averageBandwiths = new ArrayList<Double>(); ArrayList<Double> averageBandwiths = new ArrayList<Double>();
for(User u : users){ for(User u : users){
double avg = 0d; double avg = 0d;

View File

@ -28,7 +28,7 @@ public class RoundRobin extends Scheduler {
* Return * Return
*/ */
@Override @Override
public void scheduling() { public void scheduling(int ticks) {
//selection aleatoire du premier utilisateur //selection aleatoire du premier utilisateur
Random random = new Random(); Random random = new Random();
index = random.nextInt(users.size()); index = random.nextInt(users.size());