Fix execution
This commit is contained in:
parent
4093336d40
commit
de59bc8047
@ -11,7 +11,7 @@ plugins {
|
||||
}
|
||||
|
||||
run {
|
||||
args = ["10000", "20"]
|
||||
args = ["10000", "40"]
|
||||
}
|
||||
|
||||
application {
|
||||
|
@ -24,11 +24,10 @@ public class AccessPoint {
|
||||
|
||||
cell1.updateBandwidth(ticks);
|
||||
cell2.updateBandwidth(ticks);
|
||||
for(int ts = 0; ts < 2; ts++) {
|
||||
for (int sp = 0; sp < 100; sp++) {
|
||||
cell1.preScheduling();
|
||||
cell2.preScheduling();
|
||||
|
||||
for(int ts = 0; ts < Cell.getTimeSlotNb(); ts++) {
|
||||
for (int sp = 0; sp < Cell.getSubCarrierNb(); sp++) {
|
||||
User user1 = cell1.schedule(ticks, ts, sp);
|
||||
User user2 = cell2.schedule(ticks, ts, sp);
|
||||
if(user1 == user2 && user1 != null) {
|
||||
|
@ -76,8 +76,9 @@ public class Cell {
|
||||
public void consumeResource(int tick, int ts, int sp) {
|
||||
ResourceBlock rb = frame[ts][sp];
|
||||
User user = rb.getUser();
|
||||
Packets p = user.getPacketsToSend().get(user.getPacketsToSend().size()-1);
|
||||
p.decreaseBitsNumberRemaining((int) user.getBandwidthTable()[ts][sp]);
|
||||
if(user != null && !user.getPacketsToSend().isEmpty()) {
|
||||
Packets p = user.getPacketsToSend().get(0);
|
||||
p.decreaseBitsNumberRemaining((int) rb.getBandwidth());
|
||||
if(p.getBitsNumberRemaining() <= 0) {
|
||||
if(tick == 0){
|
||||
p.setDurationSending(1);
|
||||
@ -87,7 +88,7 @@ public class Cell {
|
||||
user.getPacketsSent().add(p);
|
||||
user.getPacketsToSend().remove(p);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void analyseData(int tick) throws IOException {
|
||||
|
@ -111,6 +111,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
executor.close();
|
||||
System.out.println("Executor closed");
|
||||
}
|
||||
else {
|
||||
System.err.println("Please give launch arguments");
|
||||
|
@ -25,7 +25,6 @@ public class RoundRobin extends Scheduler {
|
||||
*/
|
||||
@Override
|
||||
public User scheduling(int ticks, int ts, int sp) {
|
||||
|
||||
if(userCopy.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@ -36,7 +35,7 @@ public class RoundRobin extends Scheduler {
|
||||
|
||||
@Override
|
||||
public void postScheduling(User userSelected) {
|
||||
if(!userSelected.getPacketsToSend().isEmpty())
|
||||
if(userSelected != null && !userSelected.getPacketsToSend().isEmpty())
|
||||
userCopy.add(userSelected);
|
||||
}
|
||||
|
||||
|
@ -21,17 +21,6 @@ public abstract class Scheduler {
|
||||
|
||||
public void allocateRessource(User userMax, int ts, int sp, int ticks) {
|
||||
if (userMax != null && !userMax.getPacketsToSend().isEmpty()) {
|
||||
/* Packets p = userMax.getPacketsToSend().get(userMax.getPacketsToSend().size()-1);
|
||||
p.decreaseBitsNumberRemaining((int) userMax.getBandwidthTable()[ts][sp]);
|
||||
if(p.getBitsNumberRemaining() <= 0) {
|
||||
if(ticks == 0){
|
||||
p.setDurationSending(1);
|
||||
}else {
|
||||
p.setDurationSending(ticks);
|
||||
}
|
||||
userMax.getPacketsSent().add(p);
|
||||
userMax.getPacketsToSend().remove(p);
|
||||
} */
|
||||
myFrame[ts][sp].setUser(userMax);
|
||||
myFrame[ts][sp].setBandwidth(userMax.getBandwidthTable()[ts][sp]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user