Increase number of users, add the current tick to data.csv
This commit is contained in:
parent
631ad01bfc
commit
6b9a526e49
@ -11,7 +11,7 @@ plugins {
|
||||
}
|
||||
|
||||
run {
|
||||
args = ["1000", "20"]
|
||||
args = ["1000", "250"]
|
||||
}
|
||||
|
||||
application {
|
||||
|
@ -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,35 +95,23 @@ 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");
|
||||
try{
|
||||
outputDataFile.write(data.getBytes());
|
||||
}catch(IOException e){
|
||||
System.err.println("Cannot write the data in the output file");
|
||||
System.exit(1);
|
||||
return;
|
||||
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){
|
||||
System.err.println("Cannot write the data in the output file");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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){
|
||||
|
Reference in New Issue
Block a user