Coder Social home page Coder Social logo

Comments (5)

jhoydis avatar jhoydis commented on June 12, 2024

Hi @DerBambus,

Could you provide a minimal code snippet that reproduces the issue you are observing? Screenshots of your code are not really helpful.

The order of the CIRs is given by their shape [...,num_rx, num_rx_ant, num_tx, num_tx_ant....].
The receivers and transmitters are numbered in the order by which they are added to the scene.
For example, the channel from alicetx to bobrx would have the index [...,1,0,0,0,....].

from sionna.

DerBambus avatar DerBambus commented on June 12, 2024

The following would be the minimal code to reproduce said issue:

    simulation_scene = load_scene(<scene_file_name>)
    simulation_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
    simulation_scene.rx_array = PlanarArray(num_rows=1,
                                        num_cols=1,
                                        vertical_spacing=0.5,
                                        horizontal_spacing=0.5,
                                        pattern="tr38901",
                                        polarization="V")

    # Create transmitter
    alicetx = Transmitter(name="aliceTX",
                     position=sender_position,
                     orientation=[0, 0, 0])
    simulation_scene.add(alicetx)

     #TODO: rebuild simulation with two transmitters?   
    bobtx = Transmitter(name="bobTX",
                     position=receiver_position,
                     orientation=[0, 0, 0])
    simulation_scene.add(bobtx)

    # Create a receiver
    alicerx = Receiver(name="aliceRX",
                  position=sender_position,
                  orientation=[0, 0, 0])
    simulation_scene.add(alicerx)

    bobrx = Receiver(name="bobRX",
                  position=receiver_position,
                  orientation=[0, 0, 0])
    simulation_scene.add(bobrx)

    ## RX points towards TX
    bobrx.look_at(alicetx)
    alicerx.look_at(bobtx)

    simulation_scene.frequency = frequency
    simulation_scene.synthetic_array = True

    current_paths = simulation_scene.compute_paths()
    a, tau = current_paths.cir()
    frequencies = subcarrier_frequencies(config.fft_size, config.subcarrier_spacing)
    current_cir = cir_to_ofdm_channel(frequencies, a, tau)                                                                     
    current_cir = tf.reshape(current_cir, ((2, 1000))

where <scene_file_name> is the relative path to my scene xml file:

<scene version="2.1.0">

<!-- Defaults, these can be set via the command line: -Darg=value -->

	<default name="spp" value="4096"/>
	<default name="resx" value="1920"/>
	<default name="resy" value="1080"/>

<!-- Camera and Rendering Parameters -->

	<integrator type="path">
		<integer name="max_depth" value="12"/>
	</integrator>
	<sensor type="perspective">
		<string name="fov_axis" value="x"/>
		<float name="fov" value="39.597755"/>
		<float name="principal_point_offset_x" value="0.000000"/>
		<float name="principal_point_offset_y" value="-0.000000"/>
		<float name="near_clip" value="0.100000"/>
		<float name="far_clip" value="100.000000"/>
		<transform name="to_world">
			<rotate x="1" angle="-153.5592908827048"/>
			<rotate y="1" angle="-46.691938147394204"/>
			<rotate z="1" angle="-179.999991348578"/>
			<translate value="7.358891 4.958309 6.925791"/>
		</transform>
		<sampler type="independent">
			<integer name="sample_count" value="$spp"/>
		</sampler>
		<film type="hdrfilm">
			<integer name="width" value="$resx"/>
			<integer name="height" value="$resy"/>
		</film>
	</sensor>

<!-- Materials -->

	<bsdf type="twosided" id="mat-itu_concrete">
		<bsdf type="principled">
			<rgb value="0.800000 0.800000 0.800000" name="base_color"/>
			<float name="spec_tint" value="0.000000"/>
			<float name="spec_trans" value="0.000000"/>
			<float name="metallic" value="0.000000"/>
			<float name="anisotropic" value="0.000000"/>
			<float name="roughness" value="0.500000"/>
			<float name="sheen" value="0.000000"/>
			<float name="sheen_tint" value="0.500000"/>
			<float name="clearcoat" value="0.000000"/>
			<float name="clearcoat_gloss" value="0.173205"/>
			<float name="specular" value="0.500000"/>
		</bsdf>
	</bsdf>

<!-- Emitters -->

	<emitter type="point">
		<point name="position" x="4.076245307922363" y="5.903861999511719" z="-1.0054539442062378"/>
		<rgb value="79.577469 79.577469 79.577469" name="intensity"/>
	</emitter>

<!-- Shapes -->

	<shape type="ply">
		<string name="filename" value="meshes/Plane.ply"/>
		<boolean name="face_normals" value="true"/>
		<ref id="mat-itu_concrete" name="bsdf"/>
	</shape>
</scene> ```

from sionna.

jhoydis avatar jhoydis commented on June 12, 2024

Hi,

I cannot execute this code as there are undefined variables. Could you also please use a scene that is provided with Sionna?
In your updated example, could you please explain clearly which outputs are unexpected?

from sionna.

DerBambus avatar DerBambus commented on June 12, 2024

Sorry my bad, the following code should run normally:

from sionna.rt import load_scene, Transmitter, Receiver, PlanarArray, Camera
from sionna.channel.utils import subcarrier_frequencies
from sionna.channel.utils import cir_to_ofdm_channel
import sionna
import tensorflow as tf

simulation_scene = load_scene(sionna.rt.scene.simple_reflector)
simulation_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
simulation_scene.rx_array = PlanarArray(num_rows=1,
                                    num_cols=1,
                                    vertical_spacing=0.5,
                                    horizontal_spacing=0.5,
                                    pattern="tr38901",
                                    polarization="V")

# Create transmitter
alicetx = Transmitter(name="aliceTX",
                 position=[0, 0, 1.5],
                 orientation=[0, 0, 0])

simulation_scene.add(alicetx)

 #TODO: rebuild simulation with two transmitters?   
bobtx = Transmitter(name="bobTX",
                 position=[10, 0, 1.5],
                 orientation=[0, 0, 0])

simulation_scene.add(bobtx)

# Create a receiver
alicerx = Receiver(name="aliceRX",
              position=[0, 0, 1.5],
              orientation=[0, 0, 0])

simulation_scene.add(alicerx)

bobrx = Receiver(name="bobRX",
              position=[10, 0, 1.5],
              orientation=[0, 0, 0])

simulation_scene.add(bobrx)

## RX points towards TX
bobrx.look_at(alicetx)
alicerx.look_at(bobtx)

simulation_scene.frequency = 2e9
simulation_scene.synthetic_array = True
current_paths = simulation_scene.compute_paths()
a, tau = current_paths.cir()
frequencies = subcarrier_frequencies(1000, 15e3)
current_cir = cir_to_ofdm_channel(frequencies, a, tau)                                                                     
current_cir = tf.reshape(current_cir, (4, 1000))
print(current_cir)

When running this code, the tensor with the current cir values looks as follows:
Screenshot_20240410_105558

So am I correct in assuming the four values here are in this order?
alice -> alice
bob -> alice
alice -> bob
bob -> bob

If this is the case, I would expect the CIRs of bob -> alice and alice -> bob to be the same, however these values never seem to match (except for channel noise, which currently isn't part of the simulation I believe).
I've tried using different frequencies, different scenes, etc., but the problem seems to persist.

Thank you for your troubles^^

from sionna.

jhoydis avatar jhoydis commented on June 12, 2024

Hi,

The issue in your example is that you are using directive antenna patterns. AliceTX is oriented towards BobRX because the default orientation points toward the positive x-axis. However, BobTX points away from AliceRX which is located in the opposite direction..

If you change the antenna patterns to "iso", you get the results you expect. Alternatively, you can make the transmitters to look at the receivers. You would need to add these two lines to your code to achieve this:

## TX points towards RX
bobtx.look_at(alicerx)
alicetx.look_at(bobrx)

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.