Engee documentation
Notebook

How to calculate the reliability of communication at low frequencies

This example simulates the key parameters of a satellite communication system and calculates two important indicators: the budget of the communication line and the probability of signal detection. Following the steps of this code, you will be able to:

  • Calculate the signal loss on the track, taking into account the geometry (inclined range, radio horizon), atmosphere and fading.
  • Evaluate the signal-to-noise ratio (SNR) at the receiver input.
  • Actually predict the probability of successful signal reception in noise conditions, which is the basis for any real communication and radar systems.

This example is an excellent practical illustration of such fundamental topics as the Friis equation, the radar equation, and the theory of signal detection.

Detailed code analysis

1. The geometry of the Earth and atmospheric refraction

  • R_earth = 6371.0 — the average radius of the Earth (≈6371 km) is used, the standard value in satellite calculations.
  • R_equiv = 8500.0 — the effective radius of the Earth is introduced (4/3 R_earth) ≈ 8,500 km . Correction of refraction in a standard atmosphere (ITU-R P.310-9) is critical for estimating the curvature of the radio wave propagation path.
  • D_horizon calculated using the Pythagorean Theorem: √((R+h)² - R²) — an exact geometric expression for the length of the segment tangent to the Earth's circumference coming from a point at an altitude of h. Summing the horizons of the transmitter and receiver gives the range of direct radio visibility.
  • D_slant — oblique range according to the cosine theorem: √(R₁² + R₂² - 2·R₁·R₂·cos θ₀) — a key parameter for the following loss calculations.
In [ ]:
using SpecialFunctions

R_earth = 6371.0
R_equiv = 8500.0
f_MHz = 49.0
P_tx_W = 100.0
Δf_MHz = 0.025
Δf_Hz = Δf_MHz * 1e6

φN = 0.965167; λN = 1.448623; ΔhN0 = 0.162; h_ant_tx = 0.016; h_tx = ΔhN0 + h_ant_tx
φM = 0.0; λM = 1.666789; ΔhM = 0.0

G_tx_dBi = 22.0
G_rx_dBi = 35.0
NF_dB = 3.0
pfa = 1e-5
T0 = 290.0

θ0 = 0.981489
h_rx = 36423.578;
In [ ]:
D_surface = R_earth * θ0
println("Range over the Earth's surface: $(round(D_surface, digits=1)) km")
Range over the Earth's surface: 6253.1 km
In [ ]:
D_horizon_rx = sqrt((R_equiv + h_rx)^2 - R_equiv^2)
D_horizon_tx = sqrt((R_equiv + h_tx)^2 - R_equiv^2)
D_radio_vis = D_horizon_rx + D_horizon_tx
println("Range of direct radio visibility: $(round(D_radi_vis, digits=1)) km")
Range of direct radio visibility: 44167.1 km
In [ ]:
R_tx = R_earth + h_tx
R_rx = R_earth + h_rx
D_slant = sqrt(R_tx^2 + R_rx^2 - 2*R_tx*R_rx*cos(θ0))
println("Inclined range: $(round(D_slant, digits=1)) km")
Inclined range: 39609.3 km

2. Calculation of the Link Budget

  • Free Space Path Loss (FSPL): L_fs = 32.45 + 20·log10(D_slant) + 20·log10(f_MHz) — a widely used form of the Friis equation in engineering. The constant is 32.45 at D_slant [км] and f_MHz — reference basis for all subsequent calculations (ITU-R P.525).
  • Total losses: The models include L_atm, L_rain, L_fading, L_pol.
  • Receiver input power: Basic power balance equation: P_rx = P_tx + G_tx + G_rx - L_total.
  • Thermal noise power: Calculated using the Nyquist formula: N = 10·log10(k·T0·Δf) with the Boltzmann constant k = 1.38·10-23 J/K. Adding a noise factor NF (in dB) gives the full power of the receiver output noise.
  • SNR: Corresponds to the result of the budget calculation.
In [ ]:
L_fs = 32.45 + 20*log10(D_slant) + 20*log10(f_MHz)
println("Attenuation in free space: $(round(L_fs, digits=2)) dB")
Attenuation in free space: 158.21 dB
In [ ]:
L_atm = 0.02
L_rain = 0.0
L_fading = 3.0
L_pol = 3.0
L_add = L_atm + L_rain

L_total = L_fs + L_add + L_fading + L_pol
println("Atmospheric/rain losses: $(round(L_add, digits=2)) dB")
println("Fading margin: $(L_fading) dB")
println("Polarization Loss: $(L_pol) dB")
println("Total loss (L_total): $(round(L_total, digits=2)) dB")
Atmospheric/rain loss: 0.02 dB
Fading margin: 3.0 dB
Polarization losses: 3.0 dB
Total Loss (L_total): 164.23 dB
In [ ]:
P_tx_dBW = 10*log10(P_tx_W)
P_rx_dBW = P_tx_dBW + G_tx_dBi + G_rx_dBi - L_total
println("Receiver input power: $(round(P_rx_dBW, digits=2)) dBW")
Receiver input power: -87.23 dBW
In [ ]:
N_thermal_dBW_Hz = 10*log10(1.38e-23 * T0)
N_total_dBW = N_thermal_dBW_Hz + NF_dB + 10*log10(Δf_Hz)
println("Thermal noise power: $(round(N_total_dBW, digits=2)) dBW")
Thermal noise power: -157.0 dBW
In [ ]:
T_sys = T0 * 10^(NF_dB / 10)
G_over_T = G_rx_dBi - 10*log10(T_sys)
println("T_sys system noise temperature: $(round(T_sys, digits=1)) K")
println("Gain to noise ratio G/T: $(round(G_over_T, digits=2)) dB/K")
T_sys system noise temperature: 578.6 K
Gain-to-noise ratio G/T: 7.38 dB/K
In [ ]:
SNR_dB = P_rx_dBW - N_total_dBW
SNR_lin = 10^(SNR_dB / 10)
println("SNR: $(round(SNR_dB, digits=2)) dB (linear: $(round(SNR_lin, digits=2)))")
SNR: 69.77 dB (linear: 9.47974362e6)

