Increase number of users, add the current tick to data.csv

This commit is contained in:
Quentin Legot 2023-03-24 08:19:41 +01:00
parent 631ad01bfc
commit 6b9a526e49
3 changed files with 13 additions and 25 deletions

View File

@ -11,7 +11,7 @@ plugins {
} }
run { run {
args = ["1000", "20"] args = ["1000", "250"]
} }
application { application {

View File

@ -71,7 +71,7 @@ public class AccessPoint {
schedule(); schedule();
// traite les données et les enregistre dans un fichier // traite les données et les enregistre dans un fichier
try { try {
analyseData(); analyseData(ticks);
} catch (IOException e) { } catch (IOException e) {
System.out.println("Can't export data"); System.out.println("Can't export data");
} }
@ -95,29 +95,16 @@ public class AccessPoint {
} }
} }
/**
* Génération du débit et des paquets
*/
private void init(int nbUsers) {
// 2 groupes d'utilisateurs, proches et éloignés
double[] distance = { 200d, 1000d };
for (int i = 0; i < distance.length; i++) {
for(int j = 0; j < nbUsers; j++){
User user = new User(distance[i], timeSlotNb, subCarrierNb);
this.users.add(user);
}
}
}
private void schedule() { private void schedule() {
scheduler.scheduling(); scheduler.scheduling();
} }
private void analyseData() throws IOException { private void analyseData(int tick) throws IOException {
for(int i = 0; i < frame.length; i++) { for(int i = 0; i < frame.length; i++) {
for(int j = 0; j < frame[i].length; j++) { for(int j = 0; j < frame[i].length; j++) {
ResourceBlock ur = frame[i][j]; ResourceBlock ur = frame[i][j];
String data = (i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n"); if(ur.getUser() != null) {
String data = (tick + ";" + i + ";" + j + ";" + this.users.indexOf(ur.getUser()) + ";" + ur.getBandwidth() + ";\n");
try{ try{
outputDataFile.write(data.getBytes()); outputDataFile.write(data.getBytes());
}catch(IOException e){ }catch(IOException e){
@ -128,6 +115,7 @@ public class AccessPoint {
} }
} }
} }
}
private void reset() { private void reset() {
// TODO insert new UR // TODO insert new UR

View File

@ -57,7 +57,7 @@ public class User {
} }
/** /**
* calcul délais de transmission des paquets * Calcul délais de transmission des paquets
*/ */
public void computeTimeSending() { public void computeTimeSending() {
for(Packets p : packetsToSend){ for(Packets p : packetsToSend){