How it is built
Architecture overview
A sonar system listens to the sea, or pings it and listens for echoes, and turns the sound into tracks: a list of objects with bearing, estimated range, course and speed, and a class. It runs on ships, submarines, fixed arrays and autonomous vehicles (Thales 2087, AN/SQQ-89 and Kongsberg systems are examples). Water carries sound far better than it carries radio, so sonar is the main long-range sensor below the surface, but it is a hard sensor: sound speed changes with depth, temperature and salinity and bends the sound; the sea is noisy; and the only information in a passive system is often direction and frequency, not range.
Time-aligned samples from many hydrophones enter. A beamformer combines them to steer sensitivity in many directions at once, which gives bearing and gains signal-to-noise ratio. Per beam, a detector and a spectral analyser find signals: tonal lines of machinery and the periodic modulation of propeller noise in passive mode, echoes of a transmitted pulse in active mode. A tracker links detections over time into tracks; target motion analysis recovers range from bearings alone when the observer manoeuvres; and propagation models explain what the sea does to the sound so the operator knows what the system can and cannot hear.
The idea that makes it work is a chain of increasingly expensive questions asked of increasingly small data: raw samples to beams (cheap, regular, fast Fourier transform and filters), beams to detections (a threshold from local noise), detections to tracks (statistical estimation), tracks to decisions (classification, range). The pipeline is real time, and the only trustworthy time base is the sample count.
Parts:
- Acoustic environment model — predicts transmission loss and where sound goes —
acoustic-propagation-models(no page yet), Finite differences, Explicit Euler, Runge-Kutta 4,thomas-tridiagonal-solver(no page yet) - Acquisition and timing — hydrophone sampling, a common clock, buffers between threads — Clock synchronization, Phase-locked loop (digital), PID controller, SPSC ring buffer, Memory ordering, False sharing
- Beamforming and array geometry — turns channels into beams; corrects for array shape —
beamforming(no page yet),array-shape-estimation(no page yet), Fast Fourier transform, IIR and FIR filters,biquad-filters(no page yet), SIMD programming, spline-interpolation (no page yet) - Detection and spectral analysis — finds signals in noise and in modulation —
cfar-detection(no page yet),matched-filter-template-bank(no page yet), Short-time Fourier transform and spectrogram,envelope-modulation-spectrum-analysis(no page yet), Robust statistics - Tracking and motion analysis — links detections over time; recovers range from bearings — Multi-object tracking, Kalman filter, Extended Kalman filter,
interacting-multiple-model-filter(no page yet),target-motion-analysis(no page yet), Assignment problem (Hungarian / Jonker–Volgenant) - Own-ship navigation and fusion — heading, depth and position for beams and tracks —
sensor-fusion(no page yet),transform-tree(no page yet), Rigid-body transforms (SE(3) poses), Quaternion rotations - Classification — assigns a class to a track from its acoustic signature — Object detection, Convolutional networks, Data augmentation
- Recording and replay — stores raw and processed data for analysis — Time-series chunk storage, Gorilla XOR compression, Delta encoding, Time partitioning
sea ── sound ──► hydrophone array (N channels) ──ADC──► samples + sample clock
▲ │ ring buffer (per channel block)
│ ping (active) ▼
transmitter ◄── waveform heading / depth / GNSS ─► beamformer (FFT, weights, array shape)
│ │ B beams × time
│ ▼
│ per-beam processing
│ ┌──────────┴───────────┐
│ passive: LOFAR active: matched filter
│ DEMON (envelope) → range-bearing cells
│ │ CFAR threshold
▼ ▼
own-ship state ─► tracker (association, KF/EKF/IMM, TMA)
│ tracks (bearing, range?, class)
propagation model ─► detection range, coverage ─────────────┤
▼
classification, display, combat or survey system
recorder (raw + processed)
How the parts fit together
Acoustic environment model
acoustic-propagation-models (no page yet) predict transmission loss, the weakening of sound between a source and a receiver, from the sound-speed profile, the seabed and the surface. Three families cover most work (source: Jensen et al., Computational Ocean Acoustics):
- Ray and beam tracing follows paths of sound by integrating the ray equations step by step, which is an ODE problem solved with a method such as Explicit Euler or Runge-Kutta 4. Gaussian beam tracing (Porter and Bucker 1987) smooths the field behind caustics. It is fast and good for high frequency and deep water.
- Normal modes express the field as a sum of vertical standing waves, found by solving an eigenvalue problem over depth; good at low frequency in shallow water, where few modes carry the sound.
- Parabolic equation (PE) marches the field outward in range with a one-way approximation on a depth grid, using Finite differences and a
thomas-tridiagonal-solver(no page yet) for the implicit step; the split-step Padé solution of Collins is the common version. It handles range-dependent environments (slopes, fronts).
The Acoustics Toolbox (Bellhop for beams, Kraken for modes, Scooter and SPARC for wavenumber integration) and the PE codes, such as RAM, are published through the Ocean Acoustics Library (oalib-acoustics.org).
The models do not sit in the real-time chain; they feed it. The operator needs to know the blind zones a shadow zone creates, and the tracker needs a coverage estimate to judge what a missed detection means. The contract is a transmission-loss table by range, depth and bearing, produced on a slower cycle from the current sound-speed measurement. The sonar equation then turns loss into detection-probability maps.
Acquisition and timing
A passive array may carry tens to hundreds of hydrophones, each sampled at a rate set by the highest frequency of interest (order of kilohertz for towed arrays, higher for imaging sonar). Phase between channels is what the beamformer uses, so all channels need the same sample clock and a common time base across nodes. Clock synchronization estimates offsets from timestamp exchanges and filters queueing noise (the same estimation problem as in network time protocols), and the sample clock itself is held to a reference by a Phase-locked loop (digital) with a PID controller as its loop filter. Data timestamps are derived from a sample counter, not from the arrival time at the processor, because the arrival time carries scheduling jitter.
Between the acquisition thread and the DSP thread, a wait-free SPSC ring buffer passes blocks of samples with no locks; the correctness depends on Memory ordering (release on the producer's index, acquire on the consumer's), and throughput on avoiding False sharing between the producer and consumer indices (separate cache lines). A dropped block must show as a gap in the sample count, because a missing block shifts every downstream phase.
Beamforming and array geometry
beamforming (no page yet) delays and weights each channel so that sound arriving from a chosen direction adds coherently and sound from other directions averages out. Delay-and-sum is the base method; adaptive methods such as Capon's minimum-variance estimator (Capon 1969) place nulls on strong interferers at the price of more computation and sensitivity to errors in the array model (source: Van Trees, Optimum Array Processing). For a line array, spacing no more than half a wavelength avoids grating lobes at the design frequency. In the frequency domain, a Fast Fourier transform per channel is followed, per frequency bin, by a matrix product of channel spectra with steering weights, so many beams cost little more than one; windowing (Harris 1978) trades leakage for resolution. SIMD programming matters here because the inner loop is a complex multiply-accumulate over channels.
Band-limiting and decimation before the FFT use IIR and FIR filters; biquad-filters (no page yet) are the stable cascade form of IIR, while linear-phase FIR keeps phase between channels.
A towed array is not a straight line. Currents and ship turns bend it, and a bent array has the wrong delays: beams smear and bearings are wrong. array-shape-estimation (no page yet) uses heading sensors at points along the array, and cues in the signal itself, to estimate the array's shape and feed the corrected geometry into the beamformer; a nonlinear least-squares fit (Levenberg-Marquardt, levenberg-marquardt (no page yet)) is a standard way to fit shape parameters to measurements. A single line array also has a left-right ambiguity: a sound from the port side and its mirror on the starboard side give the same delays, which a ship turn or a triplet array resolves.
The delay needed to steer a beam is almost never a whole number of samples, so each channel must be read between samples. spline-interpolation (no page yet) fits a smooth piecewise cubic through neighbouring samples and evaluates it at the fractional time, which is much more accurate than rounding to the nearest sample or interpolating linearly, and cheap enough to run per channel and per beam. The same technique reconstructs the array's shape between the points where heading sensors measure it, since the bend of a towed array is smooth.
Detection and spectral analysis
Per beam, passive and active modes diverge.
Passive. Ships and submarines radiate narrowband tonals (rotating machinery) and broadband noise. LOFAR analysis shows frequency against time with the Short-time Fourier transform and spectrogram, where tonals appear as lines. DEMON analysis (envelope-modulation-spectrum-analysis (no page yet)) band-passes a high-frequency region, takes the envelope and runs a spectrum on it, which reveals the modulation by the propeller (shaft and blade rates) and thus a class cue. Lines are found by comparing each bin with its neighbours, and noise statistics need Robust statistics (median, MAD) because a loud line can bias a mean-based estimate of the noise floor.
Active. The transmitter sends a known waveform, such as a tone or a frequency sweep. matched-filter-template-bank (no page yet) correlates the received signal with the waveform (pulse compression), giving range resolution that depends on bandwidth rather than pulse length; a bank of templates with different Doppler shifts covers moving targets. The output over range and bearing is a grid of cells.
Both modes end in cfar-detection (no page yet): a constant-false-alarm-rate detector sets the threshold of each cell from the noise in neighbouring cells, so the false-alarm rate stays steady when the background changes with sea state or reverberation. Cell-averaging is the simplest, ordered-statistic variants resist interfering targets (Rohling 1983).
Tracking and motion analysis
Detections become tracks through Multi-object tracking: predict each track forward with a Kalman filter, gate the new detections, solve the association with the Assignment problem (Hungarian / Jonker–Volgenant), update, and start or drop tracks by rules on hits and misses. Active sonar gives range and bearing, so a Cartesian filter works. Passive sonar gives bearing only, which is the hard case.
target-motion-analysis (no page yet) recovers range, course and speed from a time series of bearings. A single observer on a straight path cannot determine range: many target motions give identical bearings. Observability requires an observer manoeuvre or a second sensor (Nardone and Aidala 1981). The estimator is nonlinear, so the Extended Kalman filter is used with care; a filter in modified polar coordinates keeps the unobservable range part from corrupting the rest (Aidala and Hammel 1983). A target that manoeuvres breaks a single motion model, so interacting-multiple-model-filter (no page yet) runs several models (straight, turning) in parallel and mixes them by a probability that is updated each step (Blom and Bar-Shalom 1988).
Own-ship navigation and fusion
Beams are relative to the array, tracks are in the world frame. sensor-fusion (no page yet) combines the ship's heading, speed, depth and position sensors; transform-tree (no page yet) holds the frames (array element, array, hull, world) with timed transforms, so a bearing measured at one moment is converted to a world bearing using the pose at that moment. Rigid-body transforms (SE(3) poses) and Quaternion rotations are the representation; interpolation between navigation samples matters because navigation updates are slower than sonar frames.
Classification
Features of a track (line frequencies, modulation rates, spectrogram patterns) feed a classifier. Image-like inputs such as spectrograms suit Convolutional networks; the detection stage of an Object detection network, with Non-maximum suppression, localises patterns in a time-frequency picture. Training data are scarce, so Data augmentation (time shifts, noise mixing) is standard.
Recording and replay
Sonar systems record raw samples for later reanalysis and processed beam data for review. Series are append-only, so Time-series chunk storage fits: immutable compressed chunks with a time index. Delta encoding and Gorilla XOR compression shrink timestamps and slowly changing values (heading, depth); Time partitioning lets old data be dropped or archived by whole partition. Replay of recordings is the main way to test the chain on known data.
Data and control flow
One passive processing cycle:
- The ADC delivers a block of samples per channel with a sample-count timestamp; the acquisition thread writes it to the ring buffer.
- The DSP thread reads the block, band-limits and decimates, windows, and runs an FFT per channel.
- Using the current array shape and own-ship heading, it forms B beams per frequency bin; output is a beam-by-frequency spectrum per block.
- LOFAR integrates the spectra into a time-frequency picture per beam; lines are detected against a robust noise estimate. DEMON extracts modulation spectra in selected bands.
- Detections (beam, time, frequency, level) go to the tracker; each detection is associated with a track or starts a tentative one.
- The tracker updates bearing tracks; if the observer manoeuvres, a motion-analysis estimator runs on the bearing history to produce range, course and speed with a covariance.
- The display and recorder receive tracks and the beam data. Time goes mostly to the beamformer and FFTs at steps 2 and 3; the tracker is light by comparison.
One active ping:
- A transmitter sends a waveform at a known time; the system records the transmit time against the sample counter.
- Receive channels are beamformed and matched-filtered; the output is a range-bearing grid.
- CFAR picks cells above the local noise; clusters become detections.
- Detections go to the tracker; echoes are gated using the previous ping's tracks and the own-ship motion between pings.
- The ping interval is set by the maximum range of interest: a distant echo must return before the next transmission.
Scaling
In the order the limits appear:
- Beam count and channel count: the beamformer cost grows with channels × beams × bins; move to frequency-domain beamforming, share work across beams, use SIMD, and offload to a GPU or FPGA when the load exceeds a core.
- Memory traffic: keep blocks in cache (CPU caches and the memory hierarchy) and process by block, not by sample.
- Timing: more nodes make the time base harder; discipline sample clocks with a PLL and stamp from the sample counter.
- Tracking load: many contacts in clutter make association costly; gate first, solve the assignment on the gated set only, and keep only the strongest detections per beam (Top-k selection).
- Model fidelity: range-dependent PE and 3-D models are expensive; run them on a slow cycle and cache by environment state.
- Storage: raw data grow fastest; compress, partition by time, keep processed data longer than raw.
Failure modes
| Failure | Symptom | Cause | Fix |
|---|---|---|---|
| Wrong bearings in a turn | Contacts smear or jump during a manoeuvre | Array bent, shape not estimated; heading sensors lagging | Array shape estimation, sensor timing, hold bearings during a turn |
| Left-right ambiguity unresolved | Mirror contacts | Line array, no maneuver or second array | Resolve with a turn or a triplet array; show both until resolved |
| False alarms rise suddenly | Display full of detections | CFAR window contaminated by strong lines or reverberation | Ordered-statistic CFAR, guard cells |
| Missing contacts at range | Targets seen only close | Shadow zone, stale sound-speed profile | Refresh the profile; rerun the propagation model |
| Range estimate diverges | Range tracks wander | No observer manoeuvre; filter not consistent for bearings-only | Require manoeuvre; use modified polar coordinates; check filter consistency |
| Phase errors between channels | Beam pattern distorted | Clock drift or dropped sample blocks | Gap detection on the sample counter; PLL to reference |
Real implementations
| name | what it is | repo | licence | notes |
|---|---|---|---|---|
| Acoustics Toolbox / Bellhop | ray and Gaussian-beam model (Bellhop), normal modes (Kraken), wavenumber integration (Scooter, SPARC) | oalib-acoustics.org | — | the reference public propagation models |
| Bellhop (maintained mirror) | Fortran Bellhop with bug fixes | A-New-BellHope/bellhop | GPL-3.0 | mirror of the original |
| UnderwaterAcoustics.jl | Julia toolbox for underwater acoustic modelling | org-arl/UnderwaterAcoustics.jl | MIT | pairs with the Julia wrapper below |
| AcousticsToolbox.jl | Julia wrapper for Bellhop, Kraken and others | org-arl/AcousticsToolbox.jl | MIT | model access from Julia |
| arlpy | Python tools for acoustic signal processing and modelling | org-arl/arlpy | BSD-3-Clause | analysis and prototyping |
| PAMGuard | detection, classification and localisation of marine-mammal and other bioacoustic signals | PAMGuard/PAMGuard | GPL-3.0 | open passive acoustic pipeline |
Naval combat-system sonars are proprietary. The same chain of array, detector and tracker appears in Radar signal processing and tracking.
Sources
- F. B. Jensen, W. A. Kuperman, M. B. Porter and H. Schmidt, Computational Ocean Acoustics, Springer, 2nd ed. 2011. book
- M. B. Porter and H. P. Bucker, Gaussian beam tracing for computing ocean acoustic fields, J. Acoust. Soc. Am. 1987. paper
- M. D. Collins, A split-step Padé solution for the parabolic equation method, J. Acoust. Soc. Am. 1993. paper
- H. L. Van Trees, Optimum Array Processing, Wiley, 2002. book
- J. Capon, High-resolution frequency-wavenumber spectrum analysis, Proc. IEEE 1969. paper
- F. J. Harris, On the use of windows for harmonic analysis with the discrete Fourier transform, Proc. IEEE 1978. paper
- H. Rohling, Radar CFAR thresholding in clutter and multiple target situations, IEEE Trans. AES 1983. paper
- S. C. Nardone and V. J. Aidala, Observability criteria for bearings-only target motion analysis, IEEE Trans. AES 1981. paper
- V. J. Aidala and S. E. Hammel, Utilization of modified polar coordinates for bearings-only tracking, IEEE Trans. Automatic Control 1983. paper
- H. A. P. Blom and Y. Bar-Shalom, The interacting multiple model algorithm for systems with Markovian switching coefficients, IEEE Trans. Automatic Control 1988. paper
- Ocean Acoustics Library: oalib-acoustics.org