# Algorithms and conventions ## Signal and downconversion The analytic sampled signal uses \[ x[n]=A\,c(\tau_n)b(\tau_n)s_{BOC}(\tau_n) e^{j(\phi_0+2\pi(f_{IF}+f_D)n/f_s+\pi\dot f_D(n/f_s)^2)}+w[n]. \] The generator defines a positive Doppler as positive complex phase rotation. Digital downconversion and a candidate Doppler wipeoff therefore use \[ y[n]=x[n]e^{-j2\pi(f_{IF}+f_{bin})n/f_s}. \] The phase-accumulator NCO has modulus \(2^P\), frequency-control word \(FCW=\operatorname{round}(f_o2^P/f_s)\), and update \(phase_{n+1}=(phase_n+FCW)\bmod 2^P\). ## Code and FFT acquisition Fractional code phase advances by \(f_c/f_s\) chips per sample and indexes the chip with `floor(phase) mod code_length`. The BOC(1,1) sine-phased square wave is +1 for the first half of a chip and -1 for the second half. This convention is shared by generation, acquisition, and tracking. The circular correlation is \[ R_f[k]=\operatorname{IFFT}\{\operatorname{FFT}(y_f[n]) \operatorname{FFT}(c[n])^*\}[k]. \] For coherent interval \(T_c\), the complex correlator output is retained before power formation. Noncoherent accumulation is explicitly \[ P_f[k]=\sum_{m=0}^{M-1}|R_{f,m}[k]|^2, \quad T_{obs}=M T_c. \] Differential combining uses adjacent complex results before magnitude. E1B hypothesis mode enumerates primary-epoch signs (limited to eight periods to bound exponential work). E1C search enumerates secondary phase; known-phase wipeoff uses phase zero at the first observation epoch. Delay results are reported over one 4 ms primary period even for longer coherent integrations. Zero-padding can provide a convenient FFT size or a denser interpolation of a particular numerical representation, but it does not increase signal bandwidth, physical information, or fundamental delay resolution. ## Detection After circularly excluding a guard interval around the main peak, the model computes \[ M_2=P_{max}/P_{second},\qquad M_\mu=P_{max}/\bar P_N, \] plus `(peak-noise_mean)/(sidelobe-noise_mean)` and a CFAR-style `(peak-noise_median)/noise_std`. The acquisition C/N0 diagnostic is \[ \widehat{C/N_0}=10\log_{10}\left((P_{max}-P_N)/(P_NT_c)\right). \] It is an estimator, not a calibrated RF measurement. Half-chip competitive BOC neighbors set a side-peak flag. `flag` is the implemented mitigation; an unambiguous BOC/CBOC strategy plugs into the detector without changing results. Parabolic interpolation preserves raw Doppler and sample bins. ## Tracking Each component channel owns carrier/code NCO phase, loop states, correlation history, lock counters, C/N0 history, and state-machine state. Phases advance at every accepted sample and never reset on Python block boundaries. Carrier discriminators are \[ e_{PLL,2}=\tan^{-1}(Q/I),\qquad e_{PLL,4}=\operatorname{atan2}(Q,I) \] in radians. The cross/phase-difference FLL is \[ e_{FLL}=\angle(P_kP_{k-1}^*)/(2\pi T)\quad[Hz]. \] The normalized envelope DLL reports a locally calibrated chip error \[ e_{DLL}=d\frac{|E|-|L|}{|E|+|L|}\quad[chips], \] with power and dot-product alternatives. A BOC false-lock flag compares VEVL and prompt magnitudes. For a second-order filter, noise bandwidth and damping generate \[ \omega_n=\frac{8\zeta B_n}{4\zeta^2+1},\quad k_p=2\zeta\omega_n,\quad k_i=\omega_n^2. \] The third-order starting model places three repeated stable poles derived from the same \(\omega_n\): correction \(3\omega_ne+3\omega_n^2\int e+\omega_n^3\iint e\). These are physical starting coefficients, not final optimized receiver-loop values. Carrier NCO frequency is corrected in hertz; code NCO frequency is nominal code rate plus DLL correction and optional carrier aiding \(f_{code,aid}=f_{carrier}f_c/f_{RF}\). Prompt C/N0 uses coherent versus total prompt moments over a sliding window and divides the ratio by integration time.