Orthogonal Frequency Division Multiplexing

class ElementType(value)

Bases: enum.Enum

Type of resource element.

REFERENCE = 0
DATA = 1
NULL = 2
class ChannelEstimation(value)

Bases: enum.Enum

Applied channel estimation algorithm after reception.

IDEAL = 0
IDEAL_PREAMBLE = 1
IDEAL_MIDAMBLE = 2
IDEAL_POSTAMBLE = 3
REFERENCE = 4
class FrameElement(type, repetitions=1)

Bases: object

type: hermespy.modem.waveform_generator_ofdm.ElementType
repetitions: int = 1
class FrameResource(repetitions=1, cp_ratio=0.0, elements=None)

Bases: object

Configures one sub-section of an OFDM symbol section in time AND frequency.

elements: List[hermespy.modem.waveform_generator_ofdm.FrameElement]
property repetitions: int

Number of block repetitions along the frequency axis.

Returns

Number of repetitions.

Return type

int

property cp_ratio: float

Ratio between full block length and cyclic prefix.

Returns

The ratio between zero and one.

Return type

float

property num_subcarriers: int

Number of occupied subcarriers.

Returns

Number of occupied subcarriers.

Return type

int

property num_symbols: int

Number of data symbols this resource can modulate.

Return type

int

Returns

Number of modulated symbols.

property num_references: int

Number of references symbols this resource can modulate.

Return type

int

Returns

Number of modulated symbols.

property mask: numpy.ndarray

Boolean mask selecting a specific type of element from the OFDM grid.

Returns

Mask of dimension num_element_types`x`num_subcarriers.

Return type

np.ndarray

class FrameSection(num_repetitions=1, frame=None)

Bases: object

OFDM Frame configuration time axis.

frame: Optional[hermespy.modem.waveform_generator_ofdm.WaveformGeneratorOfdm]
property num_repetitions: int

Number of section repetitions in the time-domain of an OFDM grid.

Returns

The number of repetitions.

Return type

int

property num_symbols: int

Number of data symbols this section can modulate.

Returns

The number of symbols

Return type

int

property num_references: int

Number of data symbols this section can modulate.

Returns

The number of symbols

Return type

int

property num_words: int

Number of OFDM symbols, i.e. words of subcarrier symbols this section can modulate.

Returns

The number of words.

Return type

int

property num_subcarriers: int

Number of subcarriers this section requires.

Returns

The number of subcarriers.

Return type

int

property resource_mask: numpy.ndarray
Return type

ndarray

abstract property num_samples: int

Number of samples within this OFDM time-section.

Returns

Number of samples

Return type

int

abstract modulate(symbols)

Modulate this section into a complex base-band signal.

Parameters

symbols (np.ndarray) – The complex data symbols encoded in this OFDM section.

Returns

The modulated signal vector.

Return type

np.ndarray

abstract demodulate(signal, channel_state)

Demodulate a time section of a complex OFDM base-band signal into data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples.

  • channel_state (ChannelStateInformation) – Channel state.

Returns

Section symbol grid and channel response grid.

Return type

(np.ndarray, channel_state)

class FrameSymbolSection(num_repetitions=1, pattern=None, frame=None)

Bases: hermespy.modem.waveform_generator_ofdm.FrameSection, hermespy.core.factory.Serializable

yaml_tag: str = 'Symbol'

YAML serialization tag.

pattern: List[int]
property num_symbols: int

Number of data symbols this section can modulate.

Returns

The number of symbols

Return type

int

property num_references: int

Number of data symbols this section can modulate.

Returns

The number of symbols

Return type

int

property num_words: int

Number of OFDM symbols, i.e. words of subcarrier symbols this section can modulate.

Returns

The number of words.

Return type

int

property num_subcarriers: int

Number of subcarriers this section requires.

Returns

The number of subcarriers.

Return type

int

modulate(symbols)

Modulate this section into a complex base-band signal.

Parameters

symbols (np.ndarray) – The complex data symbols encoded in this OFDM section.

Returns

The modulated signal vector.

Return type

np.ndarray

demodulate(signal, channel_state)

Demodulate a time section of a complex OFDM base-band signal into data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples.

  • channel_state (ChannelStateInformation) – Channel state.

