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