ResourceGrid#
- class sionna.phy.ofdm.ResourceGrid(num_ofdm_symbols: int, fft_size: int, subcarrier_spacing: float, num_tx: int = 1, num_streams_per_tx: int = 1, cyclic_prefix_length: int = 0, num_guard_carriers: Tuple[int, int] = (0, 0), dc_null: bool = False, pilot_pattern: str | sionna.phy.ofdm.pilot_pattern.PilotPattern | None = None, pilot_ofdm_symbol_indices: List[int] | None = None, precision: Literal['single', 'double'] | None = None, device: str | None = None)[source]#
Bases:
sionna.phy.object.ObjectDefines a
ResourceGridspanning multiple OFDM symbols and subcarriers.A resource grid defines how data and pilot symbols are mapped onto a sequence of OFDM symbols with a given FFT size. The resource grid can also define guard and DC carriers which are nulled. In 4G/5G parlance, a resource grid would correspond to a slot.
Once a
ResourceGridis defined, one can use theResourceGridMapperto map a tensor of complex-valued data symbols onto the resource grid, prior to OFDM modulation using theOFDMModulatoror further processing in the frequency domain.Subcarriers are numbered from \(0\) to \(N-1\), where \(N\) is the FFT size. The index \(0\) corresponds to the lowest frequency, which is \(-\frac{N}{2}\Delta_f\) (for \(N\) even) or \(-\frac{N-1}{2}\Delta_f\) (for \(N\) odd), where \(\Delta_f\) is the subcarrier spacing. The index \(N-1\) corresponds to the highest frequency, which is \((\frac{N}{2}-1)\Delta_f\) (for \(N\) even) or \(\frac{N-1}{2}\Delta_f\) (for \(N\) odd).
- Parameters:
num_ofdm_symbols (int) – Number of OFDM symbols
fft_size (int) – FFT size (i.e., the number of subcarriers)
subcarrier_spacing (float) – Subcarrier spacing [Hz]
num_tx (int) – Number of transmitters. Defaults to 1.
num_streams_per_tx (int) – Number of streams per transmitter. Defaults to 1.
cyclic_prefix_length (int) – Length of the cyclic prefix. Defaults to 0.
num_guard_carriers (Tuple[int, int]) – Tuple of two integers defining the number of guard carriers at the left and right side of the resource grid. Defaults to (0, 0).
dc_null (bool) – If True, the DC carrier is nulled. Defaults to False.
pilot_pattern (str | sionna.phy.ofdm.pilot_pattern.PilotPattern | None) – An instance of
PilotPattern, a string shorthand for theKroneckerPilotPatternorEmptyPilotPattern, or None. None is equivalent to"empty". Defaults to None.pilot_ofdm_symbol_indices (List[int] | None) – List of indices of OFDM symbols reserved for pilot transmissions. Only needed if
pilot_pattern="kronecker". Defaults to None.precision (Literal['single', 'double'] | None) – Precision used for internal calculations and outputs. If set to None,
precisionis used.device (str | None) – Device for tensor operations. If None,
deviceis used.
Examples
The following code snippet shows how to setup and visualize an instance of
ResourceGrid:from sionna.phy.ofdm import ResourceGrid rg = ResourceGrid(num_ofdm_symbols=14, fft_size=64, subcarrier_spacing=30e3, num_tx=1, num_streams_per_tx=1, num_guard_carriers=[5, 6], dc_null=True, pilot_pattern="kronecker", pilot_ofdm_symbol_indices=[2, 11]) rg.show()
This code creates a resource grid consisting of 14 OFDM symbols with 64 subcarriers. The first five and last six subcarriers as well as the DC subcarriers are nulled. The second and eleventh OFDM symbol are reserved for pilot transmissions.
Attributes
- property num_effective_subcarriers: int#
Number of subcarriers used for data and pilot transmissions
- property effective_subcarrier_ind: numpy.ndarray#
Indices of the effective subcarriers
- property num_guard_carriers: numpy.ndarray#
Number of left and right guard carriers
- property dc_ind: int#
Index of the DC subcarrier.
If
fft_sizeis odd, the index is(fft_size-1)/2. Iffft_sizeis even, the index isfft_size/2.
- property pilot_pattern: sionna.phy.ofdm.pilot_pattern.PilotPattern#
Get/set the used
PilotPattern
Methods
- build_type_grid() torch.Tensor[source]#
Returns a tensor indicating the type of each resource element.
Resource elements can be one of
0 : Data symbol
1 : Pilot symbol
2 : Guard carrier symbol
3 : DC carrier symbol
- Outputs:
rg_type – [num_tx, num_streams_per_tx, num_ofdm_symbols, fft_size], torch.int32. Tensor indicating for each transmitter and stream the type of the resource elements of the corresponding resource grid. The type can be one of [0, 1, 2, 3] as explained above.