Coder Social home page Coder Social logo

Sionna RT result error about sionna HOT 5 OPEN

fanyimeng0 avatar fanyimeng0 commented on June 12, 2024
Sionna RT result error

from sionna.

Comments (5)

merlinND avatar merlinND commented on June 12, 2024

Hello @fanyimeng0,

I am pasting the contents of your report below for visibility.


%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import time
# Import Sionna RT components
from sionna.rt import load_scene, Transmitter, Receiver, PlanarArray, Camera
# For link-level simulations
from sionna.channel import cir_to_ofdm_channel, subcarrier_frequencies, OFDMChannel, ApplyOFDMChannel, CIRDataset
from sionna.nr import PUSCHConfig, PUSCHTransmitter, PUSCHReceiver
from sionna.utils import compute_ber, ebnodb2no, PlotBER
from sionna.ofdm import KBestDetector, LinearDetector
from sionna.mimo import StreamManagement
import os
gpu_num = 0 # Use "" to use the CPU
os.environ["CUDA_VISIBLE_DEVICES"] = f"{gpu_num}"
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
# Import Sionna
try:
    import sionna
except ImportError as e:
    # Install Sionna if package is not already installed
    import os
    os.system("pip install sionna")
    import sionna
# Load the required Sionna components
from sionna.nr import PUSCHConfig, PUSCHTransmitter, PUSCHReceiver
from sionna.channel import AWGN, RayleighBlockFading, OFDMChannel, TimeChannel, time_lag_discrete_time_channel
from sionna.channel.tr38901 import AntennaArray, UMi, UMa, RMa
from sionna.channel import gen_single_sector_topology as gen_topology
from sionna.utils import compute_ber, ebnodb2no, sim_ber
from sionna.ofdm import KBestDetector, LinearDetector
from sionna.mimo import StreamManagement
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import sys

from sionna.utils import BinarySource, QAMSource, ebnodb2no, compute_ser, compute_ber, PlotBER
from sionna.channel import FlatFadingChannel, KroneckerModel
from sionna.channel.utils import exp_corr_mat
from sionna.mimo import lmmse_equalizer
from sionna.mapping import SymbolDemapper, Mapper, Demapper
from sionna.fec.ldpc.encoding import LDPC5GEncoder
from sionna.fec.ldpc.decoding import LDPC5GDecoder
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pickle
import time

from sionna.mimo import StreamManagement

from sionna.ofdm import ResourceGrid, ResourceGridMapper, LSChannelEstimator, LMMSEEqualizer
from sionna.ofdm import OFDMModulator, OFDMDemodulator, ZFPrecoder, RemoveNulledSubcarriers

from sionna.channel.tr38901 import AntennaArray, CDL, Antenna
from sionna.channel import subcarrier_frequencies, cir_to_ofdm_channel, cir_to_time_channel, time_lag_discrete_time_channel
from sionna.channel import ApplyOFDMChannel, ApplyTimeChannel, OFDMChannel, TimeChannel

from sionna.fec.ldpc.encoding import LDPC5GEncoder
from sionna.fec.ldpc.decoding import LDPC5GDecoder

from sionna.mapping import Mapper, Demapper

from sionna.utils import BinarySource, ebnodb2no, sim_ber
from sionna.utils.metrics import compute_ber
import tensorflow as tf
# Configure the notebook to use only a single GPU and allocate only as much memory as needed
# For more details, see https://www.tensorflow.org/guide/gpu
gpus = tf.config.list_physical_devices('GPU')
if gpus:
    try:
        tf.config.experimental.set_memory_growth(gpus[0], True)
    except RuntimeError as e:
        print(e)
# Avoid warnings from TensorFlow
tf.get_logger().setLevel('ERROR')
scene = load_scene("../test_bg/test.xml") 
scene.remove("tx")
scene.remove("rx")
scene.tx_array = PlanarArray(num_rows=1,
                             num_cols=1,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="tr38901",
                             polarization="V")

# Configure antenna array for all receivers
scene.rx_array = PlanarArray(num_rows=9,
                             num_cols=9,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="tr38901",
                             polarization="V")

# Create transmitter
tx = Transmitter(name="tx",
                 position=[0,-10,17])

# Add transmitter instance to scene
scene.add(tx)

# Create a receiver
rx = Receiver(name="rx",
              position=[0,-10,17],
              orientation=[0,0,0])

# Add receiver instance to scene
scene.add(rx)

#tx.look_at(rx) # Transmitter points towards receiver
scene.frequency = 2.6e9 # in Hz; implicitly updates RadioMaterials
scene.synthetic_array = True # If set to False, ray tracing will be done per antenna element (slower for large arrays)
# Compute propagation paths
paths = scene.compute_paths(max_depth=2,
                            num_samples=1e6)  # Number of rays shot into directions defined
                                              # by a Fibonacci sphere , too few rays can
                                              # lead to missing paths

