Skip to main content

Css

Struct Css 

Source
pub struct Css {
    pub sf: u32,
    pub oversampling: usize,
    pub waveform: Waveform,
    pub sample_rate: Hertz,
}
Expand description

A chirp spread-spectrum link (see the module): a configuration with public fields, built by Css::lora and changed by struct update, checked by Css::check when it is used.

Fields§

§sf: u32

Spreading factor: M = 2^SF chips per symbol.

§oversampling: usize

Samples per chip (1: the chip rate B).

§waveform: Waveform

The family of waveforms.

§sample_rate: Hertz

The sample rate of the signal of the verb traits, J times the chip rate B (1 Hz by default: time in samples).

Implementations§

Source§

impl Css

Source

pub fn lora(sf: u32) -> Result<Css>

The LoRa waveform at one sample per chip, at 1 Hz.

§Errors

As Css::check: the spreading factor lies in 1..=16.

§Examples
use comnum_waveform::css::Css;
let css = Css { oversampling: 4, ..Css::lora(7)? };
assert_eq!(css.symbol_len(), 4 * 128);
assert!(Css::lora(17).is_err());
Source

pub fn m(&self) -> usize

The number of symbols (and of chips per symbol) M = 2^SF.

Source

pub fn symbol_len(&self) -> usize

Samples per symbol, J M.

Source

pub fn check(&self) -> Result<()>

Check the configuration.

§Errors

comnum_core::Error::Config unless the spreading factor lies in 1..=16, the oversampling factor is at least 1 (exactly 1 for the FSK reference) and the sample rate is positive and finite.

Source

pub fn symbol(&self, a: usize) -> Result<Vec<C64>>

The J M samples of symbol a.

§Errors

comnum_core::Error::Config for invalid parameters or a ≥ M.

Source

pub fn modulate(&self, symbols: &[usize]) -> Result<Vec<C64>>

The samples of a sequence of symbols (the chirps tabulated once, see the module).

§Errors

comnum_core::Error::Config for invalid parameters or a symbol ≥ M.

Source

pub fn energies(&self, r: &[C64]) -> Result<Vec<f64>>

The energy of the M candidate symbols of every received symbol: the squared magnitudes of the DFT of the dechirped samples, bins a and, when oversampled, a - M (after the fold) added.

§Errors

comnum_core::Error::Config for invalid parameters, comnum_core::Error::Shape for a number of samples that is not a multiple of J M.

Source

pub fn demodulate(&self, r: &[C64]) -> Result<Vec<usize>>

The noncoherent decisions: the candidate of largest energy in every symbol.

§Errors

As Css::energies.

Source

pub fn interferer(&self, s1: usize, s2: usize, tau: f64) -> Result<Vec<C64>>

One symbol of an interferer of the same spreading factor, not synchronised: the end of its symbol s1 then the start of its symbol s2, which begins tau chips after the symbol of interest, 0 ≤ tau < M (Afisiadis et al. 2020, eq. (21)), at one sample per chip.

§Errors

comnum_core::Error::Config for another waveform than LoRa at one sample per chip, symbols ≥ M or tau outside [0, M).

Trait Implementations§

Source§

impl Clone for Css

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Css

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Demodulate<Labels> for Css

CSS as a Demodulate block: the noncoherent decisions of Css::demodulate on one stream of samples at Css::sample_rate.

Source§

fn demodulate_into(&mut self, y: &Signal, out: &mut Labels) -> Result<()>

§Errors

comnum_core::Error::Config for several streams or a signal at another sample rate, and the errors of Css::demodulate.

Source§

fn demodulate(&mut self, y: &Signal) -> Result<Out, Error>
where Out: Default,

Demodulate y (allocates, calls Demodulate::demodulate_into). Read more
Source§

impl Modulate<Labels> for Css

CSS as a Modulate block: one stream of symbol indices into one stream of samples at Css::sample_rate, by Css::modulate.

Source§

fn modulate_into(&self, x: &Labels, out: &mut Signal) -> Result<()>

§Errors

comnum_core::Error::Config for several streams, and the errors of Css::modulate.

Source§

fn modulate(&self, x: &In) -> Result<Signal, Error>

Modulate x (allocates, calls Modulate::modulate_into). Read more
Source§

impl PartialEq for Css

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Css

Auto Trait Implementations§

§

impl Freeze for Css

§

impl RefUnwindSafe for Css

§

impl Send for Css

§

impl Sync for Css

§

impl Unpin for Css

§

impl UnsafeUnpin for Css

§

impl UnwindSafe for Css

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.