Grid
rpps.grid ¶
Resource grids of OFDM systems: cell search, the grid of each subframe with its channel estimates, and the physical channels read off it
grid steps in a profile take an OFDM system's samples to frames of its resource grid, and its physical channels read
them, a branch each (rpps.profile.branch). Formula mappings are code here; tables and sequences are definitions.
lte(FDD and TDD):LteCell(PSS/SSS cell search;searchlists the cells on a carrier),LteGrid(a frame per subframe, with each port's channel),PBCH(ports, MIB),PCFICH(CFI),PDCCH(DCI 1A, 1C),PDSCH(SIB1, SI), andtx. The profile islte/downlink.nr(FR1, 15 and 30 kHz):NrCell(PSS over a LEO pass's offsets, each SS/PBCH block tracked),NrGrid(a frame per subframe),PBCH,PDCCH(CORESET 0),PDSCH(LDPC, SIB1), andtx(withleo). Not every cell applies the per-symbol phase of 38.211 5.4: withfcthe PDSCH tries both. The profile isnr/downlink.
rpps.grid.lte ¶
LTE downlink (FDD and TDD): cell search, the resource grid with its channel estimates, and the physical channels to SIB1
Modules:
| Name | Description |
|---|---|
cell |
LTE cell search and frame timing (3GPP TS 36.211 6.11): a stream of samples to a stream of whole half-frames |
channels |
LTE downlink physical channels read off LteGrid's frames: PBCH (MIB), PCFICH (CFI), PDCCH (DCI), PDSCH (transport blocks) |
grid |
The LTE resource grid of each subframe, with every port's channel on every resource element |
phy |
LTE downlink physical layer: numerology, reference signals, resource-element maps, transmit diversity (3GPP TS 36.211) |
tx |
An LTE downlink to test the receive side with: cell signals, MIB, CFI, a DCI 1A to the SI-RNTI and its PDSCH |
cell ¶
LTE cell search and frame timing (3GPP TS 36.211 6.11): a stream of samples to a stream of whole half-frames
Every 5 ms two symbols carry the synchronization signals on the 62 central subcarriers: the primary (PSS: a Zadoff-Chu root that names N_ID2 = 0..2) and the secondary (SSS: two m-sequences that name N_ID1 = 0..167 and which half-frame it is). The cell is 3 N_ID1 + N_ID2. Where the two are says the duplex mode: FDD has the PSS in the last symbol of slot 0 of subframes 0 and 5 and the SSS the symbol before; TDD the PSS in symbol 2 of subframes 1 and 6 and the SSS in the last symbol of the subframes before. Normal cyclic prefix.
Acquiring (on the first acquire seconds): the PSS at 1.92 MS/s over a grid of carrier offsets (offset +- span), its
correlation folded on 5 ms; then each PSS at the full rate, the fractional offset from the cyclic prefix, and the SSS
of each, which votes on N_ID1 and the duplex mode and labels the half-frames. A cell found has its synchronization
signals subtracted from the samples and the search runs again about its carrier offset, so weaker cells on the same
carrier are found too (search lists them; pci says which one to receive, else the strongest). Two cells of one
N_ID2 with the same frame timing share their PSS, and the weaker is then seldom told apart. Tracking: each half-frame's PSS is found
again near where the last one put it (an alpha-beta loop on its position: the sample clock drifts) and the cyclic prefix
trims the offset.
Out come the samples from the first subframe 0 on, carrier offset taken off, cut into half-frames of exactly 5 ms at the
nominal rate (a sample dropped or repeated between them as the clock drifts), so the grid after it sees subframes at
fixed places: subframe n of the output is subframe n mod 10 of a radio frame. When the PSS is lost for lose
half-frames it is acquired again, and zeros stand in for the half-frames missed, so that still holds. The cell goes in
the stream's est["cell"].
Classes:
| Name | Description |
|---|---|
LteCell |
LTE cell search and half-frame timing (see the module) |
Functions:
| Name | Description |
|---|---|
pss |
The PSS of root u: Zadoff-Chu of length 63 without its middle element (it would sit on DC) |
sss |
The 62 SSS values in subframe 0 (half 0) or 5 (half 1) |
sss_table |
(336, 62): every (N_ID1, half) hypothesis, N_ID1 major |
search |
The cells on a carrier, strongest first, from the start of x |
LteCell ¶
LteCell(offset=0.0, span=50000.0, resolution=5000.0, acquire=0.04, lose=20, gate=0.2, pci=-1, duplex='auto', name='cell')
Bases: Stage
LTE cell search and half-frame timing (see the module)
offset: where the carrier is expected [Hz from the centre]; span, resolution: the offsets searched around it [Hz] acquire: seconds of samples the acquisition looks at; lose: half-frames without a PSS before acquiring again gate: the PSS's normalized correlation below which a half-frame has none pci: the cell to receive (-1: the strongest); duplex: "fdd", "tdd" or "auto" (the SSS says)
Source code in src/rpps/grid/lte/cell.py
pss ¶
sss ¶
The 62 SSS values in subframe 0 (half 0) or 5 (half 1)
Source code in src/rpps/grid/lte/cell.py
sss_table ¶
(336, 62): every (N_ID1, half) hypothesis, N_ID1 major
search ¶
search(x, fs, offset=0.0, span=50000.0, resolution=5000.0, duplex='auto', acquire=0.04, max_cells=8, gate=0.2)
The cells on a carrier, strongest first, from the start of x
A list of dicts: pci, duplex ("fdd" or "tdd"), offset [Hz from the centre], start (the first sample of a subframe 0), sss (the mean SSS correlation, 1: clean), level_db (the synchronization signals' power against the strongest's). offset, span, resolution: the carrier offsets searched; acquire: seconds looked at; gate: the strongest cell's PSS correlation at least
Source code in src/rpps/grid/lte/cell.py
channels ¶
LTE downlink physical channels read off LteGrid's frames: PBCH (MIB), PCFICH (CFI), PDCCH (DCI), PDSCH (transport blocks)
Each reads whole subframe frames (rpps.grid.lte.grid: a partial frame waits for the rest) and gives bits. Each publishes what it decoded from the first item of its subframe (rpps.base.control.publish), so a profile's controls carry it to the channels after it: the MIB's port count to every channel, the CFI to the PDCCH and PDSCH of its subframe, a DCI's allocation to the PDSCH of its subframe (3GPP TS 36.211, 36.212, 36.213). Coding is rpps's: the LTE Gold sequence, tail-biting convolutional code with its rate matching, turbo code with its rate matching, CRC-16 and CRC-24A.
PBCH subframe 0: 1, 2 or 4 ports and the frame's quarter of the 40 ms scrambling are tried, the CRC mask says which:
gives the 24 MIB bits; publishes ports, n_rb, phich_ng, phich_duration, sfn
PCFICH every subframe, once `ports` is known: gives the CFI (2 bits); publishes cfi (for its subframe)
PDCCH once ports, cfi and the PHICH's size and duration are known: the common search space (CCEs 0-15, aggregation 4
and 8) for the `rntis`, formats 1A and 1C: gives each DCI's bits; publishes the first's fields (for its
subframe). TDD: the PHICH's size also depends on the uplink-downlink configuration, which SIB1 gives, so
m_i = 1, 0 and 2 are tried until a DCI checks, the one a subframe number last took first
PDSCH where a DCI gave an allocation (riv not None): localized or distributed, one code block; a 1C has no
redundancy version, so the four are tried; gives the transport block when its CRC-24A checks. TDD subframe 1
(special: DwPTS) is not covered (est "special")
Every message names its subframe: subframe, counted from the first the grid gave.
Classes:
| Name | Description |
|---|---|
PBCH |
The MIB of every subframe 0 (see the module) |
PCFICH |
The CFI of every subframe, once the port count is known (see the module) |
PDCCH |
DCIs in the common search space for the RNTIs given (see the module) |
PDSCH |
The transport block a DCI allocated in its subframe (see the module) |
Functions:
| Name | Description |
|---|---|
tail_biting |
K bits (CRC included) from soft bits of the 1/3 tail-biting code, rate matched to len(llr) (positive = 0) |
tail_biting_batch |
|
PBCH ¶
PCFICH ¶
Bases: _Channel
The CFI of every subframe, once the port count is known (see the module)
Methods:
| Name | Description |
|---|---|
read |
The CFI of one grid frame: the code word nearest what the PCFICH holds |
Source code in src/rpps/grid/lte/channels.py
read ¶
The CFI of one grid frame: the code word nearest what the PCFICH holds
Source code in src/rpps/grid/lte/channels.py
PDCCH ¶
Bases: _Channel
DCIs in the common search space for the RNTIs given (see the module)
Methods:
| Name | Description |
|---|---|
cces |
(N_CCE, 72) soft bits of the control region: REGs equalized, the shift and interleaver undone, descrambled |
find |
(format, RNTI, payload bits) of the DCIs of one grid frame; |
search |
(format, RNTI, payload bits) of every DCI for the RNTIs in the common search space of CCEs |
Source code in src/rpps/grid/lte/channels.py
cces ¶
(N_CCE, 72) soft bits of the control region: REGs equalized, the shift and interleaver undone, descrambled (mi: TDD's PHICH multiplier)
Source code in src/rpps/grid/lte/channels.py
find ¶
(format, RNTI, payload bits) of the DCIs of one grid frame; mi (a dict kept from frame to frame: subframe
number -> TDD's m_i) says which PHICH size to try first, and takes the one that checked
Source code in src/rpps/grid/lte/channels.py
search ¶
(format, RNTI, payload bits) of every DCI for the RNTIs in the common search space of CCEs cc
Source code in src/rpps/grid/lte/channels.py
PDSCH ¶
Bases: _Channel
The transport block a DCI allocated in its subframe (see the module)
Source code in src/rpps/grid/lte/channels.py
tail_biting ¶
K bits (CRC included) from soft bits of the 1/3 tail-biting code, rate matched to len(llr) (positive = 0)
Source code in src/rpps/grid/lte/channels.py
tail_biting_batch ¶
tail_biting of each of llrs (soft bits of any lengths): (len(llrs), K) bits, the Viterbi of a length in one batch
Source code in src/rpps/grid/lte/channels.py
grid ¶
The LTE resource grid of each subframe, with every port's channel on every resource element
LteGrid takes what LteCell gives (whole half-frames from a subframe 0, carrier offset off) and gives one frame per
subframe: a stream of complex items, frame_len(n_rb) a subframe, laid out as
HEAD items the subframe's header: cell id, subframe number 0..9, N_RB, subframe count, 1 for TDD
(as real values)
14 x 12 N_RB the grid G[l, k]: symbol l, subcarrier k from the lowest (the DC subcarrier left out)
4 x 14 x 12 N_RB the channel H[p, l, k] of ports 0-3, from the cell-specific reference signals
so the physical channels after it (each a branch of the profile, reading the same frames) take their resource elements
and undo the transmit diversity by unpack. The cell comes from LteCell's estimates in the stream.
Classes:
| Name | Description |
|---|---|
LteGrid |
Subframes of samples to grid frames (see the module). n_rb: resource blocks (default: those that fill the FFT); |
Functions:
| Name | Description |
|---|---|
n_rb_of |
N_RB from the frame length |
unpack |
(header dict, G (14, 12 N_RB), H (4, 14, 12 N_RB)) of one frame: views, no copies |
frames |
The whole frames of a block: (n, frame_len) view |
LteGrid ¶
n_rb_of ¶
unpack ¶
(header dict, G (14, 12 N_RB), H (4, 14, 12 N_RB)) of one frame: views, no copies
Source code in src/rpps/grid/lte/grid.py
phy ¶
LTE downlink physical layer: numerology, reference signals, resource-element maps, transmit diversity (3GPP TS 36.211)
FDD and TDD (frame structures 1 and 2), normal cyclic prefix, 15 kHz subcarriers. A subframe (1 ms) is two slots of seven OFDM symbols; the resource grid of a subframe is (14, 12 N_RB): symbol l = 0..13 (slot l // 7), subcarrier k = 0..12 N_RB - 1 from the lowest, the DC subcarrier left out. Sample rates are 1.92 MS/s per FFT of 128: FFT = Fs / 15 kHz.
Maps give resource elements as two arrays (k, l) in the order the standard fills them, so a channel's symbols are
G[l, k]. Transmit diversity (6.3.4.3) is undone over those: 1 port as is, 2 ports Alamouti over pairs (SFBC), 4 ports
SFBC with frequency-switched pairs (ports 0, 2 then 1, 3).
Functions:
| Name | Description |
|---|---|
cp_lengths |
(first symbol's prefix, the others') in samples at this FFT size |
symbol_starts |
The useful part's first sample of the 14 symbols of a subframe, from the subframe's first sample |
sc_bin |
FFT bin of subcarrier k = 0..12 N_RB - 1 (the DC bin skipped) |
grid |
The (14, 12 N_RB) grid of one subframe's samples. Each FFT window starts |
ramp |
e^(-j 2 pi (start + step k)) for k = 0..n-1 (cycles): a derotation, complex64. Built from two short tables and their |
gold |
c(0..n-1) of 7.2 (the rpps definition sequence/recurrence/lte_gold); lengths are taken in steps, so a channel's |
sign |
Bits to the signs a soft bit is multiplied by to descramble it: 0 -> +1, 1 -> -1 |
crs_values |
r(m) for m = 0..2 N_RB - 1, of cell |
crs_shift |
v of 6.10.1.2, before v_shift = PCI mod 6 |
crs_mask |
(14, 12 N_RB) bool: where the reference signals of ports 0..ports-1 are (no data there) |
channel |
H (4, 14, 12 N_RB): each port's channel on every resource element of subframe sf's grid G. Least squares at the |
undo_diversity |
The symbols sent on resource elements (k, l), in that order, for 1, 2 or 4 transmit ports. Each is scaled by the |
soft_bits |
QPSK (b(2i) on the real part, b(2i+1) on the imaginary, a 0 positive): soft bits, positive = 0 |
qpskness |
-Re(sum z^4) / sum |z|^4: 1 for QPSK on the diagonals, ~0 for noise or the wrong equalizer |
pbch_res |
(k, l) of the 240 PBCH resource elements of subframe 0: slot 1 symbols 0-3, the 72 central subcarriers, around the |
parse_mib |
The 24 MIB bits (36.331 6.2.2): dl-Bandwidth 3, phich-Config 3, the SFN's 8 MSBs, then 10 bits of later releases |
reg_res |
The four resource elements (k, l) of the REG from subcarrier k0 |
short_phich |
TDD subframes 1 and 6: an extended PHICH of two symbols (Table 6.9.3-1) |
phich_regs |
The PHICH's REGs (k0, l), three a group (6.9.3) |
control_regs |
The PDCCH's REGs (k0, l) |
control_symbols |
OFDM symbols of the control region: the CFI, one more at 10 resource blocks or fewer (Table 6.7-1) |
phich_groups |
PHICH groups |
control_res |
(k, l) of the PDCCH REGs' resource elements in order (control_regs, each REG's four) |
subblock_perm |
The 32-column sub-block interleaver's read-out order of n items (36.212 5.1.4.2.1, dummies left out) |
dci_1a_size |
Format 1A's payload bits (5.3.3.1.3) |
parse_1a |
DCI 1A's fields, with an SI-, P- or RA-RNTI |
riv_decode |
(first resource block, count) of a contiguous allocation (36.213 7.1.6.3) |
step_1c |
N_RB^step of format 1C's allocation (36.213 Table 7.1.6.3-1) |
dci_1c_size |
Format 1C's payload bits |
gaps |
(N_gap, N_VRB, interleaving unit) of a gap (Table 6.2.3.2-1) |
dvrb_map |
(2, N_VRB): each distributed block's physical block, per slot |
tbs_table |
{I_TBS: [TBS, ...]} of a table/lte definition |
allocation |
(blocks, TBS) of a DCI, or None |
pdsch_res |
(k, l) of a PDSCH's elements |
cp_lengths ¶
symbol_starts ¶
The useful part's first sample of the 14 symbols of a subframe, from the subframe's first sample
Source code in src/rpps/grid/lte/phy.py
sc_bin ¶
grid ¶
The (14, 12 N_RB) grid of one subframe's samples. Each FFT window starts early samples into the prefix (clear of
the symbol before, and of a timing that runs late), the phase ramp that leaves taken off
Source code in src/rpps/grid/lte/phy.py
ramp ¶
e^(-j 2 pi (start + step k)) for k = 0..n-1 (cycles): a derotation, complex64. Built from two short tables and their outer product (k = 128 a + b), not n exponentials: the phase is reduced to a cycle in float64 first, so it stays exact over a stream of any length
Source code in src/rpps/grid/lte/phy.py
gold ¶
c(0..n-1) of 7.2 (the rpps definition sequence/recurrence/lte_gold); lengths are taken in steps, so a channel's sequence of any length reuses one made before
Source code in src/rpps/grid/lte/phy.py
sign ¶
crs_values
cached
¶
r(m) for m = 0..2 N_RB - 1, of cell pci, slot ns (0..19), symbol l of the slot (normal prefix)
Source code in src/rpps/grid/lte/phy.py
crs_shift ¶
v of 6.10.1.2, before v_shift = PCI mod 6
crs_mask ¶
(14, 12 N_RB) bool: where the reference signals of ports 0..ports-1 are (no data there)
Source code in src/rpps/grid/lte/phy.py
channel ¶
H (4, 14, 12 N_RB): each port's channel on every resource element of subframe sf's grid G. Least squares at the
reference signals, linear in frequency between them (constant past the edges), and a straight line in time through
the port's symbols of the subframe (it barely moves in 1 ms). Ports past ports are zeros. Every port and symbol at
once: a port's reference signals are a comb of step 6, so each subcarrier's two neighbours are found by arithmetic
Source code in src/rpps/grid/lte/phy.py
undo_diversity ¶
The symbols sent on resource elements (k, l), in that order, for 1, 2 or 4 transmit ports. Each is scaled by the channel's power (soft bits keep their reliability)
Source code in src/rpps/grid/lte/phy.py
soft_bits ¶
QPSK (b(2i) on the real part, b(2i+1) on the imaginary, a 0 positive): soft bits, positive = 0
qpskness ¶
-Re(sum z^4) / sum |z|^4: 1 for QPSK on the diagonals, ~0 for noise or the wrong equalizer
pbch_res
cached
¶
(k, l) of the 240 PBCH resource elements of subframe 0: slot 1 symbols 0-3, the 72 central subcarriers, around the reference signals of four ports whatever the cell has
Source code in src/rpps/grid/lte/phy.py
parse_mib ¶
The 24 MIB bits (36.331 6.2.2): dl-Bandwidth 3, phich-Config 3, the SFN's 8 MSBs, then 10 bits of later releases
Source code in src/rpps/grid/lte/phy.py
reg_res ¶
The four resource elements (k, l) of the REG from subcarrier k0
Source code in src/rpps/grid/lte/phy.py
short_phich ¶
phich_regs ¶
The PHICH's REGs (k0, l), three a group (6.9.3)
Symbol 0 (normal duration), symbols 0-2 (extended), 0-1 (extended, short)
Source code in src/rpps/grid/lte/phy.py
control_regs
cached
¶
The PDCCH's REGs (k0, l)
Time first, past the PCFICH and the PHICH (phich_regs)
Source code in src/rpps/grid/lte/phy.py
control_symbols ¶
OFDM symbols of the control region: the CFI, one more at 10 resource blocks or fewer (Table 6.7-1)
phich_groups ¶
PHICH groups
ceil(Ng N_RB / 8), times m_i in TDD (Table 6.9-1: by the uplink-downlink configuration and the subframe)
control_res
cached
¶
(k, l) of the PDCCH REGs' resource elements in order (control_regs, each REG's four)
Source code in src/rpps/grid/lte/phy.py
subblock_perm
cached
¶
The 32-column sub-block interleaver's read-out order of n items (36.212 5.1.4.2.1, dummies left out)
Source code in src/rpps/grid/lte/phy.py
dci_1a_size ¶
Format 1A's payload bits (5.3.3.1.3)
Padded to format 0's and past the ambiguous sizes. TDD has a HARQ bit more and the downlink assignment index (format 0: the UL index or assignment index)
Source code in src/rpps/grid/lte/phy.py
parse_1a ¶
DCI 1A's fields, with an SI-, P- or RA-RNTI
With those the NDI picks the second gap of a distributed allocation (gap, from 50 resource blocks) and the TPC's low
bit the TBS column
Source code in src/rpps/grid/lte/phy.py
riv_decode ¶
(first resource block, count) of a contiguous allocation (36.213 7.1.6.3)
step_1c ¶
dci_1c_size ¶
Format 1C's payload bits
The gap (N_RB >= 50), the allocation in steps of N_RB^step over the first gap's virtual blocks, 5 bits of TBS
gaps ¶
(N_gap, N_VRB, interleaving unit) of a gap (Table 6.2.3.2-1)
Source code in src/rpps/grid/lte/phy.py
dvrb_map
cached
¶
(2, N_VRB): each distributed block's physical block, per slot
Source code in src/rpps/grid/lte/phy.py
tbs_table
cached
¶
{I_TBS: [TBS, ...]} of a table/lte definition
lte/tbs (36.213 Table 7.1.7.2.1-1, the N_PRB columns 1..10 a DCI 1A for system information uses) or lte/tbs_1c (Table 7.1.7.2.3-1)
Source code in src/rpps/grid/lte/phy.py
allocation ¶
(blocks, TBS) of a DCI, or None
d: the fields of parse_1a or parse_1c, with "format". None for an allocation or size the standard does not have
Source code in src/rpps/grid/lte/phy.py
pdsch_res ¶
(k, l) of a PDSCH's elements
On the resource blocks blocks (those of the even slot, of the odd slot): subcarrier first, then symbol, from symbol
symbols (the control region's), around the reference signals, the synchronization signals and the PBCH. FDD: PSS and
SSS in symbols 6 and 5 of subframes 0 and 5; TDD: SSS in symbol 13 of those, PSS in symbol 2 of subframes 1 and 6
Source code in src/rpps/grid/lte/phy.py
tx ¶
An LTE downlink to test the receive side with: cell signals, MIB, CFI, a DCI 1A to the SI-RNTI and its PDSCH
x = rp.grid.lte.tx.downlink(pci=77, ports=2, n_rb=15, frames=8, sib=bits) # 3.84 MS/s, from subframe 0 of SFN 0
Every downlink subframe carries the reference signals of its ports and a PCFICH; the synchronization signals where
the duplex mode puts them; subframe 0 the PBCH (the MIB of its frame's SFN); subframe 5 of every even frame a DCI (1A,
localized or distributed, or 1C) in the common search space and the transport block sib on the PDSCH it allocates
(36.331 5.2.1.2: where SIB1 goes). TDD: the uplink subframes of the uplink-downlink configuration are silent and the
special ones carry only their control region and synchronization signals. Transmit diversity over the ports (6.3.4.3),
each port's resource grid to samples by its own IFFT; channel puts each port through a gain of its own, sums them and
adds a carrier offset, a delay and noise (cells on one carrier: the sum of their channels' outputs). Normal cyclic
prefix (3GPP TS 36.211, 36.212, 36.213).
Functions:
| Name | Description |
|---|---|
diversity |
(ports, len(x)): what each port sends on the resource elements of a channel, in order (6.3.4.3) |
riv |
The resource indication value of a contiguous allocation (36.213 7.1.6.3) |
dci_1a |
DCI 1A's payload bits |
dci_1c |
DCI 1C's payload bits |
subframe |
(ports, 14, 12 N_RB): what each port sends in a subframe |
modulate |
(ports, samples): each port's grid (ports, 14 n, 12 N_RB) to samples, a subframe per 14 symbols |
downlink |
(ports, samples) of a downlink at the rate of n_rb's FFT |
channel |
The ports' samples (ports, n) through a flat gain each, summed; then a carrier offset [Hz at fs], |
diversity ¶
(ports, len(x)): what each port sends on the resource elements of a channel, in order (6.3.4.3)
Source code in src/rpps/grid/lte/tx.py
riv ¶
The resource indication value of a contiguous allocation (36.213 7.1.6.3)
dci_1a ¶
DCI 1A's payload bits
For an allocation (first, count: virtual blocks), padded to its size (36.212 5.3.3.1.3)
Source code in src/rpps/grid/lte/tx.py
dci_1c ¶
DCI 1C's payload bits
first and count (virtual blocks) multiples of N_RB^step, mcs the TBS's row
Source code in src/rpps/grid/lte/tx.py
subframe ¶
subframe(pci, sf, sfn, n_rb, ports, cfi=1, phich_ng=1.0, dci=None, sib=None, rv=0, rnti=phy.SI_RNTI, cce=0, L=4, fmt='1A', duplex='fdd', uldl=1, extended=False)
(ports, 14, 12 N_RB): what each port sends in a subframe
fmt: the DCI's format; uldl: TDD's uplink-downlink configuration; extended: the PHICH's duration
Source code in src/rpps/grid/lte/tx.py
modulate ¶
(ports, samples): each port's grid (ports, 14 n, 12 N_RB) to samples, a subframe per 14 symbols
Source code in src/rpps/grid/lte/tx.py
downlink ¶
downlink(pci=77, ports=2, n_rb=15, frames=4, sib=None, mcs=None, first=None, count=None, cfi=None, phich_ng=1.0, sfn0=0, L=4, fmt='1A', distributed=False, gap=0, rv=0, duplex='fdd', uldl=1, extended=False)
(ports, samples) of a downlink at the rate of n_rb's FFT
From subframe 0 of frame sfn0, frames radio frames (6 RB: 1.92 MS/s, 15: 3.84, 25: 7.68, 50: 15.36). sib: the
transport block in subframe 5 of every even frame: its length a TBS of the 1A table at N_PRB^1A 2, or of the 1C table
with fmt "1C" (the mcs is found for it), on count virtual blocks from first (distributed 1A and 1C: distributed
ones, over gap gap), redundancy version rv (a 1C does not say it); its DCI at aggregation L. cfi: default the smallest
whose control region holds L CCEs. duplex, uldl, extended: see subframe
Source code in src/rpps/grid/lte/tx.py
channel ¶
The ports' samples (ports, n) through a flat gain each, summed; then a carrier offset [Hz at fs], delay samples of
noise before, and noise at snr_db (per sample, of the summed signal)
Source code in src/rpps/grid/lte/tx.py
rpps.grid.nr ¶
5G NR downlink (FR1, 15 and 30 kHz), with LEO non-terrestrial Doppler: SS/PBCH block, MIB, CORESET 0, DCI 1_0, SIB1
Modules:
| Name | Description |
|---|---|
cell |
5G NR cell search and slot timing through LEO Doppler (38.211 7.4.2-7.4.3, 38.213 4.1): samples to whole slots |
channels |
NR downlink channels read off NrGrid's frames: PBCH (MIB), PDCCH (DCI 1_0 in CORESET 0), PDSCH (SIB1) |
grid |
The NR resource grid of each subframe: NrCell's slots to a stream of frames, one a millisecond |
phy |
5G NR downlink physical layer at 15 and 30 kHz subcarriers (FR1): SS/PBCH block, PBCH payload, CORESET 0, PDCCH, PDSCH |
tx |
A 5G NR downlink to test the receive side with, and a LEO satellite pass to put it through |
cell ¶
5G NR cell search and slot timing through LEO Doppler (38.211 7.4.2-7.4.3, 38.213 4.1): samples to whole slots
The SS/PBCH block is at 15 or 30 kHz (scs), the sample rate scs x nfft; pattern says where a half frame's candidate
blocks start (38.213 4.1: A at 15 kHz; B or C at 30, by the band: C unless told).
Acquiring (the first acquire seconds): the PSS at 256 x scs samples a second over carrier offsets offset +- span
(a LEO pass at S-band moves the carrier by up to some 50 kHz), folded on the SS/PBCH block period (period, 20 ms). Then
each block at the full rate: the residual offset from the PSS-to-SSS phase, less the cell's bias in it (NR gives each
symbol's carrier a phase of its own, 38.211 5.4: a constant for a cell, found against the four symbols' cyclic
prefixes), the SSS's N_ID1, and from the PBCH (DM-RS, then its CRC) the block's index and half frame, which place the
slots and the frame, and the spacing of the channels it points to (the MIB's). Over the blocks of the acquisition, the
sample clock (the delay's rate: a satellite's range stretches the signal by tens of ppm) and the offset's rate.
Tracking: every block, its PSS's timing error and its offset (the bias kept up to date) drive two loops of the second order: time (the next slot's start and the clock's rate) and frequency (the offset and its rate: a pass changes it by hundreds of Hz a second). Between blocks the offset follows its rate, the derotation's phase continuous. With no Doppler the rates stay near zero: the same receiver serves a terrestrial cell.
Out come the samples of whole slots (at the block's spacing) from the start of the frame holding the first block
acquired, derotated, each slot started at the nearest sample to where the clock puts it (a sample dropped or repeated
between slots), so the output's frames start every 10 ms of it and every second frame holds the block (20 ms). Lost for
lose periods, the cell is acquired again, zeros standing in for the slots missed. est["cell"]: the cell, block, half
frame, the spacings, offset and its rate, the clock's rate [ppm].
Classes:
| Name | Description |
|---|---|
NrCell |
NR cell search and slot timing, LEO Doppler tracked (see the module) |
NrCell ¶
NrCell(offset=0.0, span=60000.0, resolution=0.0, period=0.02, acquire=0.065, lose=8, gate=0.25, fc=0.0, scs=15000.0, pattern='auto', name='cell')
Bases: Stage
NR cell search and slot timing, LEO Doppler tracked (see the module)
offset, span, resolution: carrier offsets searched [Hz] (resolution 0: 4 kHz at 15 kHz spacing, 8 at 30); period: SS/PBCH block period [s]; acquire: seconds looked at; lose: periods without the block before acquiring again; gate: the PSS's normalized correlation for a block; fc: the block centre's absolute frequency (on the raster), when known: the PSS-to-SSS bias is then one of two, none or what the upconversion phase gives at fc (est "phase"), whichever the cyclic prefixes' average is nearer; scs: the block's subcarrier spacing; pattern: "A", "B", "C" or "auto" (A at 15 kHz, C at 30)
Source code in src/rpps/grid/nr/cell.py
channels ¶
NR downlink channels read off NrGrid's frames: PBCH (MIB), PDCCH (DCI 1_0 in CORESET 0), PDSCH (SIB1)
The PBCH is at the SS/PBCH block's spacing, the PDCCH and PDSCH at the one its MIB names (15 or 30 kHz each). Each estimates its channel from its own DM-RS (least squares, linear between them in frequency, and in time for the PDSCH) and publishes what it decoded from the first item of its slot (rpps.base.control.publish), as rpps.grid.lte's do:
PBCH subframes NrGrid marks as holding the block: the MIB and the payload's timing (SFN, half frame, k_SSB's MSB);
publishes sfn (and the output frame it was read in, frame_ref), coreset0, ss0, k_ssb, dmrs_pos, barred
PDCCH once the MIB is known, and unless its k_SSB says the block has no SIB1 (above 23: est "no_sib1"): the Type0 occasions (38.213 13: slots n0 and the one after, of frames of the right
parity) of CORESET 0 (`min_bw`: the band's minimum channel bandwidth, which picks its table), every candidate of aggregation 4, 8 and 16 (polar, block/polar/nr_dci), for the `rntis`; publishes
a DCI 1_0's fields (for its subframe, with its slot)
PDSCH where a DCI allocated it (contiguous virtual blocks, interleaved onto the CORESET's or not): the TBS (38.214 5.1.3.2), LDPC (block/ldpc/nr_bg*), the transport block's CRC;
gives the block when the CRC checks
The phase NR's upconversion gives each symbol (38.211 5.4: e^(j 2 pi f0 (t - t_start,l - N_CP,l Tc)), the carrier's phase
restarted every symbol) reaches a receiver that mixes down continuously as e^(-j 2 pi fc t_l) on symbol l: t_l its useful
part's start in the subframe, fc the absolute frequency at 0 Hz, here the SS/PBCH block's centre on the synchronization
raster. The PBCH and PDCCH, a DM-RS in every symbol, do not notice; the PDSCH, its DM-RS in some, does. Not every cell
shows it (on air, one cell of two did: one sharing its carrier with LTE did not), so the PDSCH, given fc, tries the block
with the phase taken off and without, the one that worked last first: the CRC says which.
Classes:
| Name | Description |
|---|---|
PBCH |
The MIB of every SS/PBCH block NrGrid marks (see the module) |
PDCCH |
DCI 1_0 in CORESET 0's Type0 occasions (see the module) |
PDSCH |
The transport block a DCI 1_0 allocated (see the module) |
PBCH ¶
PDCCH ¶
Bases: _NrChannel
DCI 1_0 in CORESET 0's Type0 occasions (see the module)
Methods:
| Name | Description |
|---|---|
search |
(aggregation, CCE, payload bits, RNTI) of every DCI for the RNTIs in one slot's grid |
Source code in src/rpps/grid/nr/channels.py
search ¶
(aggregation, CCE, payload bits, RNTI) of every DCI for the RNTIs in one slot's grid
Source code in src/rpps/grid/nr/channels.py
PDSCH ¶
Bases: _NrChannel
The transport block a DCI 1_0 allocated (see the module)
Source code in src/rpps/grid/nr/channels.py
grid ¶
The NR resource grid of each subframe: NrCell's slots to a stream of frames, one a millisecond
HEAD items cell id, subframe of the frame 0-9, SIZE (samples of a subframe / 15: nfft x 2^mu), subframe count,
the first slot symbol (counted through the subframe) of the SS/PBCH block NrCell tracks if the
subframe holds it (else -1) and the symbol past its last, its index, its half frame, mu of the
channels' grid, mu of the block's
4 x 240 the block's own grid B[l, k] (its spacing: NR's may differ from the channels'), where held
14 2^mu x nfft the grid G[slot, l, bin] of each of the subframe's slots at the channels' spacing (the MIB's):
every FFT bin, lowest frequency first, the block's centre at nfft/2
NR has no reference signal over the whole band: each channel after it (a branch of the profile) estimates its channel from
its own DM-RS. A frame's length depends on the sample rate alone, 16 + 960 + 14 x Fs / 15 kHz. unpack(frame) gives the
header and the grids.
Classes:
| Name | Description |
|---|---|
NrGrid |
Slots of samples to grid frames (see the module); cell: the name of NrCell's estimates |
Functions:
| Name | Description |
|---|---|
unpack |
(header dict, G (slots, 14, nfft), B (4, 240)) of one frame: views, no copies |
NrGrid ¶
unpack ¶
(header dict, G (slots, 14, nfft), B (4, 240)) of one frame: views, no copies
Source code in src/rpps/grid/nr/grid.py
phy ¶
5G NR downlink physical layer at 15 and 30 kHz subcarriers (FR1): SS/PBCH block, PBCH payload, CORESET 0, PDCCH, PDSCH
3GPP TS 38.211 (signals, mapping), 38.212 (7.1 BCH, 7.3 DCI), 38.213 (4.1: block positions; 13: CORESET 0 and Type0 search space), 38.214 (5.1 PDSCH). The numerology mu is 0 (15 kHz) or 1 (30 kHz): a slot is 14 symbols in 1 ms >> mu, and at a sample rate of scs x nfft it is 15 nfft samples; the first symbol of every half millisecond has the longer prefix. The SS/PBCH block and the channels it points to may differ in mu.
The grid of a slot is (14, nfft): every FFT bin, lowest frequency first, with the SS/PBCH block's subcarrier 120 at 0 Hz (NrCell puts it there). So subcarrier k of the block is bin nfft/2 - 120 + k of a grid at its spacing, and every other channel is placed from it: CORESET 0 from the block's first subcarrier, k_SSB and the table's offset.
Functions:
| Name | Description |
|---|---|
mu_of |
The numerology of a subcarrier spacing [Hz] |
cp_lengths |
(the long prefix, the others') in samples |
slot_len |
Samples of a slot, at either spacing |
symbol_starts |
The useful part's first sample of a slot's 14 symbols |
grid |
The (14, nfft) grid of a slot's samples, lowest frequency first |
symbol_phase |
Undoes the upconversion phase |
modulate |
Samples of slots from their grids (n*14, nfft), as |
pbch_dmrs |
The 144 PBCH DM-RS symbols of block i_SSB-bar (i_SSB + 4 n_hf below 3 GHz) |
ssb_map |
(k, l) of the block's PBCH (432) and of its DM-RS (144), in mapping order, k 0-239 and l 0-3 within the block |
ssb_bins |
Bin of each of the block's 240 subcarriers |
ssb_place |
(slot in the half frame, first symbol in it) of candidate block i_SSB |
equalize |
(Y conj(H), |H|^2) of the data REs of a grid from the DM-RS |
read_pbch |
The PBCH of a block's grid (4, 240), or None where the CRC fails |
payload_scramble |
The 32 bits XORed onto the interleaved payload (7.1.2): c(j + v M), M = 29, v the SFN's 3rd and 2nd LSBs |
payload_encode |
The 32 PBCH payload bits (before CRC): the 24 MIB bits (SFN's MSBs in them), the timing bits, interleaved, scrambled |
payload_decode |
(MIB bits 24, sfn, hrf, k_SSB's MSB) from the 32 payload bits after the CRC |
parse_mib |
The MIB's fields (38.331 6.2.2) by name (SFN's MSBs left to payload_decode) |
pbch_scramble |
PBCH scrambling (38.211 7.3.3.1) |
coreset0 |
CORESET 0 (38.213 13) |
coreset0_first_bin |
CORESET 0's first bin, or None |
type0_slots |
(slots n0, n0 + 1), frame parity, first symbol of Type0 occasions |
cce_regs |
For each CCE, the (symbol, RB) of its 6 REGs (interleaved mapping, bundles of L = 6, R = 2, shift = cell id) |
pdcch_dmrs |
The PDCCH DM-RS of a symbol: n values (3 a RB) |
parse_dci_10_si |
DCI format 1_0 with the SI-RNTI (38.212 7.3.1.2.1) |
vrb_interleaver |
VRB-to-PRB (38.211 7.3.1.6) |
dmrs_symbols |
PDSCH DM-RS symbols of the slot: single symbol, dmrs-AdditionalPosition pos2 (Table 7.4.1.1.2-3) |
tbs |
Transport block size (38.214 5.1.3.2) from the REs a PRB carries in the slot |
pdsch_res |
PDSCH data and DM-RS elements |
pdcch_res |
(bins, symbols) of a candidate's data REs in mapping order, and of its DM-RS (bins, symbols, sequence index) |
ldpc_for |
The code block's LDPC code for a transport block of TBS bits (one code block: K' = TBS + its CRC) |
qam |
Symbols of bits, Qm 2, 4, 6 (Gray, 38.211 5.1.3-5.1.5) |
soft_bits |
Max-log soft bits (positive = 0) of equalized symbols z (unit channel), Qm 2, 4, 6 |
mu_of ¶
cp_lengths ¶
slot_len ¶
symbol_starts
cached
¶
The useful part's first sample of a slot's 14 symbols
Source code in src/rpps/grid/nr/phy.py
grid ¶
The (14, nfft) grid of a slot's samples, lowest frequency first
The window starts early samples into the prefix, its phase ramp taken off
Source code in src/rpps/grid/nr/phy.py
symbol_phase ¶
Undoes the upconversion phase
e^(j 2 pi fc t_l) (38.211 5.4) for a receiver whose 0 Hz is at fc (t_l: the useful part's start in the subframe; slot: the slot's number, which in the subframe is slot mod 2^mu)
Source code in src/rpps/grid/nr/phy.py
modulate ¶
Samples of slots from their grids (n*14, nfft), as grid reads them
Source code in src/rpps/grid/nr/phy.py
pbch_dmrs ¶
The 144 PBCH DM-RS symbols of block i_SSB-bar (i_SSB + 4 n_hf below 3 GHz)
Source code in src/rpps/grid/nr/phy.py
ssb_map
cached
¶
(k, l) of the block's PBCH (432) and of its DM-RS (144), in mapping order, k 0-239 and l 0-3 within the block
Source code in src/rpps/grid/nr/phy.py
ssb_bins ¶
ssb_place ¶
(slot in the half frame, first symbol in it) of candidate block i_SSB
equalize ¶
(Y conj(H), |H|^2) of the data REs of a grid from the DM-RS
data: (bins, symbols); dmrs: (bins, symbols), their values ref. Least squares at each, linear in frequency within a
symbol, and linear in time between DM-RS symbols (constant past them)
Source code in src/rpps/grid/nr/phy.py
read_pbch ¶
The PBCH of a block's grid (4, 240), or None where the CRC fails
A dict (mib: its 24 bits, sfn, hrf, k_ssb_msb, i_ssb). The DM-RS says i_SSB-bar; the scrambling takes two bits of the block's index where a half frame has 4 candidates (i_SSB-bar then carries the half frame in its third) and three where it has more: both are tried, the CRC says which
Source code in src/rpps/grid/nr/phy.py
payload_scramble ¶
The 32 bits XORed onto the interleaved payload (7.1.2): c(j + v M), M = 29, v the SFN's 3rd and 2nd LSBs
Source code in src/rpps/grid/nr/phy.py
payload_encode ¶
The 32 PBCH payload bits (before CRC): the 24 MIB bits (SFN's MSBs in them), the timing bits, interleaved, scrambled
Source code in src/rpps/grid/nr/phy.py
payload_decode ¶
(MIB bits 24, sfn, hrf, k_SSB's MSB) from the 32 payload bits after the CRC
Source code in src/rpps/grid/nr/phy.py
parse_mib ¶
The MIB's fields (38.331 6.2.2) by name (SFN's MSBs left to payload_decode)
Source code in src/rpps/grid/nr/phy.py
pbch_scramble ¶
PBCH scrambling (38.211 7.3.3.1)
c(i + v 864), v the block index's two LSBs where a half frame has 4 candidates, three where it has more
coreset0
cached
¶
CORESET 0 (38.213 13)
For the SS/PBCH block's spacing, the CORESET's, and the band's minimum channel bandwidth [MHz] (5 or 10; 40: the tables of its own where the block is at 30 kHz)
Source code in src/rpps/grid/nr/phy.py
coreset0_first_bin ¶
CORESET 0's first bin, or None
The common resource block holding the SS/PBCH block's subcarrier 0 starts k_SSB subcarriers of 15 kHz before it, the
CORESET offset of its own blocks below that
Source code in src/rpps/grid/nr/phy.py
type0_slots ¶
(slots n0, n0 + 1), frame parity, first symbol of Type0 occasions
For block i_SSB, at the PDCCH's mu; n0 + 1 past the frame's last slot is the next frame's first
Source code in src/rpps/grid/nr/phy.py
cce_regs
cached
¶
For each CCE, the (symbol, RB) of its 6 REGs (interleaved mapping, bundles of L = 6, R = 2, shift = cell id)
Source code in src/rpps/grid/nr/phy.py
pdcch_dmrs ¶
The PDCCH DM-RS of a symbol: n values (3 a RB)
parse_dci_10_si ¶
DCI format 1_0 with the SI-RNTI (38.212 7.3.1.2.1)
Source code in src/rpps/grid/nr/phy.py
vrb_interleaver
cached
¶
VRB-to-PRB (38.211 7.3.1.6)
The SI-RNTI's in CORESET 0: bundles of bundle blocks, written into two rows
Source code in src/rpps/grid/nr/phy.py
dmrs_symbols ¶
PDSCH DM-RS symbols of the slot: single symbol, dmrs-AdditionalPosition pos2 (Table 7.4.1.1.2-3)
Source code in src/rpps/grid/nr/phy.py
tbs ¶
Transport block size (38.214 5.1.3.2) from the REs a PRB carries in the slot
Source code in src/rpps/grid/nr/phy.py
pdsch_res ¶
PDSCH data and DM-RS elements
(bins, symbols) and (bins, symbols, sequence index), on the resource blocks prbs (from CORESET 0's lowest, in the
virtual blocks' order), symbols s..s+l-1: around the DM-RS symbols, and the REs of the SS/PBCH blocks in the slot
(blocks: of each, (first symbol, the symbol past its last, first bin, the bin past its last))
Source code in src/rpps/grid/nr/phy.py
pdcch_res
cached
¶
(bins, symbols) of a candidate's data REs in mapping order, and of its DM-RS (bins, symbols, sequence index)
Source code in src/rpps/grid/nr/phy.py
ldpc_for
cached
¶
The code block's LDPC code for a transport block of TBS bits (one code block: K' = TBS + its CRC)
Source code in src/rpps/grid/nr/phy.py
qam ¶
Symbols of bits, Qm 2, 4, 6 (Gray, 38.211 5.1.3-5.1.5)
Source code in src/rpps/grid/nr/phy.py
soft_bits ¶
Max-log soft bits (positive = 0) of equalized symbols z (unit channel), Qm 2, 4, 6
Source code in src/rpps/grid/nr/phy.py
tx ¶
A 5G NR downlink to test the receive side with, and a LEO satellite pass to put it through
y = rp.grid.nr.tx.downlink(pci=17, nfft=512, frames=8, sib=bits) # 7.68 MS/s, from slot 0 of SFN 0
y = rp.grid.nr.tx.downlink(scs=30e3, nfft=512, sib=bits) # 30 kHz, 15.36 MS/s
x = rp.grid.nr.tx.leo(y, fs=7.68e6, fc=2.185e9, t0=-2.0) # 2 s before closest approach
SS/PBCH blocks every 20 ms (even frames, half frame hrf), blocks ssb of the pattern's candidates; the MIB of each
frame; in slot n0 of each block's Type0-PDCCH occasion a DCI 1_0 to the SI-RNTI in CORESET 0 (aggregation L), and the
transport block sib on the PDSCH it allocates, in the occasion of every block sent (mapping from the default table A,
rate matched around the SS/PBCH block). The block at scs, the control and shared channels at scs_common, one antenna
port. leo moves the receiver under a satellite in a circular orbit: the delay follows the slant range (the samples
stretched and squeezed by it) and the carrier the Doppler, -fc dr/dt / c, tens of kHz at S-band, changing by hundreds of
Hz a second at closest approach (3GPP TR 38.811 6.9 gives the same orders).
Functions:
| Name | Description |
|---|---|
sib_size |
The TBS of an allocation (what a DCI with these fields carries) |
downlink |
Samples of a downlink, scs x nfft a second |
orbit |
Slant range [m] to a satellite in a circular orbit passing overhead, t seconds from closest approach |
doppler |
The carrier's Doppler shift [Hz] at t (from closest approach) |
leo |
y's samples received from a LEO pass starting t0 s from closest approach: delayed by the slant range (less its value |
sib_size ¶
The TBS of an allocation (what a DCI with these fields carries)
Source code in src/rpps/grid/nr/tx.py
downlink ¶
downlink(pci=17, nfft=512, frames=4, sib=None, ssb=(0,), coreset0=0, ss0=0, k_ssb=0, dmrs_pos=2, mcs=2, first=0, count=None, tdra=0, L=4, cce=0, sfn0=0, fc=0.0, scs=15000.0, scs_common=None, pattern=None, lmax=None, hrf=0, vrb=0, min_bw=5)
Samples of a downlink, scs x nfft a second
From slot 0 of frame sfn0, frames radio frames. sib: the transport block (its length: the TBS the allocation carries,
sib_size). fc: the SS/PBCH block centre's absolute frequency, for the phase NR's upconversion gives each symbol (38.211
5.4; 0: none). scs, scs_common (default: scs): the block's subcarrier spacing and the other channels'; pattern: "A", "B"
or "C" (default A at 15 kHz, C at 30); lmax: candidate blocks in a half frame, 4 or 8 (default 4 at 15 kHz, 8 at 30);
hrf: the half frame the blocks are in; vrb: interleaved virtual blocks
Source code in src/rpps/grid/nr/tx.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
orbit ¶
Slant range [m] to a satellite in a circular orbit passing overhead, t seconds from closest approach
Source code in src/rpps/grid/nr/tx.py
doppler ¶
The carrier's Doppler shift [Hz] at t (from closest approach)
leo ¶
y's samples received from a LEO pass starting t0 s from closest approach: delayed by the slant range (less its value
at the start) and shifted by the carrier's phase over it; delay samples of nothing before