← Back
Home › Systems › Defense and aerospace

sonar-system

Detects, bearings and tracks objects underwater by processing hydrophone array signals, with acoustic propagation models to predict range and tracking filters to estimate target motion.

Thales 2087, Lockheed AN/SQQ-89, Kongsberg

Open the sonar-system pagesonar-system Array shape estimationcontrol: Estimate sensor array shape from heading sensors and signal-derived cues to correct beamformingTarget motion analysiscontrol: Bearings-only estimation of target range, course and speed with manoeuvring observerClock synchronizationdistributed: Estimate a clock's offset from four timestamps, filter out queueing noise, and steer the clock smoothly; NTP gets about a millisecond, PTP with hardware timestamps under a microsecond.›Assignment problem (Hungarian /Jonker–Volgenant)graphs: Optimal one-to-one matching of rows to columns in O(n³) by growing a matching along shortest augmenting paths over dual potentials.›Multi-object trackingmachine-learning: Turn per-frame detections (camera boxes or radar plots) into persistent IDs by predicting each track, gating, assigning and managing track births and deaths.›Convolutional networksml-training: Layers that slide a small shared kernel over a grid, giving translation equivariance and few parameters; still the most compute-efficient choice for many vision tasks.›Fast Fourier transformnumerics: Computes the DFT in O(n log n) by recursively splitting into even and odd halves; the basis of fast convolution and spectral methods.›Levenberg marquardtnumerics: Damped Gauss-Newton nonlinear least squares for model calibrationSpline interpolationnumerics: Linear, bilinear/trilinear and cubic spline interpolation on grids and tablesAcoustic propagation modelsphysics: Predict sound transmission loss by ray tracing, normal modes or parabolic equation over a sound-speed profileExtended Kalman filterrobotics: Kalman filter for nonlinear motion and measurement models: linearize f and h with Jacobians at the current estimate each step. The default estimator in robot navigation.›Interacting multiple modelfilterrobotics: IMM filter mixing several motion models for maneuvering targetsKalman filterrobotics: Optimal recursive estimator for a linear system with Gaussian noise: fuses a motion model with noisy measurements into a state estimate plus its covariance.›Sensor fusionrobotics: Combining IMU, GNSS, camera, lidar and radar estimates with Kalman-type filters and time alignmentBeamformingsignal-processing: Phased-array weights that steer radio energy toward a receiver; per-client steering vectorsCfar detectionsignal-processing: Constant false alarm rate detector: set the threshold from a noise estimate of neighbouring cells (CA, OS, GO/SO-CFAR)Envelope modulation spectrumanalysissignal-processing: Narrowband spectral analysis plus demodulated envelope spectrum (DEMON) to find periodic modulation linesIIR and FIR filterssignal-processing: Two ways to shape a sampled signal's spectrum: FIR (finite taps, always stable, exact linear phase) or IIR (feedback, a few coefficients, cheap but phase-distorting).›Matched filter template banksignal-processing: Correlate data against waveform templates with SNR thresholds; template bank covers parameter space, also pulse compressionShort-time Fourier transformand spectrogramsignal-processing: Slide a window over a signal and FFT each frame to get a time-frequency picture; the front end of audio ML, vibration and radar analysis.›Time-series chunk storagestorage: Store each series as immutable compressed chunks of consecutive samples behind a small time index; a range query decodes only the chunks that overlap it.›PID controllerrobotics: Drive a measured value to a setpoint with three terms on the error: proportional, integral, derivative. The default feedback loop for motors, heaters, drones and gimbals.›Phase-locked loop (digital)signal-processing: Feedback loop that locks a local oscillator to the phase and frequency of an input tone; the core of carrier recovery, clock recovery and GNSS tracking.›Robust statisticsstatistics: Location and scale estimates (median, MAD, trimmed mean, Huber M-estimator) that stay correct when a minority of the data is garbage.›d-ary heapdata-structures: Array heap with d children per node (d = 4 typical): half the binary heap's depth, siblings in one cache line, faster priority queues.›Dijkstra's algorithmgraphs: Single-source shortest paths with non-negative edge weights by settling vertices in order of distance with a priority queue.›Non-maximum suppressionmachine-learning: Keep the best-scoring candidate in each neighbourhood and drop the rest; greedy NMS, Soft-NMS and 1-D peak picking share one loop.›Object detectionmachine-learning: A network turns an image into scored, classified boxes in one pass; anchor-based, anchor-free and set-prediction heads differ in how they assign labels and remove duplicates.›Finite differencesnumerics: Replace derivatives with weighted differences of grid values; simple stencils plus a stability condition (CFL) turn PDEs like heat, advection and waves into array loops.›LU and Cholesky factorizationnumerics: Factor A = PLU (any square matrix, partial pivoting) or A = LLᵀ (SPD) once in O(n³), then solve each right-hand side in O(n²).›SPSC ring bufferdata-structures: Bounded wait-free queue for exactly one producer and one consumer thread, built from an array and two indices with acquire/release ordering.›Complementary filterrobotics: Blend high-passed gyro integration with low-passed accelerometer/magnetometer attitude (Mahony/Madgwick)Transform treerobotics: Time-indexed tree of coordinate frames with interpolated lookups between any two frames+ 5 moreData augmentationmachine-learning: Generate label-preserving variants of each training example on the fly to enlarge the effective dataset and bake in invariances.›Loss functionsmachine-learning: The scalar a model minimizes: cross-entropy for classes and tokens, MSE or Huber for values, each with a stable form and simple gradient.›Explicit Eulernumerics: Step an ODE forward by its current slope, y += h·f(t, y); first-order, one evaluation per step, the baseline every other integrator is measured against.›Thomas tridiagonal solvernumerics: O(n) tridiagonal linear solve used in implicit finite-difference and spline schemesFalse sharingconcurrency: Independent variables written by different cores on one cache line force the line to bounce between cores; pad or regroup hot data to fix it.›Memory orderingconcurrency: What Relaxed, Acquire, Release and SeqCst atomics actually guarantee, what they cost on x86 and ARM, and which one each pattern needs.›Quaternion rotationsgeometry: Unit quaternions as 3D rotations: 4 floats, cheap composition, no gimbal lock, plus the conversions, interpolation choices and numerical care needed in practice.›Lowest common ancestorgraphs: LCA/merge-base computation in trees and DAGsRigid-body transforms (SE(3)poses)robotics: Represent, compose, invert, integrate and interpolate 3D poses as unit quaternion plus translation, with exp/log maps for small motions and uncertainty.›+ 5 moreCPU caches and the memoryhierarchyhardware-os: Sizes, line widths and latencies of L1/L2/L3/DRAM on modern x86 and Apple M-series, and the data-layout rules that follow from them.›Homogeneous transformsgeometry: 4x4 affine and projective matrices, homogeneous coordinates, view and projection, normal matrices+ 3 more+ 1 more

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:

  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:

  1. The ADC delivers a block of samples per channel with a sample-count timestamp; the acquisition thread writes it to the ring buffer.
  2. The DSP thread reads the block, band-limits and decimates, windows, and runs an FFT per channel.
  3. 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.
  4. 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.
  5. Detections (beam, time, frequency, level) go to the tracker; each detection is associated with a track or starts a tentative one.
  6. 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.
  7. 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:

  1. A transmitter sends a waveform at a known time; the system records the transmit time against the sample counter.
  2. Receive channels are beamformed and matched-filtered; the output is a range-bearing grid.
  3. CFAR picks cells above the local noise; clusters become detections.
  4. Detections go to the tracker; echoes are gated using the previous ping's tracks and the own-ship motion between pings.
  5. 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:

  1. 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.
  2. Memory traffic: keep blocks in cache (CPU caches and the memory hierarchy) and process by block, not by sample.
  3. Timing: more nodes make the time base harder; discipline sample clocks with a PLL and stamp from the sample counter.
  4. 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).
  5. Model fidelity: range-dependent PE and 3-D models are expensive; run them on a slow cycle and cache by environment state.
  6. Storage: raw data grow fastest; compress, partition by time, keep processed data longer than raw.

