## 2 The Proposed Bi-OCDMA System  
The proposed Bi-OCDMA technique was developed to transmit bipolar data signals over a common FSO channel. Each user data is created using a pseudorandom bit sequence (PRBS). A phase-shift keying (PSK) pulse generator along with electrical bias and electrical gain were applied to generate the modulation signal. For data processing, a phase modulator is used to encode the data bit of each user into an optical signal, which is transmitted to the decoder end through an FSO channel. Polarization splitters are utilized as polarization-shift keying devices. An optical circulator and a series of uniform FBGs were used as decoder devices. The balanced photodetection method was used to detect differences in the optical power between two optical signals using two photodiodes. In the proposed Bi-OCDMA scheme, the MAI effect was alleviated using a balanced photodetection method. In the single-user scheme, a family of M-sequences that forms all sequences of the same length is used in the Bi-OCDMA schemes. To maintain the cross-correlation property for MAI elimination in the proposed scheme, the zero-padding method was implemented by adding zeros after the last bit of the original M-sequence. The resulting code family is named the modified M-sequence in the remainder of this paper. Let \(X_{1}\) be a codeword from the modified M-sequences as follows:  
\[X_{1}=\left[x_{1}(1),\ x_{1}(2),\ldots,\ x_{1}(N),z_{p}\right] \tag{1}\]  
where \(x_{k}(i)\) is the \(i\)-th element of the \(k\)-th codeword of the modified M-sequence, \(N\) is the code length of the modified M-sequence, and \(z_{p}\) is the zero-padding element. Subsequently, the cyclic property of M-sequences is used to generate codewords of the same length using \(N\) and equation of \(X_{(k+1)}=T^{k}X_{1}\), where \(T\) is the shifting operator vectors cyclically to the right by one place, and \(k\) is the number of cyclic shifts to the right side. The implementation of polarization coding and modulation techniques for Bi-OCDMA schemes using modified M-sequence codes can be described as follows: when the data bit of the \(k\)-th user is \"1,\" the transmitted optical signal is modulated with the vertical (or horizontal) polarization state if the chip of codeword is \"0\" (or \"1\"), respectively. However, when the data bit of the \(k\)-th user is \"0,\" if the chip of codeword is \"0\" (or \"1\"), the transmitted optical signal is modulated with the horizontal (or vertical) polarization state, respectively. For example, the proposed modified M-sequence code of length 8 in the bipolar scheme can be expressed using the matrix as follows:  
\[X=\left[ \begin{array}{cccccccc}1&-1&1&1&1&-1&-1&-1\\ -1&1&1&1&-1&-1&1&-1\\ 1&1&1&-1&-1&1&-1&-1\\ 1&1&-1&-1&1&-1&1&-1\\ 1&-1&-1&1&-1&1&1&-1\\ -1&-1&1&-1&1&1&-1\\ -1&1&-1&1&1&1&-1&-1\\ \end{array} \right]=\left[ \begin{array}{cccccccc}1&0&1&1&1&0&0&0\\ 0&1&1&1&0&0&1&0\\ 1&1&1&0&0&1&0&0\\ 1&1&0&0&1&0&0\\ 1&0&0&1&0&1&1&0\\ 0&0&1&0&1&1&0\\ 0&0&1&0&1&1&0\\ 0&1&0&1&1&1&0\\ 0&1&0&1&1&1&0&0\\ \end{array} \right]=C_{V}-\overline{C}_{H} \tag{2}\]  
In Equation (2), \(x_{k}\) denotes the \(k\)-th row in the modified M-sequence matrix, which can be split into two unipolar codes, \(c_{kV}\) and \(\overline{c}_{kH}\). These two codes denote the positive and negative elements of \(x_{k}\), and form a complementary pair in the set \(\{0,1\}\). In this approach, \(x_{k}\) is sent a data bit \"1\" for the \(k\)-th user, where the complement row of \(x_{k}\) (denoting \(\overline{x}_{k}\)) is transmitted for a data bit \"0\" of the \(k\)-th user. The notation \((C_{V}-\overline{C}_{H})\) represents the matrix formed where all users sent a data bit \"1.\" Subsequently, the modified M-sequence matrix can be mapped to the wavelength domain, characterized by two orthogonal polarization states (vertical and horizontal). The first and second matrices are assigned to the vertical (\(C_{V}\)) and horizontal (\(\overline{C}_{H}\)) polarization states, respectively.