Controls
Presets
Parameters
Model checks
The science
The link. Two optical ground stations exchange BB84 quantum key distribution over a horizontal path of several kilometres at 810 nm. Alice sends weak laser pulses (mean photon number μ), Bob counts them with single-photon detectors behind a narrow filter. Everything that makes the key rate drop comes from five steps in the physics below, each computed from a formula, not a lookup table.
Diffraction and turbulence. A collimated Gaussian beam spreads as W(L) = w0√(1 + (L/zR)²), zR = πw0²/λ. Air with refractive-index structure constant Cn² (Kolmogorov spectrum 0.033 Cn² κ-11/3) adds the Fried parameter r0 = (0.423 k² Cn² L)-3/5, the Rytov variance σR² = 1.23 Cn² k7/6 L11/6, extra beam breathing WLT² = W²(1 + 1.63 σR12/5 Λ) and a random displacement of the whole beam with variance 〈rc²〉 = 2.42 Cn² L³ w0-1/3 (Andrews and Phillips). The simulation draws the centroid from an Ornstein-Uhlenbeck process (correlation time 50 ms) and the intensity from a log-normal process with the aperture-averaged scintillation index (10 ms).
Collection and background. The power that lands in a circular aperture is an exact integral of the Gaussian spot over the disc (a Rician kernel); the average over wander uses the Rayleigh law of the centroid offset. Background clicks come from the sky radiance Ls seen through the field of view Ω and the filter bandwidth: nb = ηdet Ls Ω A Δλ λ/(hc) plus 100 dark counts per second, so daylight raises the error floor, and a narrow field of view cures it.
Key rate. With yields from loss and background, the secret fraction is R = frep · ½ · { -Qμ f h2(Eμ) + Q1[1 - h2(e1)] } with the single-photon share Q1 = Y1 μ e-μ (GLLP), reconciliation inefficiency f = 1.16 and basis sifting ½. The rate vanishes near a 11 % error rate.
What the checks compare. (1) The width from a numerical angular-spectrum (FFT) propagation against the closed-form w(L). (2) The Kolmogorov structure function, integrated numerically with a Bessel kernel, against its value 6.88 at r0. (3) The aperture integral against 1 - exp(-2a²/W²) and the large-aperture limit. (4) A Monte Carlo of random beam positions against the Rayleigh quadrature. (5) The 11 % error threshold by bisection and from the rate formula. (6) A pulse-by-pulse Monte Carlo of the error rate against the analytic Eμ.
Simplifications. Constant Cn² along the path, weak-turbulence formulas used also at larger Rytov variance (flagged in the readout), plane-wave r0, no inner scale, no pointing-system correction, no finite-key penalty, no decoy-state bounds (the single-photon yield is taken as known, which a real system must estimate with decoy states), a detector without afterpulsing or dead time, and a 3D scene whose 60 m gap and beam thickness are scaled for visibility. Numbers are for teaching and are not a link budget for a real installation.