comnum.Dvbs#
- class comnum.Dvbs(rate='1/2')#
A DVB-S transmitter and frame-aligned receiver (ETSI EN 300 421 V1.1.2) of one inner code rate.
The transmitter takes a burst of whole MPEG-2 transport packets (188 bytes, each starting with the sync byte
0x47; seedvb_packets()): the energy dispersal (the PRBS 1 + X^14 + X^15 reset every 8 packets, the first sync byte of a group inverted to0xB8), the outer code RS(204, 188), the convolutional interleaver I = 12, M = 17 (flushed with 11 packets of zeros, so that the whole burst decodes), the inner code of constraint length 7 (X from 171, Y from 133, octal) punctured by Table 2 of the standard, and the Gray QPSK of its Figure 5 with unit energy, at one sample per symbol. The receiver computes the exact LLRs, decodes the inner code by soft Viterbi, deinterleaves, decodes RS(204, 188) and removes the energy dispersal; it assumes the burst found and the carrier recovered.- Parameters:
rate (str) – the inner code rate,
"1/2","2/3","3/4","5/6"or"7/8".- Raises:
ValueError – for another rate.
Examples
>>> import comnum, numpy as np >>> link = comnum.Dvbs("3/4") >>> packets = comnum.dvb_packets(8, comnum.Rng(1)) >>> x = link.modulate(packets) >>> len(x) == link.symbols_len(8) True >>> bool(np.array_equal(link.decode(x, 0.01)[0], packets)) True >>> round(link.useful_bit_rate(25.776e6) / 1e6, 2) # Table D.1: 35.631 Mbit/s 35.63
- decode(rx, noise_var)#
The packets of the received symbols of a burst.
- Parameters:
rx (array_like) – the received symbols of a burst, aligned on its first symbol.
noise_var (float) – complex noise variance per symbol.
- Returns:
the packets (uint8), the bytes corrected by RS(204, 188) and the packets it could not correct.
- Return type:
tuple[numpy.ndarray, int, int]
- Raises:
ValueError – if
rxis not the length of a burst.
- esn0_db(ebn0_db)#
The Es/N0 (dB) of an Eb/N0 per useful bit, the abscissa of Table 3.
- inner(data)#
The QPSK symbols of the bytes of
outer()(punctured inner code, Figure 5).- Parameters:
data (array_like) – the bytes of
outer()(uint8).- Returns:
the unit-energy symbols (complex128).
- Return type:
- Raises:
ValueError – for a value outside 0 to 255.
- inner_decode(rx, noise_var)#
The bytes decided by the soft Viterbi decoder, the estimate of
outer().- Parameters:
rx (array_like) – the received symbols of a burst.
noise_var (float) – complex noise variance per symbol.
- Returns:
the bytes (uint8).
- Return type:
- Raises:
ValueError – if
rxis not the length of a burst.
- modulate(packets)#
The symbols of a burst of whole transport packets (
inner()ofouter()).- Parameters:
packets (array_like) – whole transport packets (uint8, 188 bytes each).
- Returns:
symbols_len(n)unit-energy symbols (complex128).- Return type:
- Raises:
ValueError – for a packet that does not start with 0x47 or a partial packet.
- outer(packets)#
The bytes entering the inner code: energy dispersal, RS(204, 188), interleaver.
- Parameters:
packets (array_like) – whole transport packets (uint8, 188 bytes each).
- Returns:
the bytes (uint8), the flush of the interleaver included.
- Return type:
- Raises:
ValueError – for a packet that does not start with 0x47 or a partial packet.
- symbols_len(n_packets)#
The number of QPSK symbols of a burst of
n_packetspackets.- Parameters:
n_packets (int) – packets of the burst.
- Returns:
the symbols of
modulate().- Return type:
- useful_bit_rate(symbol_rate)#
The useful bit rate at a symbol rate,
2 Rs r 188/204(Annexes C and D).
- constellation#
The Gray QPSK of Figure 5 (label
2 b_I + b_Q, unit energy).- Type: