Skip to main content

lib_jsl_electromagnetics/propagation/
radar_equation.rs

1//! The radar range equation and basic radar relations.
2//!
3//! See the book entry [Propagation](https://jwkunz.github.io/lib_jsl/book/em-waves/propagation.html).
4
5use lib_jsl_core::ErrorsJSL;
6use lib_jsl_core::constants::em::C0;
7use lib_jsl_core::constants::physics::K_B;
8use std::f64::consts::PI;
9
10/// Parameters of a monostatic radar (linear units unless noted).
11#[derive(Debug, Clone, Copy, PartialEq)]
12pub struct Radar {
13    /// Peak transmit power (W).
14    pub transmit_power: f64,
15    /// Transmit and receive antenna gain (the same antenna).
16    pub gain: f64,
17    pub frequency: f64,
18    /// Receiver noise bandwidth (Hz).
19    pub bandwidth: f64,
20    /// Receiver noise figure (linear).
21    pub noise_figure: f64,
22    /// System losses (linear, ≥ 1).
23    pub losses: f64,
24    /// Reference noise temperature (K), normally 290.
25    pub noise_temperature: f64,
26}
27
28impl Radar {
29    pub fn wavelength(&self) -> f64 {
30        C0 / self.frequency
31    }
32
33    /// The echo power `P_t G² λ² σ / ((4π)³ R⁴ L)` from a target of cross-section `rcs` (m²) at
34    /// range `range` (m).
35    pub fn received_power(&self, rcs: f64, range: f64) -> f64 {
36        self.transmit_power * self.gain * self.gain * self.wavelength().powi(2) * rcs / ((4.0 * PI).powi(3) * range.powi(4) * self.losses)
37    }
38
39    /// The receiver noise power `k T B F`.
40    pub fn noise_power(&self) -> f64 {
41        K_B * self.noise_temperature * self.bandwidth * self.noise_figure
42    }
43
44    /// The single-pulse signal-to-noise ratio (linear).
45    pub fn snr(&self, rcs: f64, range: f64) -> f64 {
46        self.received_power(rcs, range) / self.noise_power()
47    }
48
49    /// The SNR after integrating `pulses` pulses coherently (gain `n`).
50    pub fn coherent_snr(&self, rcs: f64, range: f64, pulses: usize) -> f64 {
51        pulses as f64 * self.snr(rcs, range)
52    }
53
54    /// The maximum range at which the SNR (after an integration gain) reaches `required_snr`:
55    /// `R = (P_t G² λ² σ g / ((4π)³ k T B F L SNR))^{1/4}`.
56    pub fn maximum_range(&self, rcs: f64, required_snr: f64, integration_gain: f64) -> Result<f64, ErrorsJSL> {
57        if !(required_snr > 0.0) || !(rcs > 0.0) || !(integration_gain > 0.0) {
58            return Err(ErrorsJSL::InvalidInputRange("Need a positive RCS, required SNR and integration gain."));
59        }
60        Ok((self.received_power(rcs, 1.0) * integration_gain / (self.noise_power() * required_snr)).powf(0.25))
61    }
62}
63
64/// The bistatic echo power `P_t G_t G_r λ² σ_b / ((4π)³ R_t² R_r² L)`.
65#[allow(clippy::too_many_arguments)]
66pub fn bistatic_received_power(transmit_power: f64, gt: f64, gr: f64, frequency: f64, rcs: f64, rt: f64, rr: f64, losses: f64) -> f64 {
67    let lambda = C0 / frequency;
68    transmit_power * gt * gr * lambda * lambda * rcs / ((4.0 * PI).powi(3) * rt * rt * rr * rr * losses)
69}
70
71/// The range resolution `c / (2B)` of a waveform of bandwidth `B`.
72pub fn range_resolution(bandwidth: f64) -> f64 {
73    C0 / (2.0 * bandwidth)
74}
75
76/// The maximum unambiguous range `c / (2 PRF)`.
77pub fn unambiguous_range(prf: f64) -> f64 {
78    C0 / (2.0 * prf)
79}
80
81/// The Doppler shift `2 v / λ` of a target closing at radial speed `v` (m/s).
82pub fn doppler_shift(radial_velocity: f64, frequency: f64) -> f64 {
83    2.0 * radial_velocity * frequency / C0
84}
85
86/// The radar horizon (m) for antenna height `h` over a smooth earth with the standard 4/3
87/// effective radius: `√(2 k_e R_E h)`.
88pub fn radar_horizon(height: f64) -> f64 {
89    (2.0 * 4.0 / 3.0 * 6.371e6 * height).sqrt()
90}
91
92/// The radar cross-section of a perfectly conducting sphere of radius `a` in the optical region
93/// (`a ≫ λ`): `πa²`.
94pub fn sphere_rcs_optical(radius: f64) -> f64 {
95    PI * radius * radius
96}
97
98/// The peak radar cross-section of a flat conducting plate of area `A` at normal incidence:
99/// `4πA²/λ²`.
100pub fn flat_plate_rcs(area: f64, frequency: f64) -> f64 {
101    let lambda = C0 / frequency;
102    4.0 * PI * area * area / (lambda * lambda)
103}
104
105#[cfg(test)]
106mod tests {
107    use super::*;
108
109    fn radar() -> Radar {
110        Radar { transmit_power: 1e6, gain: 10f64.powf(3.5), frequency: 3e9, bandwidth: 1e6, noise_figure: 10f64.powf(0.3), losses: 10f64.powf(0.5), noise_temperature: 290.0 }
111    }
112
113    #[test]
114    fn range_equation_scales_and_inverts() {
115        let r = radar();
116        let snr = r.snr(1.0, 50e3);
117        // Fourth-power law, and the maximum range inverts the SNR.
118        assert!((r.snr(1.0, 100e3) * 16.0 / snr - 1.0).abs() < 1e-12);
119        let rmax = r.maximum_range(1.0, snr, 1.0).unwrap();
120        assert!((rmax - 50e3).abs() < 1e-6);
121        // Ten coherent pulses extend the range by 10^{1/4}.
122        assert!((r.maximum_range(1.0, snr, 10.0).unwrap() / rmax - 10f64.powf(0.25)).abs() < 1e-12);
123        assert!((r.coherent_snr(1.0, 50e3, 10) - 10.0 * snr).abs() < 1e-9 * snr);
124        assert!((r.noise_power() - K_B * 290.0 * 1e6 * 10f64.powf(0.3)).abs() < 1e-30);
125        // Monostatic is the bistatic case with coincident antennas.
126        let b = bistatic_received_power(r.transmit_power, r.gain, r.gain, r.frequency, 1.0, 50e3, 50e3, r.losses);
127        assert!((b / r.received_power(1.0, 50e3) - 1.0).abs() < 1e-12);
128        assert!(r.maximum_range(1.0, 0.0, 1.0).is_err());
129    }
130
131    #[test]
132    fn waveform_relations() {
133        assert!((range_resolution(150e6) - 0.999_308_2).abs() < 1e-6);
134        assert!((unambiguous_range(1e3) - 149_896.229).abs() < 1e-3);
135        assert!((doppler_shift(300.0, 10e9) - 20_013.8).abs() < 0.1);
136        assert!((radar_horizon(10.0) / 1000.0 - 13.03).abs() < 0.01);
137        assert!((sphere_rcs_optical(1.0) - PI).abs() < 1e-15);
138        assert!(flat_plate_rcs(1.0, 10e9) > 1000.0);
139    }
140}