Skip to main content

comnum_core/
channel.rs

1//! The description of a channel realisation shared by the media that draw it and the
2//! waveforms that take it.
3//!
4//! A doubly-dispersive channel of a few discrete paths, each with its complex gain
5//! $h_{i}$, its delay $l_{i}$ (samples) and a single Doppler shift $\nu_{i}$ (Hz), acts on
6//! a signal sampled at $f_{s}$ as
7//!
8//! $$
9//! r\[n\] = \sum_{i=1}^{P} h_{i}\, e^{j 2\pi \nu_{i} (n - l_{i}) / f_{s}}\, s\[n - l_{i}\].
10//! $$
11//!
12//! `comnum_channel::multipath::DelayDoppler` draws and applies it;
13//! `comnum_waveform::otfs::Otfs::effective_channel` takes its paths. Both crates sit on the
14//! same layer, so the type of a path lives here (it contains no algorithm).
15//!
16//! # Examples
17//! ```
18//! use comnum_core::channel::Path;
19//! use comnum_core::C64;
20//! let p = Path { gain: C64::new(1.0, 0.0), delay: 2, doppler_hz: 1e3 };
21//! assert_eq!(p.delay, 2);
22//! ```
23
24use crate::C64;
25
26/// One path of a delay–Doppler channel: a complex gain, a delay (samples) and a single
27/// Doppler shift.
28#[derive(Clone, Copy, Debug, PartialEq)]
29pub struct Path {
30    /// Complex gain $h_{i}$.
31    pub gain: C64,
32    /// Delay $l_{i}$ (samples).
33    pub delay: usize,
34    /// Doppler shift $\nu_{i}$ (Hz).
35    pub doppler_hz: f64,
36}