Returns

Section symbol grid and channel response grid.

Return type

(np.ndarray, channel_state)

property resource_mask: numpy.ndarray
Return type

ndarray

property num_samples: int

Number of samples within this OFDM time-section.

Returns

Number of samples

Return type

int

classmethod from_yaml(constructor, node)

Recall a new serializable class instance from YAML.

Parameters
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the Channel serialization.

Returns

The de-serialized object.

Return type

Serializable

classmethod to_yaml(representer, node)

Serialize a serializable object to YAML.

Parameters
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (Serializable) – The channel instance to be serialized.

Returns

The serialized YAML node.

Return type

Node

class FrameGuardSection(duration, num_repetitions=1, frame=None)

Bases: hermespy.modem.waveform_generator_ofdm.FrameSection, hermespy.core.factory.Serializable

yaml_tag: str = 'Guard'

YAML serialization tag.

property duration: float

Guard section duration in seconds.

Returns

Duration in seconds.

Return type

float

property num_samples: int

Number of samples within this OFDM time-section.

Returns

Number of samples

Return type

int

modulate(symbols)

Modulate this section into a complex base-band signal.

Parameters

symbols (np.ndarray) – The complex data symbols encoded in this OFDM section.

Returns

The modulated signal vector.

Return type

np.ndarray

demodulate(baseband_signal, channel_state)

Demodulate a time section of a complex OFDM base-band signal into data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples.

  • channel_state (ChannelStateInformation) – Channel state.

Returns

Section symbol grid and channel response grid.

Return type

(np.ndarray, channel_state)

classmethod from_yaml(constructor, node)

Recall a new serializable class instance from YAML.

Parameters
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the Channel serialization.

Returns

The de-serialized object.

Return type

Serializable

classmethod to_yaml(representer, node)

Serialize a serializable object to YAML.

Parameters
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (Serializable) – The channel instance to be serialized.

Returns

The serialized YAML node.

Return type

Node

class WaveformGeneratorOfdm(channel_estimation=ChannelEstimation.IDEAL, subcarrier_spacing=1000.0, num_subcarriers=1200, dc_suppression=True, resources=None, structure=None, **kwargs)

Bases: hermespy.modem.waveform_generator.PilotWaveformGenerator, hermespy.core.factory.Serializable

Generic Orthogonal-Frequency-Division-Multiplexing with a flexible frame configuration.

The following features are supported:
  • The modem can transmit or receive custom-defined frames. Frames may contain UL/DL data symbols, null carriers, pilot subcarriers, reference signals and guard intervals.

  • SC-FDMA can also be implemented with a precoder.

  • Subcarriers can be modulated with BPSK/QPSK/16-/64-/256-QAM.

  • Cyclic prefixes for interference-free channel estimation and equalization are supported.

This implementation has currently the following limitations:
  • All subcarriers use the same modulation scheme

__channel_estimation_algorithm

Method deployed to simulate OFDM channel estimation.

Type

ChannelEstimation

