-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_communications.py
46 lines (39 loc) · 1.77 KB
/
test_communications.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
UFPA - LASSE - Telecommunications, Automation and Electronics Research and Development Center - www.lasse.ufpa.br
CAVIAR - Communication Networks and Artificial Intelligence Immersed in Virtual or Augmented Reality
Ailton Oliveira, Felipe Bastos, João Borges, Emerson Oliveira, Daniel Takashi, Lucas Matni, Rebecca Aben-Athar, Aldebaro Klautau (UFPA): [email protected]
CAVIAR: https://github.com/lasseufpa/ITU-Challenge-ML5G-PHY-RL.git
Script to test telecommunications dynamics/environment
V1.0
'''
import numpy as np
from communications.buffer import Buffer
from communications.base_station import BaseStation
from communications.ue import UE
use_airsim = False
if not use_airsim:
obj_type = 'automated_test'
else:
obj_type = 'Unreal_object'
#obj_type = 'UAV'
# Test integration
print('/////////////// Test integration ///////////////')
ue1 = UE(name='uav1', obj_type=obj_type, total_number_rbs=17, episode=0, use_airsim=use_airsim)
ue2 = UE(name='simulation_car1', obj_type=obj_type, total_number_rbs=17, episode=0, use_airsim=use_airsim)
ue3 = UE(name='simulation_pedestrian1', obj_type=obj_type, total_number_rbs=17, episode=0, use_airsim=use_airsim)
caviar_bs = BaseStation(Elements=64, frequency=60e9,name='BS1',ep_lenght=20, traffic_type='light', BS_type = 'UPA')
#Append users
caviar_bs.append(ue1)
caviar_bs.append(ue2)
caviar_bs.append(ue3)
user = -1
action = 32
#Dumb test, just to check the implementation
for i in range(20):
if user == 2:
user = -1
user += 1
state, reward, feedback ,done = caviar_bs.step(user,action)
print('User ID: ', caviar_bs.UEs[user].ID, 'Buffer: ', caviar_bs.UEs[user].buffer, 'BS TYPE: ', caviar_bs._type)
print('State: ', state,' Reward: ', reward, 'Dropped packets: ', feedback[0], 'Sent packets: ', feedback[1] ,'Is done ?: ', done )
print('###')