Package: radio-gyms
Radio GymsRadio Gyms is an open-source bundle of AI environments for radio communications.
The simulations are built for AI gyms with the support of radio-related calculation modules, and theoretical radio propagation models to simulate an accurate prediction,
specifically to perform reinforcement learning algorithms.InstallationPyPi Package via pippipinstallradio_gymsBuild from sourcegitclonehttps://github.com/intelek-ai/radio-gymscdradio-gyms
python-mpipinstall.cd..
rm-rfradio_gymsDependenciespython 3.8+numpypygletpywavefrontFeaturesRadio gyms provides the toolkit for building wireless communication simulations including modules can be called to build and
customize the radio propagation simulation.1. Calling Primitive Ray Tracer for Outdoor PropagationThe ray tracer can be called for computing the radio propagation paths in the following example.fromradio_gyms.enginesimportTracerSCENE_FILE_PATH="./city.obj"tracer=Tracer(SCENE_FILE_PATH)# position (x, y, z)tx_pos=[0,15,0]rx_pos=[-30,1.5,45]# get traced resultresult=tracer.trace_outdoor(tx_pos,rx_pos)# result# {'direct': False,# 'reflections': {'single': [   array([-28.94988531,   4.22886929,  62.39469675]),#                               array([-70.80339945,   7.04682531,  15.22840999])],#                  'double': []},# 'roof_edges': [array([-19.24403786,   8.5621709 ,  28.8660568 ]# 'tx_pos': array([ 0, 15,  0]),# 'rx_pos': array([-30. ,   1.5,  45. ]),# )]}2. Calculate the traced result with the theoretical outdoor modelThe result from the ray tracer can be calculated by the propagation models inradio_gyms.models.
In this example,TheoreticalOutdoorModelcan compute the traced results to predict the signal strength
and delay between the receiver and transmitter based on the theoretical radio propagation models.fromradio_gyms.modelsimportTheoreticalOutdoorModelresult={'direct':False,'reflections':{'single':[[-28.94988531,4.22886929,62.39469675],[-70.80339945,7.04682531,15.22840999]],'double':[]},'roof_edges':[[-19.24403786,8.5621709,28.8660568]],'tx_pos':[0,15,0],'rx_pos':[-30.,1.5,45.],}model=TheoreticalOutdoorModel(result,tx_power_dbm=20)maximum_received_power=model.calculate_max_received_power(frequency=5.4e9)# -72.51 dBmimpulses=model.calculate_signal_impulses(freq=5.4e9)# [{'strength': -85.94590320344925, 'delay': 1.8653420787826134e-07},# {'strength': -74.3214622218488, 'delay': 2.910702009034143e-07},# {'strength': -77.80902883055407, 'delay': 4.125241781539828e-07}]3. Visualize the data with windowAs we obtain the traced paths from the tracer, we can convert these paths into lines for the visualization.Window()can be called to read the lines and the scene to visualize the scene in 3D bywindow.run().importnumpyasnpfromradio_gyms.visualizersimportWindowfromradio_gyms.engines.ray_tracer.tracerimportTracerfromradio_gyms.utilsimportOutdoorResultToLinesMAT_OBJ_PATH="./city.objwindow=Window()window.load_obj_to_scene(MAT_OBJ_PATH)tracer=Tracer(MAT_OBJ_PATH)tx_pos=np.array([0,5,0])lines=[]whileTrue:rx_pos=(np.random.rand(3)*2-1)*100rx_pos[1]=1.2iftracer.is_outdoor(rx_pos):breakresult=tracer.trace_outdoor(tx_pos,rx_pos)lines=lines+OutdoorResultToLines(result)window.line_sets=lineswindow.run()With the.run()The camera can be moved byWASDkeys and rotated byQE.4. Visualize the scene and radio propagation paths during running a simulationwindow.render()can be called to visualize the simulation frame as the simulation updates the components.fromradio_gyms.engines.ray_tracer.tracerimportTracerfromradio_gyms.visualizersimportWindowfromradio_gyms.utils.convertersimportoutdoor_traced_result_to_lineasOutdoorResultToLinesfromradio_gyms.simulationsimportOldtownWalkMAP_OBJ_PATH="./city.obj"window=Window()window.load_obj_to_scene(MAP_OBJ_PATH)tracer=Tracer(MAP_OBJ_PATH,ref_max=2)# ref_max == max reflection tracingsimulation=OldtownWalk(tracer,1,5)# Run 100 episodesforiinrange(100):simulation.update(1)# update time in the simulation by 1 secondresults=simulation.get_results()# get result from simulationwindow.line_sets=[]# convert the results to lines for visualizing in windowforresultinresults:result_lines=OutdoorResultToLines(result)window.line_sets+=result_lines# render the scenewindow.render()window.dispatch_events()5. Visualize the scene and radio propagation paths on notebookRadio gyms can be visualized on a notebook in 2D by usingutils.Plotter.Plotter()requires definition of boundary of the map to visualize. The parameters such as points and lines can be passed to Plotter to visualize the data.fromradio_gyms.enginesimportTracerfromradio_gyms.utilsimportPlotter,OutdoorResultToLinesMAP_SCENE="./city.obj"tracer=Tracer(MAP_SCENE)rx=[0,1.2,0]tx=[-50,4,40]result=tracer.trace_outdoor(tx,rx)terrain_map=tracer.get_terrain_depth(64,64)plotter=Plotter(tracer.min_bound,tracer.max_bound,terrain_map)plotter.rx_pos.append(rx)plotter.tx_pos.append(tx)plotter.lines=OutdoorResultToLines(result)plotter.render_top()# Display from top viewGyms1.radio-gym-01: Cooperative Small Cell Power Switching (Coming soon, V1.0.0)EnvironmentThe environment consists of mobile UEs as pedestrians walk in the old town and multiple small cells.
The small cells can sense the signal strength and delay of pedestrians where UEs only connect to the cell which provides the
strongest signal.RewardThe reward is considered for average connected signal strength of all UEs to cells, the average signal-to-noise (SNR) of UEs
between connected cell and disconnected cell, and the consumption transmitting power.ActionEach cell can control its own transmitting power.2.radio-gym-02: Beamformer by antenna node control (Expected in v1.5)DocumentationRadio Gyms provides radio propagation engines and tools for customizations.
The official documentation can be found atradio-gyms.intelek.aiCitationsThe pre-released source code can be cited with the following bibtex entry.@misc{radiogyms2022,
  author = {Supawat Tamsri},
  title = {Radio Gyms},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/intelek-ai/radio-gyms}},
}ContributorsSupawat Tamsri,supawat@intelek.aiFounds and develops.Muhammad Aamir Khan,aamir@intelek.aiSupervises on machine learning research and AI environments.Prof. Eng. Krzysztof Cichoń,krzysztof.cichon@put.poznan.plSupervises on radio propagation and channel modelling features.Validates and verifies theoretical models and simulated results.CommunityFeel free to suggest an environment idea or contribute with us.DiscordRoad Mapv0.1.x - Radio Ray Tracerv0.2.x - Theoretical Outdoor Propagation Modelv0.3.x - Transmitter and Receiver Controllerv0.4.x - Visualization for desktopv0.5.x - Visualization for notebookv0.6.x - Outdoor Simulationv0.7.x - Radio Gym 01: Wireless UAV Location Controlv0.8.x - Radio Gym 02: UE Location Predictionv0.9.x - Radio Gym 03: Cooperative Small Cell Power Controlv0.9.5 - Beamforming Enginev1.0.x - Radio Gym 04: Intelligent Beamformerv1.1.x - FDTD EngineLicenseThe digital contents in/assetsare available under Creative Commons (CC) license.Source code is licensed under© Intelek AIMIT.MIT LicenseCopyright (c) 2022 Intelek AIPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.