Failure modes

FailureSymptomCauseFix
Wrong bearings in a turnContacts smear or jump during a manoeuvreArray bent, shape not estimated; heading sensors laggingArray shape estimation, sensor timing, hold bearings during a turn
Left-right ambiguity unresolvedMirror contactsLine array, no maneuver or second arrayResolve with a turn or a triplet array; show both until resolved
False alarms rise suddenlyDisplay full of detectionsCFAR window contaminated by strong lines or reverberationOrdered-statistic CFAR, guard cells
Missing contacts at rangeTargets seen only closeShadow zone, stale sound-speed profileRefresh the profile; rerun the propagation model
Range estimate divergesRange tracks wanderNo observer manoeuvre; filter not consistent for bearings-onlyRequire manoeuvre; use modified polar coordinates; check filter consistency
Phase errors between channelsBeam pattern distortedClock drift or dropped sample blocksGap detection on the sample counter; PLL to reference

Real implementations

namewhat it isrepolicencenotes
Acoustics Toolbox / Bellhopray 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 fixesA-New-BellHope/bellhopGPL-3.0mirror of the original
UnderwaterAcoustics.jlJulia toolbox for underwater acoustic modellingorg-arl/UnderwaterAcoustics.jlMITpairs with the Julia wrapper below
AcousticsToolbox.jlJulia wrapper for Bellhop, Kraken and othersorg-arl/AcousticsToolbox.jlMITmodel access from Julia
arlpyPython tools for acoustic signal processing and modellingorg-arl/arlpyBSD-3-Clauseanalysis and prototyping
PAMGuarddetection, classification and localisation of marine-mammal and other bioacoustic signalsPAMGuard/PAMGuardGPL-3.0open 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

Similar systems

Share the most building blocks with this one.