comnum.Dvbs2#

class comnum.Dvbs2(modulation, rate, *, frame='normal', pilots=True, scrambling_code=0)#

A DVB-S2 transmitter and receiver (ETSI EN 302 307-1) of one MODCOD, constant coding and modulation.

The transmitter takes a BBFRAME of k bits (see dvbs2_bbframe()), encodes it (BCH, then the LDPC code of the standard), interleaves the bits (8PSK, 16APSK, 32APSK), maps them on the constellation of the MODCOD and builds the PLFRAME: the PLHEADER in π/2-BPSK, the slots of 90 symbols, pilot blocks of 36 symbols every 16 slots, and the Gold scrambling sequence number scrambling_code. Every symbol has unit energy, so that a noise of variance 1/(Es/N0) gives the abscissa of the performance table of the standard (threshold_db). The receiver assumes the frame found and the carrier recovered.

Parameters:
  • modulation (str) – "QPSK", "8PSK", "16APSK" or "32APSK".

  • rate (str) – "1/4" … "9/10" (the 28 MODCODs of Table 12).

  • frame (str) – "normal" or "64800" (64 800 bits), "short" or "16200" (16 200 bits).

  • pilots (bool) – pilot blocks.

  • scrambling_code (int) – the number n of the Gold sequence.

Raises:

ValueError – for an invalid parameter (the message names it).

Examples

>>> import comnum, numpy as np
>>> link = comnum.Dvbs2("8PSK", "3/5", frame="short")
>>> link.k, link.plframe_len
(9552, 5598)
>>> bb = comnum.dvbs2_bbframe(np.zeros(link.k - 80, dtype=np.uint8), link.k)
>>> x = link.modulate(bb)
>>> comnum.dvbs2_decode_plheader(x[:90])
(12, True, True)
>>> bool(np.array_equal(link.decode(x, 1e-3), bb))
True
decode(rx, noise_var)#

The BBFRAME of a received PLFRAME (LDPC, then BCH decoding).

Parameters:
  • rx (array_like) – the received PLFRAME (plframe_len symbols).

  • noise_var (float) – complex noise variance per symbol.

Returns:

the k bits of the BBFRAME (uint8).

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

llr(rx, noise_var, *, max_log=False)#

The deinterleaved bit LLRs of the FECFRAME of a received PLFRAME.

Parameters:
  • rx (array_like) – the received PLFRAME (plframe_len symbols).

  • noise_var (float) – complex noise variance per symbol.

  • max_log (bool) – max-log LLRs instead of the exact ones.

Returns:

one LLR per bit of the FECFRAME (positive for a 0).

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

modulate(bbframe)#

The PLFRAME of a BBFRAME.

Parameters:

bbframe (array_like) – k bits (see dvbs2_bbframe()).

Returns:

the plframe_len unit-energy symbols (complex128).

Return type:

numpy.ndarray

Raises:

ValueError – for an invalid parameter or input (the message names it).

constellation#

The constellation of the MODCOD (points[l] carries the label l).

Type:

Constellation

k#

Bits of a BBFRAME (K_bch, Tables 5a and 5b).

Type:

int

max_iterations#

The cap of the LDPC iterations (sum-product, layered, stopping on a codeword; read and write).

Type:

int

modcod#

The MODCOD field of the PLHEADER (1 to 28, Table 12).

Type:

int

plframe_len#

Symbols of a PLFRAME.

Type:

int

threshold_db#

The ideal Es/N0 (dB) at a PER of 1e-7 of the normal frame (Table 13).

Type:

float