Merge branch 'ajout_cellule' of gitlab.istic.univ-rennes1.fr:18008147/ntr into ajout_cellule

This commit is contained in:
Remi Boure 2023-04-04 10:05:52 +02:00
commit d5413db0b3
5 changed files with 23 additions and 39 deletions

View File

@ -57,23 +57,17 @@ delays.sort(axis=0)
# Data for plotting
averages.sort(axis=0)
fig, ax = plt.subplots()
ax.scatter(averages[:, 0], averages[:, 1])
fig, ax = plt.subplots(2, 2)
ax[0, 0].scatter(averages[:, 0], averages[:, 1])
ax[0, 0].set(xlabel='number of users', ylabel='Efficacité spectrale', title='Efficacité spectrale')
ax[0, 0].grid()
ax.set(xlabel='number of users', ylabel='Efficacité spectrale', title='Efficacité spectrale')
ax.grid()
ax[0, 1].scatter(available[:, 0], available[:, 1])
ax[0, 1].set(xlabel='number of users', ylabel='RB utilisés', title='Pourcentage de RB utilisés')
ax[0, 1].grid()
# fig.savefig("test.png")
plt.show()
ax[1, 0].scatter(delays[:, 0], delays[:, 1])
ax[1, 0].set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
ax[1, 0].grid()
fig, ax = plt.subplots()
ax.scatter(available[:, 0], available[:, 1])
ax.set(xlabel='number of users', ylabel='RB utilisés', title='Pourcentage de RB utilisés')
ax.grid()
plt.show()
fig, ax = plt.subplots()
ax.scatter(delays[:, 0], delays[:, 1])
ax.set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
ax.grid()
plt.show()
plt.show()

View File

@ -28,7 +28,7 @@ public class AccessPoint {
cell1.schedule(ticks);
cell2.schedule(ticks);
//simulation des interférences
// computeInterference();
computeInterference();
// traite les données et les enregistre dans un fichier
try {
cell1.analyseData(ticks);
@ -44,7 +44,7 @@ public class AccessPoint {
ResourceBlock[][] frameCell1 = cell1.getFrame();
ResourceBlock[][] frameCell2 = cell2.getFrame();
for (int k = 0; k < frameCell1.length; k++ ) {
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();

View File

@ -1,6 +1,7 @@
package fr.ntr.scheduler;
import java.util.List;
import fr.ntr.Cell;
import fr.ntr.ResourceBlock;
import fr.ntr.User;
@ -43,12 +44,11 @@ public class MaxSNR extends Scheduler {
private User userSelection(int ts, int sp) {
double maxSnr = 0.0;
User userMax = null;
for(User u: users){
if(!u.getPacketsToSend().isEmpty()) {
if (maxSnr < u.getBandwidthTable()[ts][sp]) {
maxSnr = u.getBandwidthTable()[ts][sp];
userMax = u;
}
for(User u: users) {
if (!u.getPacketsToSend().isEmpty() && (maxSnr < u.getBandwidthTable()[ts][sp])) {
maxSnr = u.getBandwidthTable()[ts][sp];
userMax = u;
}
}
return userMax;

View File

@ -22,7 +22,7 @@ public class ProportionalFair extends Scheduler {
@Override
public void scheduling(int ticks) {
ArrayList<Double> averageBandwiths = new ArrayList<Double>();
ArrayList<Double> averageBandwiths = new ArrayList<>();
for(User u : users){
double avg = 0d;
double[][] bandwidthTable = u.getBandwidthTable();
@ -57,5 +57,5 @@ public class ProportionalFair extends Scheduler {
}
return selectedUser;
}
}

View File

@ -33,18 +33,8 @@ public abstract class Scheduler {
}
}
Packets p = userMax.getPacketsToSend().get(userMax.getPacketsToSend().size()-1);
if(p.getBitsNumberRemaining() >= 0){
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);
}
} else {
p.decreaseBitsNumberRemaining((int) userMax.getBandwidthTable()[ts][sp]);
if(p.getBitsNumberRemaining() <= 0) {
if(ticks == 0){
p.setDurationSending(1);
}else {