From 4c33dac0283ab1ecc1f66632538747d89909c2f7 Mon Sep 17 00:00:00 2001 From: iboyeau Date: Fri, 24 Mar 2023 10:52:39 +0100 Subject: [PATCH] try to create cell (to verify) --- src/main/java/fr/ntr/Cell.java | 17 ++++++++++++++++- src/main/java/fr/ntr/Main.java | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/ntr/Cell.java b/src/main/java/fr/ntr/Cell.java index f3a0815..b96e822 100644 --- a/src/main/java/fr/ntr/Cell.java +++ b/src/main/java/fr/ntr/Cell.java @@ -1,6 +1,7 @@ package fr.ntr; import fr.ntr.scheduler.MaxSNR; +import fr.ntr.scheduler.RoundRobin; import fr.ntr.scheduler.Scheduler; import java.util.ArrayList; @@ -9,18 +10,32 @@ import java.util.List; public class Cell { + private int maximumLoad; + private int numberOfTicks; + private List Users; - public static void createCell(int maximumLoad, int generateUsers, int numberOfTicks) { + public Cell(){ + this.maximumLoad=0; + this.numberOfTicks=0; + this.Users=null; + } + + public Cell createCell(int maximumLoad,int numberOfTicks) { + Cell currentCell = new Cell(); + currentCell.maximumLoad=maximumLoad; + currentCell.numberOfTicks=numberOfTicks; int timeSlotNb = 2; int subCarrierNb = 100; for(int i = 2; i < maximumLoad; i+=2) { List users = generateUsers(i, timeSlotNb, subCarrierNb); + currentCell.Users=users; ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb]; //Scheduler scheduler = new RoundRobin("round robin", 0, frame, users); Scheduler scheduler = new MaxSNR(frame, users); AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50); accessPoint.startSimulation(numberOfTicks); } + return currentCell; } private static List generateUsers(int nbUsers, int timeSlotNb, int subCarrierNb) { List users = new ArrayList<>(); diff --git a/src/main/java/fr/ntr/Main.java b/src/main/java/fr/ntr/Main.java index b02106d..22a05e8 100644 --- a/src/main/java/fr/ntr/Main.java +++ b/src/main/java/fr/ntr/Main.java @@ -3,10 +3,14 @@ package fr.ntr; import fr.ntr.scheduler.MaxSNR; import fr.ntr.scheduler.RoundRobin; import fr.ntr.scheduler.Scheduler; +import fr.ntr.Cell; import java.util.ArrayList; import java.util.List; +import fr.ntr.Cell; + + public class Main { public static void main(String[] args) { @@ -22,6 +26,10 @@ public class Main { System.exit(1); return; } + + //TODO Verify this + Cell cell1= new Cell(); + cell1 = cell1.createCell(maximumLoad,numberOfTicks); } else { System.err.println("Please give launch arguments");