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
- 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
- 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#
-
yaml_tag:
- 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.
- Returns:
Number of modulated symbols.
- property num_references: int#
Number of references symbols this resource can modulate.
- 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
-
yaml_tag:
- class FrameSection(num_repetitions=1, frame=None)#
Bases:
object
OFDM Frame configuration time axis.
- property frame: OFDMWaveform | None#
OFDM frame this section belongs to.
- 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#
- 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.
- Return type:
ndarray
Returns: Sequence of demodulated data and reference symbols.
- class FrameSymbolSection(num_repetitions=1, pattern=None, frame=None)#
Bases:
FrameSection
,Serializable
-
yaml_tag:
str
= 'Symbol'# YAML serialization tag.
-
serialized_attributes:
Set
[str
] = {'pattern'}# Set of object attributes to be serialized.
-
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.
- Return type:
ndarray
Returns: Sequence of demodulated data and reference symbols.
- property resource_mask: ndarray#
- property num_samples: int#
Number of samples within this OFDM time-section.
- Returns:
Number of samples
- Return type:
int
-
yaml_tag:
- 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.
- Return type:
ndarray
Returns: Sequence of demodulated data and reference symbols.
-
yaml_tag:
- class OFDMWaveform(subcarrier_spacing=1000.0, num_subcarriers=1024, dc_suppression=True, resources=None, structure=None, **kwargs)#
Bases:
ConfigurablePilotWaveform
,Serializable
Generic Orthogonal-Frequency-Division-Multiplexing with a flexible frame configuration.
The internally applied FFT size is
OFDMWaveform.num_subcarriers()
timesWaveformGenerator.oversampling_factor()
.- 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
- Parameters:
subcarrier_spacing (float, optional) – Spacing between individual subcarriers in Hz. \(1~\mathrm{kHz}\) by default.
num_subcarriers (int, optional) – Maximum number of assignable subcarriers. Unassigned subcarriers will be assumed to be zero. \(1024\) by default.
dc_suppression (bool, optional) – Suppress the direct current component during waveform generation. Enabled by default.
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. Refer to
WaveformGenerator
for details.
- yaml_tag: str = 'OFDM'#
YAML serialization tag.
- dc_suppression: bool#
- property resources: List[FrameResource]#
OFDM grid resources.
Returns: List of resources.
- property structure: List[FrameSection]#
OFDM frame configuration in time domain.
Returns: List of frame elements.
- 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: PilotSection | None#
Static pilot section transmitted at the beginning of each OFDM frame.
Required for time-domain synchronization and equalization of carrier frequency offsets.
- 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 symbols per OFDM frame.
- property words_per_frame: int#
Number of words per OFDM frame.
- property references_per_frame: int#
Number of reference symbols per OFDM frame.
- property frame_duration: float#
Length of one data frame in seconds.
- Returns:
Frame length in seconds.
- Return type:
float
- property samples_in_frame: int#
The number of discrete samples per generated frame.
- Returns:
The number of samples.
- 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
- 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.
- 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.
- 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
- 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: Symbols | None#
Symbols with which the subcarriers within the pilot will be modulated.
- Returns:
A stream of symbols. None, if no subsymbols where specified.
- Raises:
ValueError – If the configured symbols contains multiple streams.
- modulate(_=None)#
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.
- Return type:
ndarray
Returns: Sequence of demodulated data and reference symbols.
- 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.
- Return type:
MappingNode
Returns: The serialized YAML node.
- 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.
- Return type:
Returns: The de-serialized object.
- class SchmidlCoxPilotSection(pilot_elements=None, frame=None)#
Bases:
PilotSection
Pilot Symbol Section of the Schmidl Cox Algorithm.
Refer to Schmidl and Cox[1] 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.
- Return type:
ndarray
Returns: Sequence of demodulated data and reference symbols.
- 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 Cox[1] 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)#
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
[int
]- 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.
- 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.
- Return type:
Tuple
[StatedSymbols
,ChannelStateInformation
]
Returns: The symbols and their respective channel states.
- 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
- estimate_channel(symbols)#
Estimate the wireless channel of a received communication frame.
- Parameters:
symbols (Symbols) – Demodulated communication symbols.
- Return type:
Tuple
[StatedSymbols
,ChannelStateInformation
]
Returns: The symbols and their respective channel states.
- 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