Orthogonal Frequency Division Multiplexing
- class ElementType(value)
Bases:
SerializableEnum
Type of resource element.
- REFERENCE = 0
Reference element within the time-frequency OFDM grid
- DATA = 1
Data element within the time-frequency OFDM grid
- NULL = 2
Empty element within the time-frequency OFDM grid
- yaml_tag: Optional[str] = 'ElementType'
YAML serialization tag.
- property_blacklist: Set[str] = {}
Set of properties to be ignored during serialization.
- serialized_attributes: Set[str] = {}
Set of object attributes to be serialized.
- class PrefixType(value)
Bases:
SerializableEnum
Type of prefix applied to the OFDM resource
- CYCLIC = 0
Cyclic prefix repeating the resource waveform in time-domain
- ZEROPAD = 1
Prefix zero-padding the prefix in time-domain
- NONE = 2
No prefix applied
- yaml_tag: Optional[str] = 'PrefixType'
YAML serialization tag.
- property_blacklist: Set[str] = {}
Set of properties to be ignored during serialization.
- serialized_attributes: Set[str] = {}
Set of object attributes to be serialized.
- class FrameElement(type, repetitions=1)
Bases:
Serializable
- yaml_tag: Optional[str] = 'FrameElement'
YAML serialization tag.
- serialized_attributes: Set[str] = {'repetitions', 'type'}
Set of object attributes to be serialized.
- type: ElementType
- repetitions: int = 1
- class FrameResource(repetitions=1, prefix_type=PrefixType.CYCLIC, prefix_ratio=0.0, elements=None)
Bases:
Serializable
Configures one sub-section of an OFDM symbol section in time AND frequency.
- yaml_tag: Optional[str] = 'OFDM-Resource'
YAML serialization tag.
- serialized_attributes: Set[str] = {'elements', 'prefix_type'}
Set of object attributes to be serialized.
- prefix_type: PrefixType
Prefix type of the frame resource
- elements: List[FrameElement]
Individual resource elements
- property repetitions: int
Number of block repetitions along the frequency axis.
- Returns
Number of repetitions.
- Return type
int
- property prefix_ratio: float
Ratio between full block length and prefix length.
- Returns
The ratio between zero and one.
- Return type
float
- Raises
ValueError – If ratio is less than zero or larger than one.
- 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: 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.
- property frame: Optional[OFDMWaveform]
OFDM frame this section belongs to.
- Return type
Optional
[OFDMWaveform
]- Returns
Handle to the OFDM frame. None if this section is considered floating.
- 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: ndarray
- Return type
ndarray
- abstract property num_samples: int
Number of samples within this OFDM time-section.
- Returns
Number of samples
- Return type
int
- place_symbols(data_symbols, reference_symbols)
- Return type
ndarray
- pick_symbols(grid)
- Return type
Tuple
[ndarray
,ndarray
]
- abstract modulate(symbols)
Modulate this section into a complex base-band signal.
- Parameters
symbols (np.ndarray) – The palced complex symbols encoded in this OFDM section. This includes both reference and data symbols to be transmitted.
- Returns
The modulated signal vector.
- Return type
np.ndarray
- abstract demodulate(signal)
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.
Returns: Sequence of demodulated data and reference symbols.
- Return type
ndarray
- class FrameSymbolSection(num_repetitions=1, pattern=None, frame=None)
Bases:
FrameSection
,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 palced complex symbols encoded in this OFDM section. This includes both reference and data symbols to be transmitted.
- Returns
The modulated signal vector.
- Return type
np.ndarray
- demodulate(signal)
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.
Returns: Sequence of demodulated data and reference symbols.
- Return type
ndarray
- property resource_mask: ndarray
- Return type
ndarray
- property num_samples: int
Number of samples within this OFDM time-section.
- Returns
Number of samples
- Return type
int
- class FrameGuardSection(duration, num_repetitions=1, frame=None)
Bases:
FrameSection
,Serializable
- yaml_tag: Optional[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 palced complex symbols encoded in this OFDM section. This includes both reference and data symbols to be transmitted.
- Returns
The modulated signal vector.
- Return type
np.ndarray
- demodulate(baseband_signal)
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.
Returns: Sequence of demodulated data and reference symbols.
- Return type
ndarray
- class OFDMWaveform(subcarrier_spacing=1000.0, num_subcarriers=1200, dc_suppression=True, resources=None, structure=None, **kwargs)
Bases:
PilotWaveformGenerator
,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
Orthogonal-Frequency-Division-Multiplexing Waveform Generator initialization.
- Parameters
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
- property resources: List[FrameResource]
OFDM grid resources.
Returns: List of resources.
- Return type
List
[FrameResource
]
- property structure: List[FrameElement]
OFDM frame configuration in time domain.
Returns: List of frame elements.
- Return type
List
[FrameElement
]
- property modulation_order: int
Access the modulation order.
- Returns
The modulation order.
- Return type
int
- 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[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: Signal
Model of the pilot sequence within this communication waveform.
- Returns
The pilot sequence.
- Return type
- 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
- unmap(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(symbols)
Modulate a stream of data symbols to a base-band signal containing a single data frame.
- demodulate(signal)
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.
- Return type
- Returns
The demodulated communication symbols
- 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
- 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
- class PilotSection(pilot_elements=None, frame=None)
Bases:
FrameSection
,Serializable
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.
- yaml_tag: Optional[str] = 'OFDM-Pilot'
YAML serialization tag
- property num_samples: int
Number of samples within this OFDM time-section.
- Returns
Number of samples
- Return type
int
- property pilot_elements: Optional[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 palced complex symbols encoded in this OFDM section. This includes both reference and data symbols to be transmitted.
- 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.
Returns: Sequence of demodulated data and reference symbols.
- Return type
Tuple
[ndarray
,ndarray
]
- 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 (PilotSection) – The channel instance to be serialized.
Returns: The serialized YAML node.
- Return type
MappingNode
- 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 PilotSection serialization.
Returns: The de-serialized object.
- Return type
- class SchmidlCoxPilotSection(pilot_elements=None, frame=None)
Bases:
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.
- yaml_tag: Optional[str] = 'SchmidlCoxPilot'
YAML serialization tag
- 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.
Returns: Sequence of demodulated data and reference symbols.
- Return type
Tuple
[ndarray
,ChannelStateInformation
]
- class OFDMSynchronization(waveform_generator=None)
Bases:
Synchronization
[OFDMWaveform
]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:
CorrelationSynchronization
[OFDMWaveform
]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 (
Any
) – Synchronization base class initialization parameters.
- yaml_tag: Optional[str] = 'OFDM-PilotCorrelation'
YAML serialization tag.
- class SchmidlCoxSynchronization(waveform_generator=None)
Bases:
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.
- Return type
List
[Tuple
[ndarray
,ChannelStateInformation
]]- Returns
List of time indices indicating the first samples of frames detected in signal.
- Raises
RuntimeError – If the synchronization routine is floating
- class ReferencePosition(value)
Bases:
SerializableEnum
Applied channel estimation algorithm after reception.
- yaml_tag: Optional[str] = 'ReferencePosition'
YAML serialization tag.
- property_blacklist: Set[str] = {}
Set of properties to be ignored during serialization.
- serialized_attributes: Set[str] = {}
Set of object attributes to be serialized.
- IDEAL = 0
- IDEAL_PREAMBLE = 1
- IDEAL_MIDAMBLE = 2
- IDEAL_POSTAMBLE = 3
- class OFDMIdealChannelEstimation(reference_position=ReferencePosition.IDEAL, *args, **kwargs)
Bases:
IdealChannelEstimation
[OFDMWaveform
],Serializable
Ideal channel state estimation for OFDM waveforms.
- Parameters
reference_position (ReferencPosition, optional) – Assumed location of the reference symbols within the ofdm frame.
- yaml_tag: Optional[str] = 'OFDM-Ideal'
YAML serialization tag.
- serialized_attributes: Set[str] = {'reference_position'}
Set of object attributes to be serialized.
- reference_position: ReferencePosition
Assumed position of the reference symbol within the frame.
- estimate_channel(symbols)
Estimate the wireless channel of a received communication frame.
- Parameters
symbols (Symbols) – Demodulated communication symbols.
Returns: The symbols and their respective channel states.
- Return type
Tuple
[StatedSymbols
,ChannelStateInformation
]
- class OFDMLeastSquaresChannelEstimation(waveform_generator=None)
Bases:
ChannelEstimation
[OFDMWaveform
],Serializable
Least-Squares channel estimation for OFDM waveforms.
- Parameters
waveform_generator (WaveformGenerator, optional) – The waveform generator this estimation routine is attached to.
- yaml_tag: Optional[str] = 'OFDM-LS'
YAML serializtion tag
- class OFDMChannelEqualization(waveform_generator=None)
Bases:
ChannelEqualization
[OFDMWaveform
],ABC
Channel estimation for OFDM waveforms.
- Parameters
waveform_generator (WaveformGenerator, optional) – The waveform generator this equalization routine is attached to.
- yaml_tag: Optional[str] = 'OFDM-NoEqualization'
YAML serialization tag.
- class OFDMZeroForcingChannelEqualization(waveform_generator=None)
Bases:
ZeroForcingChannelEqualization
[OFDMWaveform
]Zero-Forcing channel equalization for OFDM waveforms.
- Parameters
waveform_generator (WaveformGenerator, optional) – The waveform generator this equalization routine is attached to.
- yaml_tag: Optional[str] = 'OFDM-ZF'
YAML serialization tag
- class OFDMMinimumMeanSquareChannelEqualization(waveform_generator=None)
Bases:
OFDMChannelEqualization
,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
- 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.