Modulation

This module implements the Modulation/Demodulation functionality based on 3GPP TR 38.211. The Modem class is implemented to handle modulation and demodulation of bitstreams to complex symbols and vice versa.

class neoradium.modulation.Modem(modulation='QPSK')

This class handles the process of modulating a bitstream to an array of complex symbol values (Modulation) as well as extracting Log-Likelihood ratios (LLRs) from a list of complex symbols (Demodulation). This implementation is based on 3GPP TR 38.211 section 7.3.1.2

Parameters:

modulation (str (default: 'QPSK')) –

The modulation scheme based on table 7.3.1.2-1 in 3GPP TR 38.211. Here is a list of supported Modulation Schemes:

Modulation Scheme

Modulation Order (qm)

BPSK

1

QPSK

2

16QAM

4

64QAM

6

256QAM

8

1024QAM

10

Other Properties:

In addition to the modulation parameter, here is a list of additional properties for this class.

qm:

The modulation order. This is the number of bits per modulated symbol. See 3GPP TR 38.211, Table 7.3.1.2-1 for more details.

constellation:

The constellation matrix of modulation. This is a lookup table that converts every qm bits of the input bitstream to a complex symbol.

print(indent=0, title=None, getStr=False)

Prints the properties of this Modem object.

Parameters:
  • indent (int (default: 0)) – The number of indentation characters.

  • title (str or None (default: None)) – If specified, it is used as a title for the printed information.

  • getStr (Boolean (default: False)) – If True, it returns the information in a text string instead of printing the information.

Returns:

If the getStr parameter is True, then this function returns the information in a text string. Otherwise, nothing is returned.

Return type:

None or str

modulate(bitstreams)

Modulates the given bitstream to an array(s) of complex symbols using current modulation scheme.

Parameters:

bitstreams (numpy array of bits) – A 1-D (one code block) or 2-D (several code blocks) array of bits.

Returns:

Returns a 1-D or 2-D (depending on shape of bitstreams) numpy complex array of modulated symbols.

Return type:

Numpy array of complex values

getLLRsFromSymbols(symbols, noiseVar, useMax=True)

This function calculates the Log Likelihood Ratios (LLRs) for each bit from the received noisy symbols. The LLR values can then be used by PolarDecoder or LdpcDecoder to extract the decoded bitstream.

Parameters:
  • symbols (1-D or 2-D Complex numpy array) – A m``x``n complex numpy array where m is the number of coded blocks and n is the length of code blocks. If it is a 1-D array, it means there is only one code block to demodulate.

  • noiseVar (float) – The noise variance obtained using noise estimation or using the actual noise variance value used in simulation.

  • useMax (Boolean (default: True)) – If True, this implementation uses the Max function in the calculation of the LLR values. This is faster but uses an approximation and is slightly less accurate than the actual Log Likelihood method which uses logarithm and exponential functions. If False, the slower more accurate method is used.

Returns:

A 1-D or 2-D numpy array of LLR values depending on dimensionality of symbols. In case of 2-D array, the return value is a m``x``l array of LLR values where l= n * qm. In case of 1-D array, the output will be a 1-D array of l LLR values.

Return type:

Numpy array of floating point

demodulate(symbols, noiseVar, useMax=True)

Demodulates the received noisy symbols to bitstream using “Hard Decision” to convert Log Likelihood Ratios (LLRs) to bits. This function first calls the BandwidthPart.getLLRsFromSymbols() method to get the LLR values and then uses “Hard Decision” to convert LLRs to bits.

Parameters:
  • symbols (2-D Complex numpy array) – A m``x``n complex numpy array where m is the number of coded blocks and n is the length of code blocks.

  • noiseVar (float) – The noise variance obtained using noise estimation or using the actual noise variance value used in simulation.

  • useMax (Boolean (default: True)) – If True, this implementation uses the Max function in the calculation of the LLR values. This is faster but uses an approximation and is slightly less accurate than the actual Log Likelihood method which uses logarithm and exponential functions. If False, the slower more accurate method is used.

Returns:

Returns a 2-D array of demodulated bits.

Return type:

Numpy array of bits values