pub struct Input {
pub frequency_hz: f64,
pub bandwidth_hz: f64,
pub power_dbm: f64,
pub noise_temperature_k: Option<f64>,
}Expand description
The input signal that enters the RF cascade.
§Examples
use gainlineup::Input;
// 1 GHz signal at -30 dBm with 10 MHz bandwidth
let input = Input::new(1.0e9, 10.0e6, -30.0, Some(290.0));
assert_eq!(input.power_dbm, -30.0);
// Using struct literal
let input = Input {
frequency_hz: 1.0e9,
bandwidth_hz: 1.0e6,
power_dbm: -50.0,
noise_temperature_k: Some(270.0),
};Fields§
§frequency_hz: f64Center frequency of the input signal in Hz.
bandwidth_hz: f64Bandwidth of the input signal in Hz.
power_dbm: f64Input signal power in dBm.
noise_temperature_k: Option<f64>Noise temperature of the input in Kelvin (defaults to 270 K if None).
Implementations§
Source§impl Input
impl Input
Sourcepub fn new(
frequency_hz: f64,
bandwidth_hz: f64,
power_dbm: f64,
noise_temperature_k: Option<f64>,
) -> Input
pub fn new( frequency_hz: f64, bandwidth_hz: f64, power_dbm: f64, noise_temperature_k: Option<f64>, ) -> Input
Create a new input signal.
§Examples
use gainlineup::Input;
let input = Input::new(2.4e9, 20.0e6, -40.0, Some(290.0));
assert_eq!(input.frequency_hz, 2.4e9);
assert_eq!(input.bandwidth_hz, 20.0e6);Sourcepub fn noise_spectral_density(&self) -> f64
pub fn noise_spectral_density(&self) -> f64
Noise spectral density in dBm/Hz.
§Examples
use gainlineup::Input;
let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let nsd = input.noise_spectral_density();
assert!((nsd - (-174.0)).abs() < 0.1); // ~-174 dBm/Hz at 290 KSourcepub fn noise_power(&self) -> f64
pub fn noise_power(&self) -> f64
Input noise power in dBm (kTB thermal noise).
§Examples
use gainlineup::Input;
let input = Input::new(1.0e9, 1.0e6, -30.0, Some(290.0));
let noise = input.noise_power();
// kTB at 290K, 1 MHz ≈ -114 dBm
assert!((noise - (-114.0)).abs() < 0.1);Sourcepub fn cascade_block(&self, block: &Block) -> SignalNode
pub fn cascade_block(&self, block: &Block) -> SignalNode
Cascade the input signal through a block, producing a 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: 1.5,
output_p1db_dbm: None,
output_ip3_dbm: None,
};
let output = input.cascade_block(&lna);
assert_eq!(output.signal_power_dbm, 0.0); // -30 + 30 = 0 dBm
assert_eq!(output.name, "LNA Output");Trait Implementations§
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more