# Design of Encoding Algorithm for Underwater Wireless Optical Communication Based on Spinal Code
## 5 Simulation Verification  
The simulation is conducted under an AWGN channel with the following parameters: \(n=48\), \(k_{1}=k_{2}=8\), \(D=2\), \(v=32\), \(n_{m}/n_{l}=2\). The Spinal code uses the one-at-a-time hash function for mapping. The error correction coding for \(m_{m}\) employs an RNG based on LFSR (Linear Feedback Shift Register). The method for generating the parity bits of \(m_{m}\) is consistent with Simplification 2 in line 331 of the theoretical complexity analysis, where the parity bits are dynamically generated based on the random number generator mapping. The modulation uses Minimum Shift Keying (MSK), and the demodulation employs coherent demodulation, with a symbol rate \(B=10^{6}\); carrier frequency \(fc=2\times 10^{6}\); and initial symbol phase \(\varphi=0\). Given that the system enters an ineffective decoding region (with the error rate approaching the random guessing probability) when the SNR is below \(-14\) dB, and that the error rate converges as the channel conditions improve when the SNR exceeds \(0\) dB, this experiment selects the SNR range of \(-14\) to \(0\) dB as the core analysis window. This ensures the interpretability of the dynamic characteristics of the error rate curve within the observed range. Figure 3 compares the communication performance of the Superposition UEP-Spinal Code when the duty cycle of element 1 in the weighting factor matrix \(P\) is set to different values. Figure 3a shows the overall block error rate (BLER) performance comparison when the duty cycle of \(P\) is set to 1, 0.8, and 0.5, respectively. The block error rate represents the block-level error probability during data transmission. Figure 3b compares the BLER of MIB information and LIB information under the same duty cycle settings of 1, 0.8, and 0.5. The dynamic allocation of communication performance between MIBs and LIBs is achieved through the parameter configuration of the weight factor matrix P. Simulation results based on multiple sets of different weight factors under AWGN channels show that adjusting the weight distribution of matrix P can effectively regulate the BER differences between MIBs and LIBs, verifying the key role of the weight factor matrix in hierarchical information transmission. As the duty cycle of \(P\) decreases, the proportion of \(m_{l}\) elements in the final encoded data (from encoding step 4) gradually reduces. This sacrifices the communication performance of \(m_{l}\) to enhance the communication performance of \(m_{m}\). Since part of the data in \(m_{l}\) is reduced, the noise resistance of the tail bits is severely affected. From Figure 3a, it can be seen that as the duty cycle of \(P\) decreases, the overall BLER increases. Compared to the case where all elements of matrix \(P\) are 1, the average BLER of the encoding with an occupancy ratio of 0.8 increases by \(1.22\times 10^{-2}\), and the average BLER of the encoding with an occupancy ratio of 0.5 increases by \(3.42\times 10^{-2}\) over the SNR range of \(-14\) dB to 0 dB under the same SNR conditions. When the duty cycle of \(P\) becomes too low, the noise resistance of the tail bits decreases significantly, causing the bit error rate (BER) of the tail bits to rise sharply. The performance sacrificed in LIB information outweighs the performance improvement in MIB information, leading to a rapid increase in overall BLER. From Figure 3b, it can be observed that when the occupancy ratio of \(P\) is 0.8, compared to the encoding with an occupancy ratio of 1, the average BLER of MIBs decreases by \(1.83\times 10^{-2}\), while the average BLER of LIBs increases by \(7.32\times 10^{-2}\). When the occupancy ratio of \(P\) is 0.5, the average BLER of MIBs decreases by \(3.37\times 10^{-2}\), while the average BLER of LIBs increases by \(1.89\times 10^{-1}\). This indicates that by adjusting the duty cycle of element 1 in the weighting factor matrix \(P\), the communication performance between MIBs and LIBs can be tuned to adapt to different communication scenarios.