Skip to main content

SignalNode

Struct SignalNode 

Source
pub struct SignalNode {
    pub name: String,
    pub signal_frequency_hz: f64,
    pub signal_bandwidth_hz: f64,
    pub signal_power_dbm: f64,
    pub noise_power_dbm: f64,
    pub cumulative_noise_figure_db: f64,
    pub cumulative_gain_db: f64,
    pub cumulative_noise_temperature: Option<f64>,
    pub cumulative_oip3_dbm: Option<f64>,
    pub sfdr_db: Option<f64>,
    pub output_p1db_dbm: Option<f64>,
}
Expand description

Output signal at a node in the RF cascade, containing power, noise, and gain information.

§Examples

use gainlineup::{Input, Block, SignalNode};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(270.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 30.0,
    noise_figure_db: 1.5,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
assert_eq!(node.signal_power_dbm, 0.0);
assert_eq!(node.cumulative_gain_db, 30.0);
let snr = node.signal_to_noise_ratio_db();
assert!(snr > 50.0);

Fields§

§name: String

Name of this node (e.g. “LNA Output”).

§signal_frequency_hz: f64

Signal center frequency in Hz.

§signal_bandwidth_hz: f64

Signal bandwidth in Hz.

§signal_power_dbm: f64

Signal power at this node in dBm.

§noise_power_dbm: f64

Total noise power at this node in dBm.

§cumulative_noise_figure_db: f64

Cumulative noise figure through the cascade in dB.

§cumulative_gain_db: f64

Cumulative gain through the cascade in dB.

§cumulative_noise_temperature: Option<f64>

Cumulative noise temperature in Kelvin, if available.

§cumulative_oip3_dbm: Option<f64>

Cascaded output-referred IP3 in dBm, if available.

§sfdr_db: Option<f64>

Spur-free dynamic range in dB, if OIP3 is available.

§output_p1db_dbm: Option<f64>

Output P1dB at this node in dBm, if applicable.

Implementations§

Source§

impl SignalNode

Source

pub fn noise_spectral_density(&self) -> f64

Noise spectral density in dBm/Hz at this node.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 2.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
let nsd = node.noise_spectral_density();
assert!(nsd < -140.0); // well below signal levels
Source

pub fn signal_to_noise_ratio_db(&self) -> f64

Signal-to-noise ratio in dB at this node.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 2.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
let snr = node.signal_to_noise_ratio_db();
assert!(snr > 50.0);
Source

pub fn cascade_block(&self, block: &Block) -> SignalNode

Cascade this node through another block, producing a new SignalNode.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(270.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 30.0,
    noise_figure_db: 3.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let atten = Block {
    name: "Attenuator".to_string(),
    gain_db: -6.0,
    noise_figure_db: 6.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let after_lna = input.cascade_block(&lna);
let after_atten = after_lna.cascade_block(&atten);
assert_eq!(after_atten.signal_power_dbm, -6.0); // -30 + 30 - 6
Source

pub fn noise_factor(&self) -> f64

Cumulative noise factor (linear) at this node.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 3.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
let nf = node.noise_factor();
assert!((nf - 2.0).abs() < 0.01); // 3 dB ≈ factor 2
Source

pub fn noise_temperature(&self) -> f64

Cumulative noise temperature in Kelvin at this node.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 3.0,
    output_p1db_dbm: None,
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
let temp = node.noise_temperature();
assert!(temp > 200.0 && temp < 400.0); // ~290 K for 3 dB NF
Source

pub fn dynamic_range_db(&self) -> Option<f64>

Linear dynamic range at this node in dB.

output_p1db_dbm - noise_power_dbm

Returns None if output_p1db_dbm is not set.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(270.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 2.0,
    output_p1db_dbm: Some(10.0),
    output_ip3_dbm: None,
};
let node = input.cascade_block(&lna);
let dr = node.dynamic_range_db().unwrap();
assert!(dr > 90.0);
Source

pub fn dynamic_range_summary(&self) -> Option<DynamicRange>

Build a DynamicRange summary from this node’s fields.

Returns None if output_p1db_dbm is not set.

§Examples
use gainlineup::{Input, Block};

let input = Input::new(1.0e9, 1.0e6, -30.0, Some(270.0));
let lna = Block {
    name: "LNA".to_string(),
    gain_db: 20.0,
    noise_figure_db: 2.0,
    output_p1db_dbm: Some(10.0),
    output_ip3_dbm: Some(25.0),
};
let node = input.cascade_block(&lna);
let summary = node.dynamic_range_summary().unwrap();
assert!(summary.linear_dr_db > 90.0);
assert!(summary.sfdr_db.is_some());

Trait Implementations§

Source§

impl Clone for SignalNode

Source§

fn clone(&self) -> SignalNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SignalNode

Source§

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

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

impl Default for SignalNode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for SignalNode

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more