pub struct CeOfdm {
pub n_subcarriers: usize,
pub oversampling: usize,
pub h: f64,
pub n_cp: usize,
pub receiver: Receiver,
pub sample_rate: Hertz,
}Expand description
A CE-OFDM link (see the module documentation).
Fields§
§n_subcarriers: usizeData subcarriers K per block.
oversampling: usizeOversampling factor J: the DFT has N = 2J(K + 1) points.
h: f64Modulation index h (phase standard deviation 2πh).
n_cp: usizeCyclic prefix, in samples of the DFT of $N$ points (the oversampling is already in
$N$, unlike crate::ofdm::Ofdm::n_cp, which counts Nyquist-rate samples).
receiver: ReceiverThe receiver of Demodulate (CeOfdm::demodulate_with_receiver); the arctangent
demodulator of the principal phase by default.
sample_rate: HertzThe rate of the samples (one per point of the DFT of $N$): the rate of the
Signal of Modulate and the rate Demodulate expects; 1 Hz by default
(time in samples).
Implementations§
Source§impl CeOfdm
impl CeOfdm
Sourcepub fn noise_variance(&self, esn0_db: f64) -> f64
pub fn noise_variance(&self, esn0_db: f64) -> f64
Noise variance per sample for an E_s/N_0 (dB) per data symbol and a unit
envelope: σ² = (N + N_cp)/(K E_s/N_0).
Sourcepub fn new(n_subcarriers: usize, oversampling: usize, h: f64) -> Result<CeOfdm>
pub fn new(n_subcarriers: usize, oversampling: usize, h: f64) -> Result<CeOfdm>
K data subcarriers, oversampling J, modulation index h, no prefix, the default
receiver, at the sample rate 1 Hz.
§Errors
comnum_core::Error::Config for invalid parameters (see CeOfdm::check).
§Examples
use comnum_waveform::ce_ofdm::CeOfdm;
let ce = CeOfdm { n_cp: 8, ..CeOfdm::new(16, 2, 0.1)? };
assert_eq!(ce.block_len(), 2 * 2 * 17 + 8);Sourcepub fn check(&self) -> Result<()>
pub fn check(&self) -> Result<()>
Validate the configuration.
§Errors
comnum_core::Error::Config unless K ≥ 1, J ≥ 1, h > 0, the prefix is at
most one block of N samples and the sample rate is positive and finite.
Sourcepub fn ofdm_signal(&self, d: &[C64]) -> Result<Vec<f64>>
pub fn ofdm_signal(&self, d: &[C64]) -> Result<Vec<f64>>
The real OFDM signal x = (F d + F* d*)/√(2K) of every block (no prefix).
§Errors
comnum_core::Error::Config for invalid parameters, comnum_core::Error::Shape for
a number of symbols that is not a multiple of K.
Sourcepub fn modulate(&self, d: &[C64]) -> Result<Vec<C64>>
pub fn modulate(&self, d: &[C64]) -> Result<Vec<C64>>
The transmitted samples exp(j2πh x), with the cyclic prefix of every block.
§Errors
Sourcepub fn demodulate_with_receiver(
&self,
r: &[C64],
receiver: Receiver,
) -> Result<Vec<C64>>
pub fn demodulate_with_receiver( &self, r: &[C64], receiver: Receiver, ) -> Result<Vec<C64>>
The symbol estimates of every block with the receiver: the projection of its proxy
of the phase on the data bins, divided by $2\pi h$ and by Bussgang’s gain of the
receiver (theory::receiver_gain), so that the estimates are unbiased. With
Receiver::Arctangent, the estimates d̂ = G ψ/(2πh) of the arctangent
demodulator with its unwrapping.
§Errors
comnum_core::Error::Config for invalid parameters, comnum_core::Error::Shape for
a number of samples that is not a multiple of N + N_cp.
§Examples
use comnum_waveform::ce_ofdm::{CeOfdm, Receiver};
use comnum_mapping::constellation::Constellation;
use comnum_core::rng::Rng;
let ce = CeOfdm::new(64, 2, 0.02).unwrap();
let c = Constellation::qam(16).unwrap().normalized();
let (_, d) = comnum_mapping::source::symbols(&c, 64, None, &mut Rng::new(1)).unwrap();
// without noise the linear receivers err only by their distortion, small at a small h
let e = ce.demodulate_with_receiver(&ce.modulate(&d).unwrap(), Receiver::Enhanced).unwrap();
assert_eq!(c.decide(&e), c.decide(&d));Trait Implementations§
Source§impl Demodulate for CeOfdm
CE-OFDM as a Demodulate block: one stream of samples at CeOfdm::sample_rate,
demodulated by CeOfdm::receiver.
impl Demodulate for CeOfdm
CE-OFDM as a Demodulate block: one stream of samples at CeOfdm::sample_rate,
demodulated by CeOfdm::receiver.
Source§fn demodulate_into(&mut self, y: &Signal, out: &mut Symbols) -> Result<()>
fn demodulate_into(&mut self, y: &Signal, out: &mut Symbols) -> Result<()>
§Errors
comnum_core::Error::Config for several streams or a signal at another sample rate,
and the errors of CeOfdm::demodulate_with_receiver.
Source§impl Modulate for CeOfdm
CE-OFDM as a Modulate block: one stream of data symbols into one stream of
samples at CeOfdm::sample_rate.
impl Modulate for CeOfdm
CE-OFDM as a Modulate block: one stream of data symbols into one stream of
samples at CeOfdm::sample_rate.