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 # Data for plotting
averages.sort(axis=0) averages.sort(axis=0)
fig, ax = plt.subplots() fig, ax = plt.subplots(2, 2)
ax.scatter(averages[:, 0], averages[:, 1]) 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[0, 1].scatter(available[:, 0], available[:, 1])
ax.grid() ax[0, 1].set(xlabel='number of users', ylabel='RB utilisés', title='Pourcentage de RB utilisés')
ax[0, 1].grid()
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.savefig("test.png")
plt.show()
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); cell1.schedule(ticks);
cell2.schedule(ticks); cell2.schedule(ticks);
//simulation des interférences //simulation des interférences
// computeInterference(); computeInterference();
// traite les données et les enregistre dans un fichier // traite les données et les enregistre dans un fichier
try { try {
cell1.analyseData(ticks); cell1.analyseData(ticks);
@ -44,7 +44,7 @@ public class AccessPoint {
ResourceBlock[][] frameCell1 = cell1.getFrame(); ResourceBlock[][] frameCell1 = cell1.getFrame();
ResourceBlock[][] frameCell2 = cell2.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++) { 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 //interférences si les deux cellules parlent au même UE sur le même time slot
User user1 = frameCell1[k][l].getUser(); User user1 = frameCell1[k][l].getUser();

View File

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

View File

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

View File

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