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 {
args = ["1000", "20"]
args = ["1000", "250"]
}
application {

View File

@ -71,7 +71,7 @@ public class AccessPoint {
schedule();
// traite les données et les enregistre dans un fichier
try {
analyseData();
analyseData(ticks);
} catch (IOException e) {
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() {
scheduler.scheduling();
}
private void analyseData() throws IOException {
private void analyseData(int tick) throws IOException {
for(int i = 0; i < frame.length; i++) {
for(int j = 0; j < frame[i].length; 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{
outputDataFile.write(data.getBytes());
}catch(IOException e){
@ -128,6 +115,7 @@ public class AccessPoint {
}
}
}
}
private void reset() {
// 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() {
for(Packets p : packetsToSend){