ek80_parse_proc: Simrad EK80 / EK60 / EA600 Broadband Chirp & Split-Beam Processing Engine
Overview & Purpose
ek80_parse_proc (ek80_parse_proc.c / ek80_parse_proc.h, ~1,676 lines combined) is a comprehensive parsing and broadband digital signal processing (DSP) library for Kongsberg Simrad EK80 (as well as legacy EK60 and EA600) scientific split-beam echosounders and ADCPs (e.g., EC150, EC300). Stripped out of readEA600.c into a standalone subr/ library by John Hughes Clarke in November 2023 (with updates through 2025/2026), it handles:
- XML0 Datagram Parsing (
libxml2): ParsesConfiguration,Environment,Parameter,PingSequence,InitialParameter, andSensorXML datagrams (unpack_EK80_xml_param). - Stage 1 (FPGA) & Stage 2 (PC) Filter Chains: Stores complex FIR filter coefficients and decimation factors (
ek80_fil) fromFIL1datagrams for up toMAX_NO_EK_TDCRS = 20transceiver channels. - Synthetic Transmit Pulse & Matched Filter Replication (
maketxpulse_EK80_channel): Generates the Hanning-tapered FM chirp (or CW pulse) at the undecimated transceiver clock rate, convolves and decimates it through the Stage 1 and Stage 2 complex filters, takes the time-reversed complex conjugate (flipcmplxchirp), and computes its spectral/Frobenius norm for calibrated pulse compression. - Broadband Pulse Compression & Split-Beam Interferometry (
process_EK80_channel): Deconvolves (match-filters) the 3 or 4 split-beam quadrant complex $I/Q$ traces (RAW3), converts complex voltages into calibrated acoustic power (dB) using transceiver/transducer impedances (ek80_R_wbt_rx,ek80_Ztrd), and resolves both Fore-Aft (AngleForAft) and Port-Starboard (AnglePorStb) electrical phase angles.
Key Constants & Data Structures
Constants & Legacy EK60/EA600 Structures
#define MAX_NO_EK_TDCRS 20 /* Supports up to 20 channels (e.g. 6-freq EK80 + EC150/EC300 ADCP) */
#define MAXEK60TRACELEN 80192 /* Maximum samples per trace */
#define MAXFILTERCOEFFS 2048 /* Max complex coefficients in Stage 1 / Stage 2 FIR filter */
#define EPOCH_DIFF 11644473600LL/* Seconds between 1601-01-01 (Windows FILETIME) and 1970-01-01 (Unix) */
ea600_datagram_header,ea600_configuration_header,ea600_configuration_transducer,ea600_sample_datagram: Binary structures for legacy Simrad EA600 and EK60 (CON0,RAW0) datagrams containing 16-bitPower[8192]and split-beamAngle[8192]arrays.
EK80 Filter, XML & Trace Structures
ek80_fil: HoldsStage,FilterType,ChannelID[128],NoOfCoefficients,DecimationFactor, andfcomplex Coefficients[2048]. Global instancesEK80_fil1[20]andEK80_fil2[20]store the two cascade filter stages per channel.ek80_mru: Motion Reference Unit record (dtime,heave,roll,pitch,heading) fromMRU0datagrams.ek80_xml_parameters: Extracted per-ping XMLParameterattributes (ChannelID,ChannelMode,PulseForm[0=CW, 1=FM],Frequency,FrequencyStart,FrequencyEnd,PulseDuration,SampleInterval,TransmitPower,Slope[Hanning taper fraction], andSoundVelocity).ek80_raw_header: Binary header of aRAW3datagram (ChannelID[128],Datatypebitmask encoding power/angle/complex16/complex32 and quadrant count in upper byte,Offset, and sampleCount).ek80_trace: Master per-channel processing structure containingparams,head, raw quadrant complex tracesTraces[4], match-filtered quadrant tracesTracesMatch[4], combined beam sums (TraceSum,PowerSum,TraceMatchSum,PowerMatchSum), paired half-beam sums (TraceMatchFor,TraceMatchAft,TraceMatchPor,TraceMatchStb), split-beam electrical phase angles (AnglePorStb,AngleForAft), and the decimated complex conjugate chirp (cmplxchirp,flipcmplxchirp).
Public Functions & Signatures
Channel Indexing & XML/RAW3 Parsing
int choose_TDCR_WBT(char *ChannelID)Maps an arbitrary 128-byte ASCIIChannelIDstring to a persistent slot0 .. MAX_NO_EK_TDCRS - 1intdcr_wbt_ID[].int unpack_EK80_xml_param(char *rawbytes, int datagramLength, ek80_xml_parameters *next_ek80_params, char *rootname)Parses anXML0payload usinglibxml2(xmlReadFile/xmlDocGetRootElement), identifying the root node (Configuration,Environment,Parameter,PingSequence,InitialParameter,Sensor) and populating*next_ek80_paramswhen<Parameter><Channel .../></Parameter>is encountered.int unpack_EK80_raw3_channel_header(char *rawbytes, ek80_trace *the_ek80_trace, int verbose)Reads the 140-byteRAW3header, verifiesChannelIDconsistency, extractsnoTraces = Datatype >> 8(1, 3, or 4 sub-beams/quadrants) and sample format (Datatype & 1Power,& 2Angle,& 4ComplexFloat16,& 8ComplexFloat32).int unpack_EK80_raw3_channel_traces(char *rawbytes, ek80_trace *the_ek80_trace)Dynamically allocates trace and matched-filter buffers on first sight of a channel, then unpacks either 32-bit float $(I, Q)$ quadrant arrays (Datatype & 8) or 16-bit logarithmic power and 8-bit electrical angles (Datatype & 1/& 2).
Broadband Matched Filtering & Split-Beam Phase Calculation
int maketxpulse_EK80_channel(ek80_trace *the_ek80_trace, int verbose)Synthesizes the ideal transmit chirp at undecimated sampling interval $\Delta t / (D_1 D_2)$ usingmake_chirp(), applies a Hanning taper of fractional widthSlope, convolves and decimates throughEK80_fil1andEK80_fil2viacmplx_convolve(), conjugates and time-reverses the resulting waveform intoflipcmplxchirp, and computes its normalization factor (calc_array_norm_squared/use_Octave_to_get_l2_norm).int process_EK80_channel(ek80_trace *the_ek80_trace, int proc_flags)- Computes the coherent average
TraceSumacross allnoTracesquadrants and converts it to uncompressed dB power (PowerSum) viacalcEK80_volt2power(). - If matched filtering is enabled (
proc_flags & 1), convolves each quadrant traceTraces[qi]withwhichchirpusing either time-domaincmplx_convolve()or fast frequency-domaincmplx_fft_convolve()(whendoFFTConvis set), normalizing bythel2norm * thel2norm. - Sums the match-filtered quadrants into
TraceMatchSumandPowerMatchSum. - For 4-quadrant (
ES70-7,ES120-7,ES200-7,ES333-7) or 3-sector (ES38-18,ES38-7) split-beam transducers, pairs quadrants into Fore, Aft, Port, and Starboard complex sums and computesAnglePorStbandAngleForAftviaangle_between_vectors()(orSimrad_4_Split/Simrad_3_Split).
- Computes the coherent average
How It Fits Into the OMG Architecture
ek80_parse_proc is the core processing engine for readEA600 (code/knudsen/readEA600.c) and the interactive broadband split-beam inspection suite EKlook (code/EKlook/EK_funcs.c), enabling full raw-voltage pulse compression and split-beam target tracking independent of Kongsbergβs proprietary software.