__num_subcarriers (int

Maximum number of subcarriers. Also the size of the FFT deployed during modulation, i.e. the difference between the configured number of subcarriers and the maximum number will be zero-padded.

dc_suppression

Suppress the direct current component during waveform generation.

Type

bool

resources

Frequency-domain resource section configurations.

Type

List[FrameResource]

structure

Time-domain frame configuration.

Type

List[FrameSection]

Orthogonal-Frequency-Division-Multiplexing Waveform Generator initialization.

Parameters
  • channel_estimation (Union[str, ChannelEstimation], optional) – Method deployed to simulate OFDM channel estimation.

  • subcarrier_spacing (float, optional) – Spacing between individual subcarriers in Hz.

  • num_subcarriers (int, optional) – Maximum number of subcarriers. Also the size of the FFT deployed during modulation, i.e. the difference between the configured number of subcarriers and the maximum number will be zero-padded.

  • dc_suppression (bool, optional) – Suppress the direct current component during waveform generation.

  • resources (List[FrameResource], optional) – Frequency-domain resource section configurations.

  • structure (List[FrameSection], optional) – Time-domain frame configuration.

  • kwargs (Any) – Waveform generator base class initialization parameters.

yaml_tag: str = 'OFDM'

YAML serialization tag.

dc_suppression: bool
resources: List[FrameResource]
structure: List[FrameSection]
add_resource(resource)

Add a OFDM frequency resource to the waveform.

Parameters

resource (FrameResource) – The resource description to be added.

Return type

None

add_section(section)

Add a frame section to the OFDM structure.

Parameters

section (FrameSection) – The section to be added.

Return type

None

property pilot_section: Optional[hermespy.modem.waveform_generator_ofdm.FrameSection]

Static pilot section transmitted at the beginning of each OFDM frame.

Required for time-domain synchronization and equalization of carrier frequency offsets.

Return type

Optional[FrameSection]

Returns

FrameSection of the pilot symbols, None if no pilot is configured.

property pilot_signal: hermespy.core.signal_model.Signal

Model of the pilot sequence within this communication waveform.

Returns

The pilot sequence.

Return type

Signal

property channel_estimation_algorithm: hermespy.modem.waveform_generator_ofdm.ChannelEstimation

Used channel estimation algorithm.

Returns

The channel estimation algorithm.

Return type

ChannelEstimation

property subcarrier_spacing: float

Subcarrier spacing between frames.

Returns

Spacing in Hz.

Return type

float

property symbols_per_frame: int

Number of dat symbols per transmitted frame.

Returns

Number of data symbols

Return type

int

property words_per_frame: int
Return type

int

property references_per_frame: int
Return type

int

property frame_duration: float

Length of one data frame in seconds.

Returns

Frame length in seconds.

Return type

float

property samples_in_frame: int

Returns read-only samples_in_frame

Type

int

Return type

int

map(data_bits)

Map a stream of bits to data symbols.

Parameters

data_bits (np.ndarray) – Vector containing a sequence of L hard data bits to be mapped onto data symbols.

Returns

Mapped data symbols.

Return type

Symbols

unmap(data_symbols)

Map a stream of data symbols to data bits.

Parameters

symbols (Symbols) – Sequence of K data symbols to be mapped onto bit sequences.

Returns

Vector containing the resulting sequence of L data bits In general, L is greater or equal to K.

Return type

np.ndarray

modulate(data_symbols)

Modulate a stream of data symbols to a base-band signal containing a single data frame.

Parameters

data_symbols (Symbols) – Singular stream of data symbols to be modulated by this waveform.

Returns

Signal model of a single modulate data frame.

Return type

Signal

demodulate(signal, channel_state, noise_variance=0.0)

Demodulate a base-band signal stream to data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples of a single communication frame.

  • channel_state (ChannelStateInformation) – Channel state information of a single communication frame.

  • noise_variance (float) – Variance of the thermal noise introduced during reception.

Returns

Tuple of 3 vectors of equal-length first dimension num_symbols. The demodulated data symbols, their channel estimates and their noise variance.

Return type

(np.ndarray, ChannelStateInformation, np.ndarray)

property bandwidth: float

Bandwidth of the frame generated by this generator.

Used to estimate the minimal sampling frequency required to adequately simulate the scenario.

Returns

Bandwidth in Hz.

Return type

float

static reference_based_channel_estimation(symbol_grid, resource_mask)

Perform a reference-symbol based channel estimation over the OFDM frame grid.

This method estimates the channel using reference symbols. Only LS method is currently implemented. The function will return only a single value for each subcarrier. If several reference symbols are available, then the estimate will be averaged over all OFDM symbols.

Parameters
  • symbol_grid (numpy.ndarray) – Frequency-domain samples of the received signal over the whole frame.

  • resource_mask (np.ndarray) – Boolean mask for OFDM resource allocation. Required to distinguish between data, reference and null symbols within symbol_grid.

Returns

The channel state estimate.

Return type

ChannelStateInformation

property bits_per_frame: int

Number of bits required to generate a single data frame.

Returns

Number of bits

Return type

int

property bit_energy: float

Returns the theoretical average (discrete-time) bit energy of the modulated baseband_signal.

Energy of baseband_signal x[k] is defined as sum{|x[k]}^2 Only data bits are considered, i.e., reference, guard intervals are ignored.

Return type

float

property symbol_energy: float

The theoretical average symbol (discrete-time) energy of the modulated baseband_signal.

Energy of baseband_signal x[k] is defined as sum{|x[k]}^2 Only data bits are considered, i.e., reference, guard intervals are ignored.

Return type

float

Returns

The average symbol energy in UNIT.

property power: float

Returns the theoretical average symbol (unitless) power,

Power of baseband_signal x[k] is defined as sum_{k=1}^N{|x[k]|}^2 / N Power is the average power of the data part of the transmitted frame, i.e., bit energy x raw bit rate

Return type

float

property num_subcarriers: int

Maximum number of subcarriers.

Sometimes also referred to as FFT-size.

Returns

Number of subcarriers.

Return type

int

property sampling_rate: float

Rate at which the waveform generator signal is internally sampled.

Returns

Sampling rate in Hz.

Return type

float

classmethod to_yaml(representer, node)

Serialize an WaveformGenerator object to YAML.

Parameters
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (WaveformGeneratorOfdm) – The WaveformGeneratorOfdm instance to be serialized.

Returns

The serialized YAML node

Return type

Node

classmethod from_yaml(constructor, node)

Recall a new WaveformGeneratorOfdm instance from YAML.

Parameters
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the WaveformGeneratorOfdm serialization.

Returns

Newly created WaveformGeneratorOfdm instance.

Return type

WaveformGeneratorOfdm

class PilotSection(pilot_elements=None, frame=None)

Bases: hermespy.modem.waveform_generator_ofdm.FrameSection

Pilot symbol section within an OFDM frame.

Parameters
  • pilot_elements (Optional[Symbols], optional) – Symbols with which the subcarriers within the pilot will be modulated. By default, a pseudo-random sequence from the frame mapping will be generated.

  • frame (Optional[WaveformGeneratorOfdm], optional) – The frame configuration this pilot section belongs to.

property num_samples: int

Number of samples within this OFDM time-section.

Returns

Number of samples

Return type

int

property pilot_elements: Optional[hermespy.modem.symbols.Symbols]

Symbols with which the subcarriers within the pilot will be modulated.

Return type

Optional[Symbols]

Returns

A stream of symbols. None, if no subsymbols where specified.

Raises

ValueError – If the configured symbols contains multiple streams.

modulate(*_)

Modulate this section into a complex base-band signal.

Parameters

symbols (np.ndarray) – The complex data symbols encoded in this OFDM section.

Returns

The modulated signal vector.

Return type

np.ndarray

demodulate(*_)

Demodulate a time section of a complex OFDM base-band signal into data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples.

  • channel_state (ChannelStateInformation) – Channel state.

Returns

Section symbol grid and channel response grid.

Return type

(np.ndarray, channel_state)

class SchmidlCoxPilotSection(pilot_elements=None, frame=None)

Bases: hermespy.modem.waveform_generator_ofdm.PilotSection

Pilot Symbol Section of the Schmidl Cox Algorithm.

Refer to Schmidl and Cox1 for a detailed description.

Parameters
  • pilot_elements (Optional[Symbols], optional) – Symbols with which the subcarriers within the pilot will be modulated. By default, a pseudo-random sequence from the frame mapping will be generated.

  • frame (Optional[WaveformGeneratorOfdm], optional) – The frame configuration this pilot section belongs to.

property num_samples: int

Number of samples within this OFDM time-section.

Returns

Number of samples

Return type

int

demodulate(*_)

Demodulate a time section of a complex OFDM base-band signal into data symbols.

Parameters
  • signal (np.ndarray) – Vector of complex-valued base-band samples.

  • channel_state (ChannelStateInformation) – Channel state.

Returns

Section symbol grid and channel response grid.

Return type

(np.ndarray, channel_state)

class OFDMSynchronization(waveform_generator=None)

Bases: hermespy.modem.waveform_generator.Synchronization[hermespy.modem.waveform_generator_ofdm.WaveformGeneratorOfdm]

Synchronization Routine for OFDM Waveforms.

Parameters

waveform_generator (WaveformGenerator, optional) – The waveform generator this synchronization routine is attached to.

class OFDMCorrelationSynchronization(threshold=0.9, guard_ratio=0.8, *args, **kwargs)

Bases: hermespy.modem.waveform_correlation_synchronization.CorrelationSynchronization[hermespy.modem.waveform_generator_ofdm.WaveformGeneratorOfdm]

Correlation-Based Pilot Detection and Synchronization for OFDM Waveforms.

Parameters
  • threshold (float, optional) – Correlation threshold at which a pilot signal is detected.

  • guard_ratio (float, optional) – Guard ratio of frame duration.

  • *args – Synchronization base class initialization parameters.

class SchmidlCoxSynchronization(waveform_generator=None)

Bases: hermespy.modem.waveform_generator_ofdm.OFDMSynchronization

Schmidl-Cox Algorithm for OFDM Waveform Time Synchronization and Carrier Frequency Offset Equzalization.

Applying the synchronization routine requires the respective waveform to have a SchmidlCoxPilotSection pilot symbol section configured.

Refer to Schmidl and Cox1 for a detailed description.

Parameters

waveform_generator (WaveformGenerator, optional) – The waveform generator this synchronization routine is attached to.

yaml_tag: Optional[str] = 'SchmidlCox'

YAML serialization tag

synchronize(signal, channel_state)

Simulates time-synchronization at the receiver-side.

Sorts base-band signal-sections into frames in time-domain.

Parameters
  • signal (np.ndarray) – Vector of complex base-band samples of with num_streams`x`num_samples entries.

  • channel_state (ChannelStateInformation) – State of the wireless transmission channel over which signal has been propagated.

Returns

Tuple of signal samples and channel transformations sorted into frames

Return type

List[Tuple[np.ndarray, ChannelStateInformation]]

Raises
  • ValueError – If the number of received streams in channel_state does not equal one. If the length of signal and the number of samples in channel_state are not identical.

  • RuntimeError – If the synchronization routine is floating

class OFDMChannelEqualization(waveform_generator=None)

Bases: hermespy.modem.waveform_generator.ChannelEqualization[hermespy.modem.waveform_generator_ofdm.WaveformGeneratorOfdm], abc.ABC

Channel estimation for OFDM waveforms.

Parameters

waveform_generator (WaveformGenerator, optional) – The waveform generator this equalization routine is attached to.

class OFDMZeroForcingChannelEqualization(waveform_generator=None)

Bases: hermespy.core.factory.Serializable, hermespy.modem.waveform_generator_ofdm.OFDMChannelEqualization, abc.ABC

Zero-Forcing Channel estimation for Psk Qam waveforms.

Parameters

waveform_generator (WaveformGenerator, optional) – The waveform generator this equalization routine is attached to.

yaml_tag: Optional[str] = 'OFDM-ZF'

YAML serialization tag

equalize_channel(frame, csi, snr=inf)

Equalize the wireless channel of a received communication frame.

Parameters
  • signal (Signal) – Signal model of the communication frame waveform.

  • csi (ChannelStateInformation) – Channel state estimation

  • snr (float) – Assumed signal to noise ratio. May be required by some routines, infinite by default.

Returns

The equalized signal model.

Return type

Signal

class OFDMMinimumMeanSquareChannelEqualization(waveform_generator=None)

Bases: hermespy.core.factory.Serializable, hermespy.modem.waveform_generator_ofdm.OFDMChannelEqualization, abc.ABC

Minimum-Mean-Square Channel estimation for Psk Qam waveforms.

Parameters

waveform_generator (WaveformGenerator, optional) – The waveform generator this equalization routine is attached to.

yaml_tag: Optional[str] = 'OFDM-MMSE'

YAML serialization tag

equalize_channel(signal, csi, snr=inf)

Equalize the wireless channel of a received communication frame.

Parameters
  • signal (Signal) – Signal model of the communication frame waveform.

  • csi (ChannelStateInformation) – Channel state estimation

  • snr (float) – Assumed signal to noise ratio. May be required by some routines, infinite by default.

Returns

The equalized signal model.

Return type

Signal

1(1,2)

T.M. Schmidl and D.C. Cox. Robust frequency and timing synchronization for ofdm. IEEE Transactions on Communications, 45(12):1613–1621, 1997. doi:10.1109/26.650240.