# SCATTER PHY: An Open Source Physical Layer for the DARPA Spectrum Collaboration Challenge
## Appendix A Two-Stage Detection Algorithm  
The very first processing executed by SCATTER PHY was the detection of incoming synchronization subframes, which might be followed by data-only subframes. This is a task of utmost importance once the correct detection of subframes is crucial in establishing links in scenarios with low SNR or limited by interference. In this Appendix, we describe the proposed detection algorithm employed in SCATTER PHY. For improved performance, the proposed algorithm was split into two stages. In the first stage, a buffer containing received samples with the length of a subframe was correlated with a local version of the Synch subframe, and then, if the Peak to Side-lobe Ratio (PSR) was greater than or equal to a predefined threshold, \(\text{Thresh}_{\text{1 st\_stage}}\), then the detection algorithm proceeded to the second stage. The Power Delay Profile (PDP) between the received signal and the local version of the sync subframe containing only the synchronization signal is defined as:  
\[ \begin{split}\text{PDP}_{\text{1 st\_stage}}(I)=\left|\sum_{n=0}^{ N_{\text{S}}-1}r[n]r_{I}^{*}[(n+l)_{N_{\text{S}}}]\right|^{2},\\ 0\leq l\leq N_{\text{S}}-1,\end{split}  \tag{1}\]  
where \(r(n)\) is the received signal, \(r_{l}(n)\) is the local version Synch subframe, \(N_{\text{S}}\) is the length of a subframe, \((. )_{N_{\text{S}}}\) denotes that this is a cyclic correlation, and \((. )^{*}\) is the complex conjugate. Therefore, the detection algorithm proceeds to the second stage if the PSR of the first stage is greater than or equal to the first stage threshold, as defined in (1). Figure 1 summarizes the processing carried out in the first stage of the synchronization sequence detection algorithm. As is seen in the figure, we used frequency domain cross-correlation as its implementation with FFTs and an IFFT is faster than the time domain version of the correlation [28]. \[\text{PSR}_{\text{1 st\_stage}}=\frac{\arg\max_{l}\text{PDP}_{\text{1 st\_stage }}(l)}{\arg\max_{i,j\
eq l}\text{PDP}_{\text{1 st\_stage}}(l)}\geq\text{Thresh}_ {\text{1 st\_stage}}. \tag{2}\]  
In the second stage, if \(\text{PSR}_{\text{1 st\_stage}}\geq\text{Thresh}_{\text{1 st\_stage}}\), then the \(l^{\text{th}}\) lag that maximized the numerator in (1) possibly points to the middle of the synchronization subframe. Based on the position of the \(l^{\text{th}}\) lag, it is possible to extract (i.e., convert the Synch OFDM symbol into frequency domain and extract the 72 complex symbols carrying the Synch sequence) the 72 symbol long synchronization sequence and correlate it with its local version as defined next. The PDP between the received Synch sequence and its local version is defined as:  
\[ \begin{split}\text{PDP}_{\text{2 nd\_stage}}(m)=\left|\sum_{n=0}^{N _{\text{Synch}}-1}S[n]S_{l}^{*}[(n+m)_{N_{\text{Synch}}}]\right|^{2},\\ 0\leq m\leq N_{\text{Synch}}-1,\end{split}  \tag{10}\]  
where \(S(n)\) is the received Synch sequence, \(S_{l}(n)\) is the local version of the Synch sequence, \(N_{\text{Synch}}\) is the length of the Synch sequence, \((. )_{N_{\text{Synch}}}\) denotes that this is a cyclic correlation, and \((. )^{*}\) is the complex conjugate. The signal processing carried out at the second stage is based on \(\text{PDP}_{\text{2 nd\_stage}}(m)\). For the sake of brevity, we use \(\text{PDP}(m)\) to denote \(\text{PDP}_{\text{2 nd\_stage}}(m)\) in what follows. The second stage of the proposed detection algorithm is based on the CA-CFAR algorithm [20]. It is used to detect the existence of the synchronization sequence within a given received signal buffer. The algorithm is used to calculate a variable detection threshold, which varies according to the noise power, based on the second stage PDP set of samples, \(\text{PDP}_{\text{2 nd\_stage}}(m)\).