Description
I tried generating multiple slots in sequence using Sionna PUSCHTransmitter layer using the script shown below, where I'm setting the appropriate frame numbers and slot numbers(within each frame) within the loop. But, the slot lengths are different for slots 0, 14, 20, 34, ... compared to other slot numbers as show in the output text after the code segment.
When I plot the Resource Grid and Pilot Pattern for each slot(commented out at the end of the script), they appear identical for all slots. So why do the slot lengths differ and why for those specific slots numbers (0 and 14) within each frame?
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import sionna
from sionna.nr import PUSCHConfig, PUSCHTransmitter
pusch_config = PUSCHConfig()
pusch_config.carrier.cyclic_prefix = "normal"
pusch_config.carrier.subcarrier_spacing = 30000/1000 # Expressed in units of KHz in Sionna
pusch_config.carrier.n_cell_id = 1 # int, 1 (default) | [0,…,1007]
pusch_config.carrier.n_size_grid = 106 # int, 4 (default) | [1,…,275]
pusch_config.carrier.n_start_grid = 0 # int, 0 (default) | [0,…,2199]
pusch_config.mapping_type = "A" # string, “A” (default) | “B” ;
pusch_config.n_rnti = 60 # int, 1 (default), [0,…,65535];
pusch_config.n_size_bwp = 104 # int, None (default), [1,…,275];
pusch_config.n_start_bwp = 1 # int, 0 (default) | [0,…,2199]
pusch_config.num_antenna_ports = 1
pusch_config.num_layers = 1
pusch_config.precoding = "non-codebook" # str, “non-codebook” (default), “codebook”
pusch_config.tpmi = 0 # int, 0 (default) | [0,…,27] ; Transmit precoding matrix indicator
pusch_config.transform_precoding = False # bool, False (default); Use transform precoding
pusch_config.dmrs.dmrs_port_set = [] # list, [] (default) | [0,…,11]; If set to [], the port set will be equal to [0,…,num_layers-1]
pusch_config.dmrs.config_type = 1 # int, 1 (default) | 2;
pusch_config.dmrs.length = 1 # int, 1 (default) | 2
pusch_config.dmrs.additional_position = 1 # int, 0 (default) | 1 | 2 | 3
pusch_config.dmrs.n_id = 0 # 2-tuple, None (default), [[0,…,65535], [0,…,65535]]; If None, the property n_cell_id of the CarrierConfig is used. DM-RS scrambling identities (NID0 and NID1) - same as NIDNSCID (refer MATLAB help for nrPDSCHDMRSConfig/NIDNSCID).
pusch_config.dmrs.n_scid = 0 # int, 0 (default) | 1; DMRS scrambling initialization
pusch_config.dmrs.num_cdm_groups_without_data = 2 # int, 2 (default) | 1 | 3;
pusch_config.dmrs.type_a_position = 2 # int, 2 (default) | 3 ; Defines the position of the first DMRS symbol within a slot. Applies only if the property mapping_type of PUSCHConfig is equal to “A”.
pusch_config.tb.channel_type = "PUSCH" # 5G NR physical channel type. Valid choices are “PDSCH” and “PUSCH”.
pusch_config.tb.mcs_index = 16 # MCS index within selected mcs table
pusch_config.tb.mcs_table = 2 # MCS table number
pusch_config.tb.n_id = None # int, None (default), [0, 1023]; If None, the PUSCHConfig will automatically set to n_cell_id. Data scrambling initialization.
grid_list = []
for slot_num in range(0,36):
num_slots_per_frame = pusch_config.carrier.num_slots_per_frame # int, 0 (default), [0,…,num_slots_per_frame] | TODO: Find out how to extract slot number from scn
pusch_config.carrier.frame_number = int(slot_num/num_slots_per_frame) # 0 (default), [0,…,1023]
pusch_config.carrier.slot_number = slot_num % (num_slots_per_frame) # int, 0 (default), [0,…,num_slots_per_frame]; Slot number within a frame
pusch_config.check_config()
slotGeneratorPUSCH = PUSCHTransmitter(pusch_config, return_bits=True, output_domain='time', dtype=tf.complex64, verbose=False)
batch_size = 1
x,b = slotGeneratorPUSCH.call(batch_size)
print(f"Slot#{slot_num} shape = {x.shape} [frame#{pusch_config.carrier.frame_number}, slotInFrame#{pusch_config.carrier.slot_number}]")
#figRG = slotGeneratorPUSCH.resource_grid.show()
#figRG.suptitle(f"Slot#{slot_num} Resource Grid")
#figPP = slotGeneratorPUSCH.pilot_pattern.show()
#figPP[-1].suptitle(f"Slot#{slot_num} Pilot Pattern")
Slot#0 shape = (1, 1, 1, 18984) [frame#0, slotInFrame#0]
Slot#1 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#1]
Slot#2 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#2]
Slot#3 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#3]
Slot#4 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#4]
Slot#5 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#5]
Slot#6 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#6]
Slot#7 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#7]
Slot#8 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#8]
Slot#9 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#9]
Slot#10 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#10]
Slot#11 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#11]
Slot#12 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#12]
Slot#13 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#13]
Slot#14 shape = (1, 1, 1, 18984) [frame#0, slotInFrame#14]
Slot#15 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#15]
Slot#16 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#16]
Slot#17 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#17]
Slot#18 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#18]
Slot#19 shape = (1, 1, 1, 18704) [frame#0, slotInFrame#19]
Slot#20 shape = (1, 1, 1, 18984) [frame#1, slotInFrame#0]
Slot#21 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#1]
Slot#22 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#2]
Slot#23 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#3]
Slot#24 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#4]
Slot#25 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#5]
Slot#26 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#6]
Slot#27 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#7]
Slot#28 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#8]
Slot#29 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#9]
Slot#30 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#10]
Slot#31 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#11]
Slot#32 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#12]
Slot#33 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#13]
Slot#34 shape = (1, 1, 1, 18984) [frame#1, slotInFrame#14]
Slot#35 shape = (1, 1, 1, 18704) [frame#1, slotInFrame#15]