moved interference simulation in its own method
This commit is contained in:
parent
3e0a2056c0
commit
6ce0e63e9c
@ -49,29 +49,7 @@ public class AccessPoint {
|
||||
cell2.schedule();
|
||||
|
||||
//simulation des interférences
|
||||
ResourceBlock[][] frameCell1 = cell1.getFrame();
|
||||
ResourceBlock[][] frameCell2 = cell2.getFrame();
|
||||
|
||||
for (int k = 0; k > frameCell1.length; k++ ) {
|
||||
for (int l = 0; l < frameCell1[k].length; l++) {
|
||||
//interférences si les deux cellules parlent au même UE sur le même time slot
|
||||
User user1 = frameCell1[k][l].getUser();
|
||||
User user2 = frameCell2[k][l].getUser();
|
||||
if (user1 == user2) {
|
||||
double bandwidth1 = frameCell1[k][l].getBandwidth();
|
||||
double bandwidth2 = frameCell2[k][l].getBandwidth();
|
||||
//2 cas: utilisateur proche ou loin
|
||||
if (user1.getDistance() > 200d) {
|
||||
frameCell1[k][l].setBandwidth(bandwidth1 / 2);
|
||||
frameCell2[k][l].setBandwidth(bandwidth2 / 2);
|
||||
}
|
||||
else {
|
||||
frameCell1[k][l].setBandwidth(bandwidth1 / 4);
|
||||
frameCell2[k][l].setBandwidth(bandwidth2 / 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
computeInterference();
|
||||
|
||||
// traite les données et les enregistre dans un fichier
|
||||
|
||||
@ -84,6 +62,32 @@ public class AccessPoint {
|
||||
}
|
||||
}
|
||||
|
||||
public void computeInterference () {
|
||||
ResourceBlock[][] frameCell1 = cell1.getFrame();
|
||||
ResourceBlock[][] frameCell2 = cell2.getFrame();
|
||||
|
||||
for (int k = 0; k > frameCell1.length; k++ ) {
|
||||
for (int l = 0; l < frameCell1[k].length; l++) {
|
||||
//interférences si les deux cellules parlent au même UE sur le même time slot
|
||||
User user1 = frameCell1[k][l].getUser();
|
||||
User user2 = frameCell2[k][l].getUser();
|
||||
if (user1 == user2) {
|
||||
double bandwidth1 = frameCell1[k][l].getBandwidth();
|
||||
double bandwidth2 = frameCell2[k][l].getBandwidth();
|
||||
//User proche
|
||||
if (user1.getDistance() > 200d) {
|
||||
frameCell1[k][l].setBandwidth(bandwidth1 / 2);
|
||||
frameCell2[k][l].setBandwidth(bandwidth2 / 2);
|
||||
}
|
||||
//User loin
|
||||
else {
|
||||
frameCell1[k][l].setBandwidth(bandwidth1 / 4);
|
||||
frameCell2[k][l].setBandwidth(bandwidth2 / 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
private void analyseData(int tick) throws IOException {
|
||||
for(int i = 0; i < cell1.getFrame().length; i++) {
|
||||
|
Reference in New Issue
Block a user