## 3 BBC Code Design and Optimization
### BBC Design Method  
In spread spectrum communication, when data are encoded into a PRN sequence, the data rate is much lower than the PRN chip rate. Therefore, a single data bit is subjected to an XOR operation with multiple PRN chips, which together are referred to as a combining window. According to this principle, if the PRN codes within the combining window are balanced, meaning that the numbers of 1 s and \(-1\) s are equal, a balance can be achieved. This eliminates the DC component during modulation. To obtain the BBC sequence, this paper considers the optimization design of three commonly used pseudo-random code sequences: m sequences, gold sequences, and Weil sequences. Among them, the m-sequence is generated by an n-stage feedback shift register, and its corresponding feedback polynomial can be expressed as [16]:  
\[f(x)=c_{0}+c_{1}+c_{2}x^{2}+\cdots+c_{n}x^{n},c_{0}=c_{n}=1 \tag{8}\]In the equation, \(c_{0}\), \(c_{1}\), \(c_{2}\), etc., represent the feedback coefficients. \(c_{1}\) and \(c_{n}\) are set to 1, while the remaining feedback coefficients are determined by the feedback polynomial, taking values of either 0 or 1. A coefficient of 0 indicates no feedback and 1 indicates participation in feedback. Once the feedback coefficients are determined, the m-sequence is also fixed, with its period being \(2^{n}-1\). Furthermore, gold sequences are generated by selecting two m-sequences of the same length, ensuring good correlation properties between them [17]. The Weil code is based on an XOR combination of two Legendre sequences of the same length. These two Legendre sequences share the same characteristic expression but differ by a certain phase offset. By varying the phase offset, different Weil code sequences can be generated. The characteristic expression of the Weil code sequence is given as [18]:  
\[W(k,w)=L(k)\oplus L((k+w)\text{mod}N),k=0,1,2,\ldots,N-1 \tag{9}\]  
In the equation, mod refers to the modulo operation; \(w\) is the phase difference between the two Legendre sequences; and \(L\) is the Legendre sequence, with its characteristic expression given as:  
\[L(k)=\left\{ \begin{array}{l}0,k=0\\ 1,k\
eq 0,and\ \ \text{there exists an integer $x$ such that $k=x^{2}\text{mod}N$}\\ 0,others\end{array} \right. \tag{10}\]  
Since the BBC sequence design requires modification of the original PRN sequence, an initial screening of the three pseudocode sequences is performed based on their correlation properties. The pseudocode with the best correlation performance is selected as the base sequence for the subsequent optimization of the BBC sequence. According to the requirements for gravitational wave detection and BBC sequence design, the length of the PRN sequence is set to 1024. To obtain a sequence of the desired length, m-sequences and gold sequences are traversed by inserting \(-1\) or \(1\), while for the Weil sequence, the nearest prime number to 1024, 1031, is used, and it is truncated using a 7-bit cycle. The results are shown in Table 1 and Figure 2 (the obtained results have not been normalized). Table 1 compares the correlation performance values of the three sequences before and after processing, while Figure 2 provides a visual comparison of the correlation performance of each sequence after processing. When the sequences were not processed, the autocorrelation of the m-sequence (\(-60.20\) dB) was significantly better than that of the other two sequences, and the cross-correlation was also relatively similar. After processing, the autocorrelation of the m-sequence shows significant changes, with its stability being weaker than that of the other two sequences. This will affect the performance of the sequence itself when designing the BBC sequence later. The transformation of the gold sequence before and after processing is minimal, but its self- and cross-correlation performance (\(-21.12\) dB, \(-22.25\) dB) is weaker than that of the Weil sequence (\(-23.82\) dB, \(-23.95\) dB).