3. Analysis of signal detection in noise (Detection Theory)

3.1. Calculation of the detection threshold based on a given false alarm probability (P_fa)
Doorstep Q_fa it is set using the formula: Q_fa = √(-2·ln(P_fa)). This is an exact solution to the integral of the tail of a normal distribution, which is a standard method for calculating the threshold for detecting a signal in Gaussian noise using the Neiman-Pearson criterion. By P_fa = 10⁻⁵ we get the threshold Q_fa ≈ 4,7985 — that's correct.

3.2. Calculating the probability of correct detection (P_d)
The probability of detection for a non-fluctuating (Swerling 0) signal in Gaussian noise is calculated using the Marcum Q-function, which reduces to an additional error function erfc: P_d = 0,5·erfc( (Q_fa - √(2·SNR_lin)) / √2 ). This approach is the basic one for modeling a "hard" solution ("signal present/absent") and is described in the classical literature (Skolnik, Van Trees).

In [ ]:
Q_fa = sqrt(-2 * log(pfa))
arg = (Q_fa - sqrt(2 * SNR_lin)) / sqrt(2)
P_d = clamp(0.5 * erfc(arg), 0.0, 1.0)
println("Q_fa threshold: $(round(Q_fa, digits=4))")
println("Probability of detecting P_d: $(round(P_d, digits=6))")
Q_fa Threshold: 4.7985
Probability of detecting P_d: 1.0
In [ ]:
f2_MHz = 50.0
L_fs2 = 32.45 + 20*log10(D_slant) + 20*log10(f2_MHz)
L_total2 = L_fs2 + L_add + L_fading + L_pol
P_rx_dBW2 = P_tx_dBW + G_tx_dBi + G_rx_dBi - L_total2
SNR_dB2 = P_rx_dBW2 - N_total_dBW
SNR_lin2 = 10^(SNR_dB2 / 10)
arg2 = (Q_fa - sqrt(2 * SNR_lin2)) / sqrt(2)
P_d2 = clamp(0.5 * erfc(arg2), 0.0, 1.0)

println("\Presults for frequency $(f2_MHz) MHz")
println("SNR: $(round(SNR_dB2, digits=2)) dB")
println("Probability of detection: $(round(P_d2, digits=6))")
Results for frequency 50.0 MHz
SNR: 69.59 dB
Probability of detection: 1.0
In [ ]:
println("\nThe conclusion")
if P_d > 0.999
    println("The signal is stable, P_d ≈ 1.0")
elseif P_d > 0.9
    println("The signal is stable, P_d = $(round(P_d, digits=3))")
else
    println("The probability of detection is insufficient: P_d = $(round(P_d, digits=3))")
end
println("Total loss: $(round(L_total, digits=2)) dB")
println("Noises: $(round(N_total_dBW, digits=2)) dBW")
println("Theory: Link Budget (ITU-R), Detection Theory (Skolnik, Van Trees)")
conclusion
The signal is stable, P_d ≈ 1.0
Total loss: 164.23 dB
Noise: -157.0 dBW
Theory: Link Budget (ITU-R), Detection Theory (Skolnik, Van Trees)
In [ ]:
results = Dict(
    "SNR_dB" => round(SNR_dB, digits=2),
    "P_d" => P_d,
    "P_rx_dBW" => round(P_rx_dBW, digits=2),
    "L_total" => round(L_total, digits=2),
    "G_over_T_dB_per_K" => round(G_over_T, digits=2),
    "Frequency_MHz" => f_MHz
)
println("\Nstructured results: ", results)
Структурированные результаты: Dict("L_total" => 164.23, "SNR_dB" => 69.77, "G_over_T_dB_per_K" => 7.38, "P_d" => 1.0, "Frequency_MHz" => 49.0, "P_rx_dBW" => -87.23)

Conclusion

In this example, we have implemented a rigorous scientific approach to evaluating a real communication channel.:

  • Calculation of the geometry of the route, taking into account the sphericity of the Earth and refraction.
  • The full energy budget of the line (Link Budget) according to the Friis-ITU model.
  • Evaluation of the reception quality in noise (thermodynamics + noise coefficient).
  • Mathematically correct prediction of communication reliability based on a probabilistic model (statistical detection theory).
  • Checking the sensitivity of the system to frequency changes (50 MHz).

The code demonstrates how classical formulas of radio engineering and communication theory are transformed into a working tool for calculating system reliability. It can be used as a base for more complex models, including the effects of interference, modulation types, and encoding.