# Nonlinear Effect and MAI Impact on SAC-OCDMA System Based on 2D Multi-Diagonal Code and Laser Array
## 4 SAC-OCDMA System Performance Analysis  
In order to study the performance analysis of 2D-MD SAC-OCDMA system in LR-PON context, we present in this section the SNR, BER and Q-factor expressions. SNR is described as function of detected current at the photo-detector receiver divided by the current noise. It is computed as follows:  
\[SNR=\frac{l^{2}}{I_{noise}{}^{2}} \tag{4}\]  
\[I^{2}=\left(\frac{R_{\textit{S}}w_{1}}{M}\right)^{2} \tag{5}\]  
The \(I_{noise}{}^{2}\) term corresponds to the addition of the variance of the shot noise, the variance of the thermal noise, the variance of the PIIN noise and the variance of the amplifier noise given as follows:  
\[I_{noise}{}^{2}=I_{shot}{}^{2}+I_{thermal}{}^{2}+I_{PIN}{}^{2}+I_{amp}{}^{2} \tag{6}\]  
The variance of the shot noise and the variance of the thermal noise are given in Equations (7) and (8), respectively. \[I_{shot}{}^{2}=eB\frac{R_{\textit{S}}w_{1}}{M} \tag{7}\]  
Figure 2: 2D-MD SAC-OCDMA encoder (**a**) and decoder (**b**) for user 1. \[I_{thermal}{}^{2}=\frac{4K_{b}T_{n}B}{R_{l}} \tag{8}\]  
By checking the 2D-MD codes generated in Table 2, we have referred the overlapped chip, shown in red color. Moreover, it is known that MAI is overall generated when two ones at least have the same phase. As a result, this accompanies PINN at receiver level. To support the above mentioned result, a lot of works have been considered PINN effect in 2D-OCDMA system [13; 14]. The PINN variance can be calculated as follows [14]:  
\[I_{PINN}^{2}=BI^{2}\tau_{c}=BI^{2}\frac{\int_{0}^{\infty}r_{0}^{2}(v)dv}{\left( \int_{0}^{\infty}r_{0}(v)dv\right)^{2}}=BR^{2}\int_{0}^{\infty}r_{0}^{2}(v)dv \tag{9}\]  
\[=BR^{2}\int_{0}^{\infty}\left[\frac{P_{sr}}{K_{2}\Delta v}\sum_{k=1}^{K}d_{k} \mathcal{R}^{(0)}(i,j)\prod(v,i)\right]^{2}dv \tag{10}\]  
where  
\[\prod(v,i)=\left\{ \begin{array}{l}u\Big{[}v-v_{0}-\frac{\Delta v}{2M}(-M+2i) \Big{]}-\Big{[}v-v_{0}-u\frac{\Delta v}{2M}(-M+2i+2)\Big{]}\right\}=u\Big{[} \frac{\Delta v}{M}\Big{]}\\ I_{PINN}^{2}=\frac{BR^{2}P_{sr}^{2}}{(w_{2}\Delta v)^{2}}\Big{[}(w_{1}w_{2})^ {2}*\frac{\Delta v}{M}+0\Big{]}=\frac{BR^{2}P_{sr}^{2}}{\Delta vM}w_{1}^{2} \end{array} \right.\]  
The variance of the amplifier noise is given as follows:  
\[I_{amp}{}^{2}=(4S_{SAE}+2 hv)B \tag{11}\]  
where \(S_{SAE}=n_{sp}hv(G-1)\) is defined as the spectral density of the amplified spontaneous emission of the EFDA amplifier [28]. Likewise, \(v\) is the optical frequency, \(G\) is the gain of the amplifier, \(h\) is [PERSON]'s constant and \(n_{sp}\) is referred to as the spontaneous emission factor. \[SNR=\frac{\Big{(}\frac{RP_{gr}w_{1}}{M}\Big{)}^{2}}{eB\frac{RP_{gr}w_{1}}{M}+ \frac{(RP_{gr})^{2}Bw_{1}^{2}}{\Delta vM}+\frac{4K_{b}T_{n}B}{R_{l}}+(4S_{SAE }+2 hv)B} \tag{12}\]  
where \(B\), \(R\), \(Kb\), \(T_{n}\), \(RL\), \(P_{sr}\) and \(\Delta v\) are the PIN bandwidth, PIN Responsivity, Boltzmann constant, PIN temperature, load charge resistance, laser optical power and wavelength bandwidth. The BER is described as function of SNR as follows:  
\[BER=\frac{erfc\bigg{(}\sqrt{\frac{SNR}{8}}\bigg{)}}{2}\]  
Q-factor is described as function of BER as follows [29]:  
\[Q_{dB}=20 log_{10}\Big{(}\sqrt{2}erfc^{-1}(2 BER)\Big{)} \tag{13}\]  
The effect of the nonlinear impairment to the SAC-OCDMA system performance is studied through the generalized nonlinear Schrodinger (GNLS) equation, defined as follows [30]:  
\[\frac{\partial A}{\partial z}+\beta_{1}\frac{\partial A}{\partial t}-j\frac{ \beta_{2}}{2}\frac{\partial^{2}A}{\partial^{2}t}-\frac{\beta_{3}}{6}\frac{ \partial^{3}A}{\partial^{3}t}+\frac{\alpha}{2}A=-j\gamma|A|^{2}A \tag{14}\]  
where \(z\) is the propagation distance and \(A\) is the scalar version of the optical field. In Equation (14), the linear terms are the attenuation coefficient \(\alpha\), the group delay term \(\beta_{1}\), the second order dispersion coefficient \(\beta_{2}\) and the third order dispersion coefficient \(\beta_{3}\) whereas \(\gamma\) is the nonlinear coefficient (i.e., Kerr).