Skip to content

Commit

Permalink
Sionna Raytracing
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerjan committed Jul 22, 2024
1 parent f0af821 commit 2cb18e6
Show file tree
Hide file tree
Showing 12 changed files with 607 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Unit Testing:
- Build Python 3.11
before_script:
- apt -qq update && apt-get -qq install -y octave portaudio19-dev python-dev-is-python3 unzip # remove for docker
- pip install -qq -e .\[develop,test,quadriga,audio\]
- pip install -qq -e .\[develop,test,quadriga,audio,sionna\]
- unzip dist/$HERMES_WHEEL_11 "hermespy/fec/aff3ct/*.so"
- pip install -qq pyzmq>=25.1.1 usrp-uhd-client memray>=1.11.0
script:
Expand All @@ -93,7 +93,7 @@ Integration Testing:
- Build Python 3.11
before_script:
- apt -qq update && apt-get -qq install -y octave portaudio19-dev python-dev-is-python3 # remove for docker
- pip install -qq dist/$HERMES_WHEEL_11\[test,quadriga,audio\]
- pip install -qq dist/$HERMES_WHEEL_11\[test,quadriga,audio,sionna\]
- pip install -qq memray
script:
- python ./tests/test_install.py ./tests/integration_tests/
Expand Down
1 change: 1 addition & 0 deletions docssource/api/channel/channel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ Note that these models might require specifying the linked devices :meth:`positi
delay/delay
radar/radar
quadriga
sionna-rt

.. toctree::
:hidden:
Expand Down
63 changes: 63 additions & 0 deletions docssource/api/channel/sionna-rt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
================
SionnaRT Channel
================


.. inheritance-diagram:: hermespy.channel.sionna_rt_channel.SionnaRTChannel hermespy.channel.sionna_rt_channel.SionnaRTChannelRealization hermespy.channel.sionna_rt_channel.SionnaRTChannelSample
:parts: 1


The :class:`SionnaRTChannel<hermespy.channel.sionna_rt_channel.SionnaRTChannel>` is an adapter for `Sionna Ray Tracing <https://nvlabs.github.io/sionna/api/rt.html>`_ module.

It is deterministic, defined by the given `sionna.rt.Scene <https://nvlabs.github.io/sionna/api/rt.html#scene>`_. Meaning, given same devices and positions, different channel samples (:class:`SionnaRTChannelSample<hermespy.channel.sionna_rt_channel.SionnaRTChannelSample>`) and realizations (:class:`SionnaRTChannelRealization<hermespy.channel.sionna_rt_channel.SionnaRTChannelRealization>``) would not introduce any random changes and would produce equal state and propagation results.

This channel model requires `sionna.rt.Scene` to operate. It should be loaded with `sionna.rt.load_scene` and provided to the :class:`SionnaRTChannel<hermespy.channel.sionna_rt_channel.SionnaRTChannel>` `__init__` method.

Current assumptions in the adapter implementation are:

* All the transmitting and receiving antennas utilize isometric pattern (`"iso"`) and a single vertical polarization (`"V"`).
* The antenna arrays are `synthetic <https://nvlabs.github.io/sionna/api/rt.html?highlight=synthetic_array#sionna.rt.Scene.synthetic_array>`_.
* The delays are not `normalized <https://nvlabs.github.io/sionna/api/rt.html?highlight=normalize_delays#sionna.rt.Paths.normalize_delays>`_.
* If not a single ray hit was cought, then a zeroed signal or state are returned.

It should be noted that `sionna.rt.Scene` is a singleton class. So when a new scene is loaded, a conflict with the previous existing instance will occure. Thus usage of several scenes at once must be avoided.

.. mermaid::

classDiagram

direction LR

class SionnaRTChannel {

_realize() : SionnaRTChannelRealization
}

class SionnaRTChannelRealization {

_sample() : SionnaRTChannelSample
}

class SionnaRTChannelSample {

propagate(Signal) : Signal
}

SionnaRTChannel --o SionnaRTChannelRealization : realize()
SionnaRTChannelRealization --o SionnaRTChannelSample : sample()

click SionnaRTChannel href "#hermespy.channel.sionna_rt_channel.SionnaRTChannel"
click SionnaRTChannelRealization href "#hermespy.channel.sionna_rt_channel.SionnaRTChannelRealization"
click SionnaRTChannelSample href "#hermespy.channel.sionna_rt_channel.SionnaRTChannelSample"

The following minimal example outlines how to configure the channel model
within the context of a :class:`Simulation<hermespy.simulation.simulation.Simulation>`:

.. literalinclude:: ../../../scripts/examples/channel_SionnaRT.py
:language: python
:linenos:
:lines: 11-36

.. autoclass:: hermespy.channel.fading.exponential.Exponential

.. footbibliography::
43 changes: 43 additions & 0 deletions docssource/scripts/examples/channel_SionnaRT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-

import matplotlib.pyplot as plt
import numpy as np

from hermespy.core import dB, Transformation
from hermespy.channel.sionna_rt_channel import SionnaRTChannel, rt
from hermespy.modem import BitErrorEvaluator, RRCWaveform, SimplexLink, SCLeastSquaresChannelEstimation, SCZeroForcingChannelEqualization
from hermespy.simulation import Simulation


# Initialize two devices to be linked by a channel
simulation = Simulation()
alpha_device = simulation.new_device(
carrier_frequency=24e9, pose=Transformation.From_Translation(np.array([8.5, 21., 27.])))
beta_device = simulation.new_device(
carrier_frequency=24e9, pose=Transformation.From_Translation(np.array([45., 90., 1.5])))

# Load the desired scene
scene = rt.load_scene(rt.scene.munich)

# Create a channel between the two devices
channel = SionnaRTChannel(scene=scene, gain=1., seed=42)
simulation.set_channel(alpha_device, beta_device, channel)

# Configure communication link between the two devices
link = SimplexLink(alpha_device, beta_device)

# Specify the waveform and postprocessing to be used by the link
link.waveform = RRCWaveform(
symbol_rate=1e8, oversampling_factor=2, num_data_symbols=1000,
num_preamble_symbols=10, pilot_rate=10)
link.waveform.channel_estimation = SCLeastSquaresChannelEstimation()
link.waveform.channel_equalization = SCZeroForcingChannelEqualization()

# Configure a simulation to evaluate the link's BER and sweep over the receive SNR
simulation.add_evaluator(BitErrorEvaluator(link, link))
simulation.new_dimension('noise_level', dB(0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20), beta_device)

# Run simulation and plot resulting SNR curve
result = simulation.run()
result.plot()
plt.show()
9 changes: 2 additions & 7 deletions hermespy/channel/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
RandomNode,
SerializableEnum,
Signal,
SparseSignal,
Transformation,
ChannelStateInformation,
Serializable,
Expand Down Expand Up @@ -396,12 +395,8 @@ def propagate(
)

# Propagate each signal block
propagated_signal = SparseSignal.Empty(
self.bandwidth, self.num_receive_antennas, carrier_frequency=self.carrier_frequency
)
for signal_block in _signal:
propagated_signal._blocks.append(self._propagate(signal_block, interpolation_mode))
return propagated_signal
signal_blocks_propagated = [self._propagate(b, interpolation_mode) for b in _signal]
return _signal.Create(signal_blocks_propagated, self.bandwidth, self.carrier_frequency)

@abstractmethod
def state(
Expand Down
Loading

0 comments on commit 2cb18e6

Please sign in to comment.