Remove interferences for testing, optimize main.py
This commit is contained in:
parent
9936d4f1b9
commit
faeb49eb32
37
plot/main.py
37
plot/main.py
@ -8,53 +8,51 @@ nb_files = os.listdir(".." + os.sep + "export")
|
|||||||
size = len(nb_files)
|
size = len(nb_files)
|
||||||
|
|
||||||
|
|
||||||
def mean_mkn() -> np.ndarray:
|
def mean_mkn(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
||||||
averages_mkn = np.empty((size, 2))
|
averages_mkn = np.empty((size, 2))
|
||||||
nb = 0
|
nb = 0
|
||||||
for i in nb_files:
|
for nb_users, data in arr:
|
||||||
data = pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()
|
|
||||||
rb = data[:, 4]
|
rb = data[:, 4]
|
||||||
|
|
||||||
total = 0.0
|
total = 0.0
|
||||||
for x in rb:
|
for x in rb:
|
||||||
total = total + x
|
total = total + x
|
||||||
average = total / len(rb)
|
average = total / len(rb)
|
||||||
nb_users = i.split(".")[0]
|
averages_mkn[nb, 0] = nb_users
|
||||||
averages_mkn[nb, 0] = int(nb_users)
|
|
||||||
averages_mkn[nb, 1] = average
|
averages_mkn[nb, 1] = average
|
||||||
nb += 1
|
nb += 1
|
||||||
return averages_mkn
|
return averages_mkn
|
||||||
|
|
||||||
|
|
||||||
def rb_available() -> np.ndarray:
|
def rb_available(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
||||||
available = np.zeros((size, 2))
|
available = np.zeros((size, 2))
|
||||||
nb = 0
|
nb = 0
|
||||||
for i in nb_files:
|
for nb_users, data in arr:
|
||||||
data = pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()
|
available[nb, 0] = nb_users
|
||||||
nb_users = i.split(".")[0]
|
|
||||||
available[nb, 0] = int(nb_users)
|
|
||||||
available[nb, 1] = (data.shape[0] / (200 * 10000)) * 100
|
available[nb, 1] = (data.shape[0] / (200 * 10000)) * 100
|
||||||
nb += 1
|
nb += 1
|
||||||
return available
|
return available
|
||||||
|
|
||||||
|
|
||||||
def delay() -> np.ndarray:
|
def delay(arr: list[tuple[int, np.ndarray]]) -> np.ndarray:
|
||||||
delays = np.zeros((size, 2))
|
delays = np.zeros((size, 2))
|
||||||
nb = 0
|
nb = 0
|
||||||
for i in nb_files:
|
for nb_users, data in arr:
|
||||||
data = pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()
|
|
||||||
nb_users = i.split(".")[0]
|
|
||||||
d = data[:, 5]
|
d = data[:, 5]
|
||||||
for x in d:
|
for x in d:
|
||||||
delays[nb, 0] = int(nb_users)
|
delays[nb, 0] = nb_users
|
||||||
delays[nb, 1] = float(x)
|
delays[nb, 1] = float(x)
|
||||||
nb += 1
|
nb += 1
|
||||||
return delays
|
return delays
|
||||||
|
|
||||||
|
|
||||||
averages = mean_mkn()
|
np_arr: list[tuple[int, np.ndarray]] = list()
|
||||||
available = rb_available()
|
for i in nb_files:
|
||||||
delays = delay()
|
np_arr.append((int(i.split(".")[0]), pd.read_csv(".." + os.sep + "export" + os.sep + i, delimiter=';').to_numpy()))
|
||||||
|
|
||||||
|
averages = mean_mkn(np_arr)
|
||||||
|
available = rb_available(np_arr)
|
||||||
|
delays = delay(np_arr)
|
||||||
delays.sort(axis=0)
|
delays.sort(axis=0)
|
||||||
# Data for plotting
|
# Data for plotting
|
||||||
averages.sort(axis=0)
|
averages.sort(axis=0)
|
||||||
@ -74,9 +72,8 @@ ax.set(xlabel='number of users', ylabel='RB utilisés', title='Pourcentage de RB
|
|||||||
ax.grid()
|
ax.grid()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
ax.scatter(delays[:, 0], delays[:, 1])
|
ax.scatter(delays[:, 0], delays[:, 1])
|
||||||
ax.set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
|
ax.set(xlabel='number of users', ylabel='delays(ms)', title='Delay')
|
||||||
ax.grid()
|
ax.grid()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -32,7 +32,7 @@ public class AccessPoint {
|
|||||||
cell1.schedule(ticks);
|
cell1.schedule(ticks);
|
||||||
cell2.schedule(ticks);
|
cell2.schedule(ticks);
|
||||||
//simulation des interférences
|
//simulation des interférences
|
||||||
computeInterference();
|
// computeInterference();
|
||||||
// traite les données et les enregistre dans un fichier
|
// traite les données et les enregistre dans un fichier
|
||||||
try {
|
try {
|
||||||
cell1.analyseData(ticks, users);
|
cell1.analyseData(ticks, users);
|
||||||
|
Reference in New Issue
Block a user