# Visualize paths in the 3D preview
a, tau = paths.cir()
print("Shape of `a` after applying Doppler shifts: ", paths.a.shape)
re = np.diff(np.angle(a[0,0,:,0,0,1,0]))*180/np.pi
re[re < 0] += 360
print(re)
#scene.preview(paths, show_devices=True, show_paths=True) # Use the mouse to focus on the visualized paths
Shape of `a` after applying Doppler shifts:  (1, 1, 81, 1, 1, 2, 1)
[106.611206 106.611275 106.61128  106.6113   106.61126  106.61131
 106.61127  106.61126  300.78107  106.611275 106.611275 106.61127
 106.61126  106.611275 106.61131  106.61127  106.61126  300.78104
 106.611275 106.61131  106.61125  106.61128  106.61126  106.61133
 106.61126  106.611244 300.7811   106.61124  106.6113   106.611305
 106.61125  106.61127  106.611305 106.611305 106.611244 300.78104
 106.61127  106.611275 106.61128  106.61125  106.61127  106.61131
 106.611244 106.61127  300.78104  106.61125  106.61131  106.61128
 106.61127  106.61125  106.611305 106.6113   106.611244 300.7811
 106.61126  106.611275 106.6113   106.61126  106.611275 106.6113
 106.611244 106.611275 300.78104  106.61126  106.6113   106.61128
 106.611275 106.61126  106.6113   106.611244 106.611275 300.78107
 106.611275 106.6113   106.61128  106.61126  106.6113   106.611275
 106.611275 106.611206]
scene.remove("tx")
scene.remove("rx")
scene.tx_array = PlanarArray(num_rows=1,
                             num_cols=1,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="tr38901",
                             polarization="V")

# Configure antenna array for all receivers
scene.rx_array = PlanarArray(num_rows=9,
                             num_cols=9,
                             vertical_spacing=0.5,
                             horizontal_spacing=0.5,
                             pattern="tr38901",
                             polarization="V")

# Create transmitter
tx = Transmitter(name="tx",
                 position=[0,-10,17])

# Add transmitter instance to scene
scene.add(tx)

# Create a receiver
rx = Receiver(name="rx",
              position=[0,-10,17],
              orientation=[0,0,0])

# Add receiver instance to scene
scene.add(rx)

#tx.look_at(rx) # Transmitter points towards receiver
scene.frequency = 2.6e9 # in Hz; implicitly updates RadioMaterials
scene.synthetic_array = True # If set to False, ray tracing will be done per antenna element (slower for large arrays)
# Compute propagation paths
paths = scene.compute_paths(max_depth=2,
                            num_samples=1e6)  # Number of rays shot into directions defined
                                              # by a Fibonacci sphere , too few rays can
                                              # lead to missing paths

# Visualize paths in the 3D preview
a, tau = paths.cir()
print("Shape of `a` after applying Doppler shifts: ", paths.a.shape)
re = np.diff(np.angle(a[0,0,:,0,0,1,0]))*180/np.pi
re[re < 0] += 360
print(re)
#scene.preview(paths, show_devices=True, show_paths=True) # Use the mouse to focus on the visualized paths
Shape of `a` after applying Doppler shifts:  (1, 1, 81, 1, 1, 2, 1)
[143.51534  143.51512  143.51521  143.51517  143.51523  143.51517
 143.51524  143.51515   31.051336 143.51517  143.51517  143.5152
 143.51518  143.5152   143.51518  143.51526  143.51515   31.051294
 143.51517  143.51517  143.51523  143.5152   143.51521  143.51518
 143.51524  143.51518   31.05131  143.51524  143.51508  143.51523
 143.5152   143.51521  143.51517  143.51526  143.51515   31.05129
 143.51521  143.51518  143.5152   143.5152   143.51521  143.51517
 143.51526  143.51517   31.051292 143.51517  143.51521  143.5152
 143.51518  143.5152   143.51515  143.51521  143.51517   31.051323
 143.51518  143.5152   143.51518  143.51521  143.5152   143.51518
 143.51527  143.5151    31.05133  143.51521  143.51518  143.51518
 143.51521  143.51517  143.5152   143.51529  143.51517   31.051224
 143.51521  143.51518  143.5152   143.51523  143.51517  143.51517
 143.51529  143.51521 ]

from sionna.

jhoydis avatar jhoydis commented on June 12, 2024

Hi @fanyimeng0,

I was trying to look into your issue but I do not have access to the scene that you are using.
Could you please provide a minimal code example reproducing the issue, using one of the scenes integrated with Sionna?

from sionna.

fanyimeng0 avatar fanyimeng0 commented on June 12, 2024

Hello,I reproduced this issue in sionna.rt.scene.munich. The third code cell in the Jupyter notebook is the same as the second one. I'm running the same code twice to demonstrate that the same code can lead to different results. The printed results are the phase difference between antennas.

`a, tau = paths.cir()

print("Shape of a : ", paths.a.shape)

re = np.diff(np.angle(a[0,0,:,0,0,1,0]))*180/np.pi

re[re < 0] += 360

print(re)`

And the attacked file is the result in munich scene.
RTtest.md

from sionna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.