## 2 The Proposed Bi-OCDMA System
\begin{array}{c}E_{1 in}\\ E_{2 in}\end{array} \right) \tag{8}\]  
where \(\alpha\) denotes the additional loss, \(p\) is the conjugate parameter, \(c\) denotes the coupling coefficient, and \(E_{in}\) is the input optical signal. When the data bit of the user is \"1\" (or \"0\"), only the first (or second) output of the optical couplers will have the signals and pass into the upper (or lower) polarization splitter to polarize the signals into the horizontal (or vertical) polarization state. These polarized signals are then combined through the polarization combiner. For example, if the  
Figure 1: Proposed Bi-OCDMA encoder. data bit of user#1 is \"0,\" the polarization combiner output corresponds to [\(\lambda_{1}\), \(\lambda_{3}\), \(\lambda_{4}\), \(\lambda_{5}\)]H and [\(\lambda_{2}\), \(\lambda_{6}\), \(\lambda_{7}\), \(\lambda_{8}\)]V; however, if the bit of user#1 is \"1,\" the polarization combiner output corresponds to [\(\lambda_{2}\), \(\lambda_{6}\), \(\lambda_{7}\), \(\lambda_{8}\)]H and [\(\lambda_{1}\), \(\lambda_{3}\), \(\lambda_{4}\), \(\lambda_{5}\)]V. Finally, the output of the encoder is transmitted via an FSO channel. Figure 2 illustrates the structure of the proposed Bi-OCDMA decoder, which is composed of a polarization splitter, two optical circulators, two series of uniform FBGs, two optical adders, two photodetectors, two low-pass Bessel filters, and one electrical subtractor to complete the bipolar scheme with balanced photodetection by subtracting the upper and lower signals to mitigate the MAI. The received optical signals are depolarized through the polarization splitter and then sent to the following two circulators, whose ports #2 are connected to two series of uniform FBGs. The wavelengths of these two series of uniform FBGs are determined using the assigned codewords. For example, the series of upper (or lower) uniform FBGs reflect the central wavelengths of \(\lambda_{1}\), \(\lambda_{3}\), \(\lambda_{4}\), and \(\lambda_{5}\) (or \(\lambda_{2}\), \(\lambda_{6}\), \(\lambda_{7}\), and \(\lambda_{8}\)) that correspond to chip \"1\" (or \"0\") of the codeword \(X_{1}\) = [1 0 1 1 1 0 0 0] in the uniform FBG decoder for user#1. The reflected signals subsequently enter port#3 of the circulator, whereas the transmitted signals of the two series of uniform FBGs are collected into the upper optical adder. A lower optical adder is used to gather optical signals from port#3 of each of the two optical circulators. From Equation (4), the received vertical (\(R_{V}\)) and horizontal signal (\(R_{H}\)) can be derived as follows, where the received optical signal (\(R\)) is equal to \(R_{V}+R_{H}\)[21]:  
\[R_{V}=\sum_{k=1}^{K}b_{k}c_{kV}+(1-b_{k})\overline{c}_{kV}\text{ and }R_{H}=\sum_{k=1}^{K}b_{k} \overline{c}_{kH}+(1-b_{k})c_{kH} \tag{9}\]  
where \(k\) denotes the number of active users, \(R_{V}\) is the sum of the optical signal with vertical polarization, and \(R_{H}\) represents the sum of the optical signal with horizontal polarization. Based on the above equation, the optical signal (\(R_{V}\)) with specific wavelengths corresponding to the position of the \"1s\" of \(\overline{c}_{kV}\) is reflected by the \(k\)-th user's uniform FBGs-based decoder, and then arrives at the lower optical adder. Simultaneously, the optical signal (\(R_{V}\)) with remainder wavelengths corresponding to the position of the \"1s\" of \(c_{kV}\) is sent to the upper optical adder. Conversely, the optical signal (\(R_{H}\)) with specific wavelengths corresponding to the position of the \"1s\" of \(c_{kH}\) arrives at the upper optical  
Figure 2: Proposed Bi-OCDMA decoder. adder after a series of lower uniform FBGs. Concurrently, the optical signal (\(R_{H}\)) with the reflected wavelengths is sent to the lower optical adder. The output signals of the upper and lower optical adders are then passed to the photodetectors for electrical subtraction to complete the balanced detection. This approach is detailed in the following equation:  
\[\theta_{xh}(k,l)-\theta_{\overline{n}\overline{h}}(k,l)=\left\{