Main now call AccessPoint and start the simulation

This commit is contained in:
Quentin Legot 2023-03-10 08:19:07 +01:00
parent f9cea33e9f
commit 01b82d7ef4
2 changed files with 11 additions and 17 deletions

View File

@ -14,7 +14,7 @@ public class AccessPoint {
*/ */
private static int timeSlotNb; private static int timeSlotNb;
/** /**
* nombre de sous-porteuses * Nombre de sous-porteuses
*/ */
private static int subCarrierNb; private static int subCarrierNb;
/** /**
@ -22,11 +22,11 @@ public class AccessPoint {
*/ */
private ResourceBlock[][] frame; private ResourceBlock[][] frame;
/** /**
* reste pour la prochaine source * Reste pour la prochaine source
*/ */
private double leftForNextSource; private double leftForNextSource;
/** /**
* portée minimum et maximum de l'antenne * Portée minimum et maximum de l'antenne
*/ */
private final double min, max; private final double min, max;
@ -34,7 +34,7 @@ public class AccessPoint {
public AccessPoint(Scheduler scheduler, double min, double max) { public AccessPoint(Scheduler scheduler, double min, double max) {
this.min = min; this.min = min;
this.max = max; this.max = max;
this.users = new ArrayList<User>(); this.users = new ArrayList<>();
this.scheduler = scheduler; this.scheduler = scheduler;
this.frame = new ResourceBlock[timeSlotNb][subCarrierNb]; this.frame = new ResourceBlock[timeSlotNb][subCarrierNb];
} }

View File

@ -1,24 +1,15 @@
package fr.ntr; package fr.ntr;
import fr.ntr.scheduler.RoundRobin;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
/**
* Nombre de ticks de la simulation
* -> durée de la simulation
*/
int numberOfTicks = 5000;
/**
* Nombre maximal d'utilisateurs dans le système
*/
int maximumLoad = 20;
//TODO ajouter accès à AccessPoint //TODO ajouter accès à AccessPoint
if(args.length == 2) { if(args.length == 2) {
int numberOfTicks; // Nombre de ticks de la simulation -> durée de la simulation
int maximumLoad; // Nombre maximal d'utilisateurs dans le système
try { try {
numberOfTicks = Integer.parseInt(args[0]); numberOfTicks = Integer.parseInt(args[0]);
maximumLoad = Integer.parseInt(args[1]); maximumLoad = Integer.parseInt(args[1]);
@ -26,7 +17,10 @@ public class Main {
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
System.err.println("Cannot parse launch argument to integer"); System.err.println("Cannot parse launch argument to integer");
System.exit(1); System.exit(1);
return;
} }
AccessPoint accessPoint = new AccessPoint(new RoundRobin("round robin", 0), 0, 50);
accessPoint.startSimulation(numberOfTicks, maximumLoad);
} else { } else {
System.err.println("Please give launch arguments"); System.err.println("Please give launch arguments");
System.err.println("gradle run --args=\"<number of ticks> <number of users>\""); System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");